T
thierry
Hi,
I am trying to do something apparently simple but I cannot succeed.
I try to write a schema for an element containing several children
in any order but I want to restrict the number of occurrences of
each children.
This would be something like that, without the ordering which is
imposed by xs:sequence:
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="a" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="b" minOccurs="1" maxOccurs="unbounded" />
<xs:element name="c" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
For instance, the following should pass:
<root> <b/> <c/> <b/> <a/> </root>
But the following should not (two many <c/>):
<root> <b/> <c/> <b/> <c/> </root>
I tried several combinations using xs:all or xs:choice but I either
fail to restrict the number of occurences or fail to allow any order.
Your help will be greatly appreciated.
<thierry/>
I am trying to do something apparently simple but I cannot succeed.
I try to write a schema for an element containing several children
in any order but I want to restrict the number of occurrences of
each children.
This would be something like that, without the ordering which is
imposed by xs:sequence:
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="a" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="b" minOccurs="1" maxOccurs="unbounded" />
<xs:element name="c" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
For instance, the following should pass:
<root> <b/> <c/> <b/> <a/> </root>
But the following should not (two many <c/>):
<root> <b/> <c/> <b/> <c/> </root>
I tried several combinations using xs:all or xs:choice but I either
fail to restrict the number of occurences or fail to allow any order.
Your help will be greatly appreciated.
<thierry/>