Skip to main content

XSPF in the wild and how to produce valid XSPF

I've been batch-checking the first 661 XSPF files that Google gives you when searching for filetype:xspf. As Murphy would have expected every error that could occur actually did. An interesting pattern is that

  • 47% of the checked XSPF files are invalid
  • 58% of these because of XML errors

That's shocking but I expected worse. As an XML parser is not allowed to ignore errors, there is no room to do so for an XSPF parser. Even big players like Magnatune have hit invalid XML below XSPF in the past (but took the time to fix it). Getting XML emission right - especially escaping what needs to be escaped - is the most important step on the way to valid XSPF. From the error distribution in today's test set I can tell these are the four most important steps you have to take with importance descending:

  1. Get your XML right, escape what's needed
  2. Get the XSPF namespace right, it's http://xspf.org/ns/0/ _with 0 for XSPF-1!
  3. Keep your URIs valid, they need loving too
  4. Wrap your own tags inside an <extension> element (or <meta> for simple stuff)

XSPF users around the globe will thank you for that. Have a valid night everyone. ;-)