I want to validate the following XML, without imposing the order of points :
<?xml version='1.0' encoding='ISO-8859-1'?>
<root>
<name>Map corners</name>
<point>NW</point>
<point>SW</point>
<point>NE</point>
<point>SE</point>
</root>
My XSD is :
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="point" type="xs:string" fixed="NW"/>
<xs:element name="point" type="xs:string" fixed="SW"/>
<xs:element name="point" type="xs:string" fixed="NE"/>
<xs:element name="point" type="xs:string" fixed="SE"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
xmllint validates my XML.
But if I replace xs:sequence with xs:all (to release the order constraint : SW may be before NW), it doesn't validate, and I have the following message :
my6.xsd:4: element complexType: Schemas parser error : local complex type: The content model is not determinist.
Did I miss something ?
In XSD 1.0, you can't use xsd:any with a repeating element particle. You can do something like this:
<?xml version="1.0" encoding="utf-8" ?>
<!-- XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="point" minOccurs="4" maxOccurs="4">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="NW"/>
<xs:enumeration value="SW"/>
<xs:enumeration value="NE"/>
<xs:enumeration value="SE"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:key name="pk_points">
<xs:selector xpath="point"/>
<xs:field xpath="."/>
</xs:key>
</xs:element>
</xs:schema>