Saving XSPF playlist generates invalid XML
Posted: 10 Jun 2010 08:07
I'm putting this here in the forum because I couldn't find a ticket about it opened on Trac.
Saving an XSPF playlist that wasn't originally generated in VLC generates invalid XML (and by that fact invalid XSPF). I'm not sure why this doesn't happen with the VLC-generated XSPF but perhaps the serialisation routine is slightly different if no VLC extensions are found.
To replicate:
1. Save the following XML as an XSPF file, noting that it will validate with Pipping's XSPF xml validator (http://validator.xspf.org/):
2. Double-click it to open in VLC.
3. Click Media >> Save Playlist to File...
4. Now check the saved file in any XML validating tool (eg. Programmer's Notepad, Oxygen, XMLSpy, or even Pipping's XSPF validator mentioned above). The XML is invalid. The ampersands (&) in the file paths are not XML-encoded as (&).
Saving an XSPF playlist that wasn't originally generated in VLC generates invalid XML (and by that fact invalid XSPF). I'm not sure why this doesn't happen with the VLC-generated XSPF but perhaps the serialisation routine is slightly different if no VLC extensions are found.
To replicate:
1. Save the following XML as an XSPF file, noting that it will validate with Pipping's XSPF xml validator (http://validator.xspf.org/):
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<playlist xmlns="http://xspf.org/ns/0/" xmlns:spf="http://xspf.org/ns/0/" version="1">
<title>2008-07-23 Nathan import</title>
<identifier>itunes:playlist:2008-07-23NathanImport</identifier>
<trackList>
<track>
<location>file://localhost/F:/musik/Bob%20Marley%20&%20the%20Wailers/Natural%20Mystic_%20The%20Legend%20Lives%20On/07%20Africa%20Unite.m4a</location>
<creator>Bob Marley & the Wailers</creator>
<album>Natural Mystic: The Legend Lives On</album>
<title>Africa Unite</title>
<duration>173776</duration>
</track>
<track>
<location>file://localhost/F:/musik/Muse/Black%20Holes%20&%20Revelations/07%20Assassin.mp3</location>
<creator>Muse</creator>
<album>Black Holes & Revelations</album>
<title>Assassin</title>
<duration>211252</duration>
</track>
</trackList>
</playlist>
3. Click Media >> Save Playlist to File...
4. Now check the saved file in any XML validating tool (eg. Programmer's Notepad, Oxygen, XMLSpy, or even Pipping's XSPF validator mentioned above). The XML is invalid. The ampersands (&) in the file paths are not XML-encoded as (&).