I have an XML document like below:
<operation name="func">
<param name="a" type="string">up</param>
<param name="b" type="integer">5</param>
<param name="c" type="CustomList">
<list>
<idx>0</idx>
<name>ZZZZ</name>
<value>0.5464</value>
</list>
<list>
<idx>1</idx>
<name>YYYY</name>
<value>0.464</value>
</list>
....
</param>
</operation>
and I wrote an XSD to restrict it:
<xs:complexType name="CustomListNode">
<xs:sequence>
<xs:element name="idx" type="xs:integer" />
<xs:element name="name" type="xs:string" />
<xs:element name="value" type="xs:decimal" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="CustomList">
<xs:sequence>
<xs:element name="list" type="CustomListNode" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="operation">
<xs:complexType>
<xs:sequence>
<xs:element name="param" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:NOTATION">
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="type" type="xs:integer" use="required" />
<xs:attribute name="type" type="xs:string" use="required" />
<xs:attribute name="type" type="CustomList" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
Of course, this doesn't work. Someone suggested me to use xs:alternative
in XSD 1.1.
But I only have libxml2 now. It doesn't support XSD 1.1.
How can I do in XSD 1.0? Or it cannot be implemented in XSD 1.0 absolutely?