Error During Xml Parsing Of File Play Counts .plist
own site gives a relatively poor solution to the problem (see here). Normally SimpleXML is enough to handle most XML parsing needs, but the plist XML format is just broken enough to make parsing it with SimpleXML virtually impossible. Since I hadn't played with XMLReader much, I thought it would be a good chance to give it a spin. For the anxious types, the code is available on github in my php_class_lib project, so dig right in. Read on for a simple example (included in the repos). The original intent of the parser for me was to parse my iTunes' library in PHP, so this example will show doing just that: parse(dirname(__FILE__) . "/iTunes.xml"); var_dump($plist); And from that, the output is as follows: array(8) { ["Major Version"]=> int(1) ["Minor Version"]=> int(1) ["Application Version"]=> string(5) "8.0.1" ["Features"]=> int(5) ["Show Content Ratings"]=> bool(true) ["Music Folder"]=> string(60) "file://localhost/Users/testUser/Music/iTunes/iTunes%20Music/" ["Library Persistent ID"]=> string(15) "C39203948AF3D3E" ["Tracks"]=> array(1) { [1]=> array(25) { ["Track ID"]=> int(1) ["Name"]=> string(8) "My Track" ["Artist"]=> string(9) "My Artist" ["Album"]=> string(8) "My Album" ["Genre"]=> string(8) "My Genre" ["Kind"]=> string(15) "MPEG audio file" ["Size"]=> int(123456) ["Total Time"]=> int(123456) ["Track Number"]=> int(1) ["Year"]=> int(2008) ["Date Modified"]=> string(20) "2008-03-03T03:33:33Z" ["Date Added"]=> string(20) "2008-03-03T03:33:33Z" ["Bit Rate"]=> int(128) ["Sample Rate"]=> int(44100) ["Comments"]=> string(20) "All Rights Reserved." ["Release Date"]=> string(20) "2007-03-12T04:01:37Z" ["Persistent ID"]=> string(14) "C3E339393939E3" ["Track Type"]=> string(4) "File" ["Podcast"]=> bool(false) ["Unplayed"]=> bool(true) ["File Type"]=> int(123456) ["File Creator"]=> int(123456) ["Location"]=> string(66) "file://localhost/Users/testUser/Music/iTunes/iTunes%20Music/my.mp3" ["File Folder Count"]=> int(4) ["Library Folder Count"]=> int(1) } } } As you can see, the PHP parser made short order of that task. From here you now have full access to all the metadata in your iTunes library. Feel free to use the class in your own projects and be sure to let me know what you build with it. Tags: Apple, git, github, iTunes, OS X, parser, PHP, php_class_lib, plist, XML This entry was posted on Sunday, October 26th, 2008 a
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow http://www.jeremyjohnstone.com/blog/2008-10-26-php-parser-for-os-x-plist-xml-files.html Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Java Parsing iTunes XML library http://stackoverflow.com/questions/29581116/java-parsing-itunes-xml-library-using-xpath using XPath up vote 1 down vote favorite 1 So I'm trying to create a method that allows me to input a track ID that will then return the track name which belongs to the track ID. I am required to use XPath to parse the XML document into java which will in turn serialize a new library. A sample of my XML document is here: here for a quick overview of the http://stackoverflow.com/questions/27517655/parsing-through-an-xml-file-in-unix site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us https://www.scribd.com/document/75946131/PlexPlug-inFramework Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs error during Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Parsing through an xml file in Unix up error during xml vote 0 down vote favorite Trying to parse through a .plist file that has been converted to xml and get back a specific value. The file I'm working with is: