Difference between revisions of "XSPF v1 Notes and Errata"

From XiphWiki
Jump to: navigation, search
(Keep in "real" string leaf elements)
(Process in non-string leaf elements)
Line 78: Line 78:
* '''playlist.attribution.identifier'''
* '''playlist.attribution.location'''
* '''playlist.date'''
* '''playlist.identifier'''
* '''playlist.image'''
* '''playlist.info'''
* '''playlist.license'''
* '''playlist.link'''
* '''playlist.location'''
* '''playlist.meta'''
* '''playlist.trackList.track.duration'''
* '''playlist.trackList.track.identifier'''
* '''playlist.trackList.track.image'''
* '''playlist.trackList.track.info'''
* '''playlist.trackList.track.link'''
* '''playlist.trackList.track.location'''
* '''playlist.trackList.track.meta'''
* '''playlist.trackList.track.trackNum'''
=== Keep in "real" string leaf elements ===
=== Keep in "real" string leaf elements ===

Revision as of 16:17, 14 May 2007

This page lists errata of the XSPF version 1 document and also gives advice on using and understanding XSPF.


<trackList> and <trackNum> spelling

Please not that trackList and trackNum elements MUST NOT be written in all lowercase since XSPF is case-sensitive. These two are the only elements containing capital letters so just remember trackList and trackNum and your XSPF will be fine.

Absolute vs. relative URIs in key attibutes

The attributes rel (<meta> and <link>) and application (<extension>) are by XSPF v1 specification allowed to hold relative URIs. For example this meta element is legal in XSPF v1:

<meta rel="playCount">14</meta>

While this might look elegant it comes with several drawbacks:

  • You might easily forget that this string is a URI and include non-URI characters like spaces by mistake (e.g. rel="play count" is not valid)
  • You lose the namespace concept: nobody will know what or whom this key belongs to or came from

For these reasons it is strongly recommended to use absolute URIs as keys instead:

<meta rel="http://example.com/track/meta/playCount/1/0/">14</meta>

Version information in key attributes

When defining you own extensions to XSPF you will have to choose an application URI for your onw extensions:

<extension application="http://example.com/myext/">

Please consider including version information in your application URIs and increase it whenever the structure of your extension changes:

<extension application="http://example.com/xspf/track/1/0/">

This enables others to properly distinct different versions of your extensions without the need to do version guessing. Adding version information to rel of <meta> and <link> is a good idea as well:

<meta rel="http://example.com/track/meta/playCount/1/0/">14</meta>

Element order



Whitespace handling in XML can be a little difficult to understand at first. Since XSPF is based on XML, people implementing XSPF readers or writers do have to know about the basics of whitespace handling in XSPF. The good things is we summed it up here to make things easier for you.

Ignore in non-leaf elements

Whitespace in elements only holding child elements but no text must be ignored.

Elements affected:

  • playlist
  • playlist.attribution
  • playlist.trackList
  • playlist.trackList.track

Process in non-string leaf elements

In XSPF all elements with non-string content (i.e. of type dateTime, nonNegativeInteger, or anyURI) must be process with the "collapse" method. Sounds difficult but is easy:

  • Leading and trailing whitespace ('\t'(0x08), '\n'(0x0a), '\r'(0x0d), ' '(0x20)) is removed
  • Whitespace "in the middle" is converted to a single space (think s/[\t\n\r ]+/ / Perl people)

For example the three-line text


will become

  • playlist.attribution.identifier
  • playlist.attribution.location
  • playlist.date
  • playlist.identifier
  • playlist.image
  • playlist.info
  • playlist.license
  • playlist.link
  • playlist.location
  • playlist.meta
  • playlist.trackList.track.duration
  • playlist.trackList.track.identifier
  • playlist.trackList.track.image
  • playlist.trackList.track.info
  • playlist.trackList.track.link
  • playlist.trackList.track.location
  • playlist.trackList.track.meta
  • playlist.trackList.track.trackNum

Keep in "real" string leaf elements

Whitespace in string elements is significant and has to be preserved. So if <annotation> contains line feeds the annotation text really spans several lines:

<annotation>Line feeds and even spaces are preserved.
This example annotation spans two lines</annotation>

Elements affected:

  • playlist.annotation
  • playlist.creator
  • playlist.title
  • playlist.trackList.track.album
  • playlist.trackList.track.annotation
  • playlist.trackList.track.creator
  • playlist.trackList.track.title

Do X in Extensions

Whitespace handling inside of extension elements depends on the specific extension.

Elements affected:

  • playlist.extension
  • playlist.trackList.track.extension

Errata content

This paragraph describes the content of playlist.meta. It also reads "xspf:playlist elements MAY contain exactly one" which does not make sense for the content of an element and can be safely ignored. content

This paragraph describes the content of playlist.trackList.track.meta. It also reads "xspf:playlist elements MAY contain exactly one" which does not make sense for the content of an element and can be safely ignored.