I’m working on an iTunes menu bar controller and I want to get the names of all the songs in the user’s library. I have found that there is an XML file called iTunes Library.xml. It holds all the data for iTunes (name, artist, album etc) I want to be able to access that data to use in my controller.
I really have never used XML for anything so go easy…
I am also a noob at objective-C so go REALLY easy…
There are two things you are going to want to learn about to scan xml info. One is called
xpathand the other is calledxquery. On the surface they are both basically ways of creating a regular expression to grab different parts of xml data. Googling xpath should bring up many examples tor create any type of expression you can imagine.NSXMLParseris a Cocoa class that can create a parser object and has the methodnodesForXPathwhich will take yourxpathquery gather the results and store them in an array.Apple’s dev docs here