I have this XML
<contacts>
<entry id="10">
<commonName>Susan Sonntag</commonName>
<tel>+844332232323</tel>
<email>susan23@evermail.com</email>
<email>susa112@private.uk</email>
</entry>
<entry id="20">
<commonName>John Balber</commonName>
<email>balber@hatebook.com</email>
<tel>017297123232</tel>
<email>home@balber.org</email>
</entry>
<entry id="25">
<commonName>Mary Palmer</commonName>
<tel>017297123232</tel>
</entry>
</contacts>
I want that <tel>
and <email>
occur in any order and also optional (zero or unbounded).
I did it with xs:choice maxOccurs="unbounded"
but I am not sure if it's valid.
It is valid though not sure if this is the correct way.
<xs:choice maxOccurs="unbounded">
<xs:element name="tel" type="telType"/>
<xs:element name="email" type="emailType"/>
</xs:choice>
AFAIK xs:choice
means I can use only one of them but maxOccurs="unbounded
allows me to use all of them in any order.
Is it allowed? If no is there another way?
I am not quite sure what xs:choice
exactly does. Does it mean the order is irrelevant or I can use an one element?
And what exactly is xs:choice minOccurs="0" maxOccurs="unbounded"
? Does that mean I can use 0 to unlimited elements?
AND how about this?
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
...
</xs:choice>
</xs:sequence>