Sunday 24 October 2004

Xml Sucks...

Well, not really - but some people obviously think XML has some serious deficiencies.

Came across that link - a long read but interesting points-of-view - while searching for info on the iTunes (rocks!) Music Library XML file. I want to move info between two installs of iTunes (song ratings, # plays, etc) and thought hacking the XML file would be fairly easy. However, the XML file itself it weird and not what you'd expect from a semantically-rich XML syntax.
<plist version="1.0">
<dict>
<key>Major Version</key><integer>1</integer>
<key>Minor Version</key><integer>1</integer>
<key>Application Version</key><string>4.6</string>
<key>Music Folder</key><string>file://localhost/F:/My%20iTunes/</string>
<key>Library Persistent ID</key><string>037D341EA9748F0D</string>
<key>Tracks</key>
<dict>
<key>136</key>
<dict>
<key>Track ID</key><integer>136</integer>
<key>Name</key><string>Evolution (Intro)</string>
<key>Artist</key><string>Bliss n Esso</string>
<key>Album</key><string>Flowers In The Pavement</string>
<key>Genre</key><string>Hip-Hop</string>
etc...

My first impression was that it was a pretty crappy XML implementation... so I jumped onto Google to see what others thought.

This article Playlist to XML had an interesting comment by Bob Ippolito:

>>"The plist format is nasty, whoever designed it really didn't know anything about XML."
>That's just totally wrong. XML Property Lists are a very unambiguous and simple serialization format. They're designed to be extremely simple and fast to parse (no attributes, etc.) because they're ubiquitous in OS X.
So maybe I was being too harsh on the format -- never jump to conclusions or make assumptions about technology! Try to anticipate the creator's goals rather than dumping on something because it doesn't fulfil yours. Here's Apple's doco fyi.

Anyway, the same blog has some useful code for transforming the iTunes format : Cleaning up iTunes plist XML. It's not quite what I want... but will get to that another time.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.