[Playlist] Schema files and element order

Sebastian Pipping webmaster at hartwork.org
Wed Feb 14 13:47:42 UTC 2007


Hello!


== Intro ==
I tried to validate some XSPF files against the latest
schema files using XMLStarlet. The XSPF files were said
invalid though they looked perfectly valid to me.
And then I found out element order is important...


== The question ==
Is this valid XSPF or not?

<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
    <trackList>
        <track>
		<location>http://example.com/first/</location>
		<annotation>location below will burn us</annotation>
		<location>http://example.com/second/</location>
	</track>
    </trackList>
</playlist>


== The consequences ==
I suppose this is be valid - we are in deep trouble if not.
>From what I read XSD/WXS does not support unordered elements
in other ways than <sequence>, <choice> or <all> which all do
not fit here. Relax NG in contrast does support this: We just
wrap the body of <track> and <playlist> by <interleave> and
weare done.

I am curious what you think and suggest about this.



Sebastian


[1] RELAX NG Tutorial - 8. Interleaving
    http://www.oasis-open.org/committees/relax-ng/tutorial.html#IDAN1YR

[2] XML Schema Language Comparison - Relax NG's Advantages over W3C XML Schema
    http://en.wikipedia.org/wiki/XML_Schema_Language_Comparison
       #Advantages_over_W3C_XML_Schema

-------------- next part --------------
A non-text attachment was scrubbed...
Name: order_test.xspf
Type: text/xml
Size: 320 bytes
Desc: not available
Url : http://lists.musicbrainz.org/pipermail/playlist/attachments/20070214/c0fc4610/order_test.bin
-------------- next part --------------
== XMLStarlet version ==
1.0.1

== XSD ==
order_test.xspf:7: element location: Schemas validity error : Element 'location'
: This element is not expected. Expected is one of ( {http://xspf.org/ns/0/}info
, {http://xspf.org/ns/0/}image, {http://xspf.org/ns/0/}album, {http://xspf.org/n
s/0/}trackNum, {http://xspf.org/ns/0/}duration, {http://xspf.org/ns/0/}link, {ht
tp://xspf.org/ns/0/}meta, {http://xspf.org/ns/0/}extension ).
order_test.xspf - invalid

== Relax NG ==
order_test.xspf:7: element location: Relax-NG validity error : Did not expect el
ement location there
order_test.xspf - invalid

E:\workspace\libSpiff_Trunk\__schema_stuff>


-------------- next part --------------
@echo off
echo == XMLStarlet version ==
xml --version
echo.
echo == XSD ==
xml validate --err --xsd xspf-1_0.2.xsd order_test.xspf
echo.
echo == Relax NG ==
xml validate --err --relaxng xspf-1_0.3.rng order_test.xspf


More information about the Playlist mailing list