I want to define that the first element will be of a specific type, and the following will be some elements in any order. Like this:
<node>
<!-- always at first -->
<node-data>
...
</node-data>
<!-- other nodes in any order-->
<node3></node3>
<node1></node1>
<node2></node2>
</node>
I can't use <xsd:sequence>
because it will force all nodes to be in order.
Thanks for your help. Sorry on my english.
A good starting layout could look like this:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="node">
<xs:complexType>
<xs:sequence>
<xs:element name="node-data"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="node3" />
<xs:element name="node1" />
<xs:element name="node2" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
You could then refine the types, add more nodes under the choice, etc. If you want to support wildcards, then use of xs:any
would be required.