Page 1 of 1

Saving XSPF playlist generates invalid XML

Posted: 10 Jun 2010 08:07
by Donama
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/):

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>
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 (&).

Re: Saving XSPF playlist generates invalid XML

Posted: 10 Jun 2010 17:25
by Jean-Baptiste Kempf
Use vlc 1.1.0

Re: Saving XSPF playlist generates invalid XML

Posted: 10 Jun 2010 18:56
by erwan10
vlc1.1 has no problem with this ampersand issue.

Yet, the uri format file://localhost/C:/ ..... is not right, and won't work with vlc.
It has to be file:///C:/.......

Re: Saving XSPF playlist generates invalid XML

Posted: 15 Jun 2010 02:04
by Donama
Thanks jb and erwan. Erwan, are you saying the URI in my XSPF is an invalid URI or it just doesn't work in VLC?

Also wondering why this wouldn't be enforced by the XSPF schema, but that's another topic.

Re: Saving XSPF playlist generates invalid XML

Posted: 16 Jun 2010 03:09
by Rémi Denis-Courmont
file://localhost/ should work, but it's not recommended.

Re: Saving XSPF playlist generates invalid XML

Posted: 03 Aug 2010 09:59
by Donama
If the format file://localhost/X: is not recommended, then what is recommended? Where can I find out more about what VLC expects? Thanks.

Re: Saving XSPF playlist generates invalid XML

Posted: 03 Aug 2010 17:07
by Rémi Denis-Courmont
file:///X: