I'm trying to create an XDS for an XML to describe a family. Basically a Mum/Dad being optional and comming in any order, and 0-* children. In this instance you can have the following
<family>
<DadsName>Fred</DadsName>
<MumsName>Wilma</MumsName>
<child>
<childName>pebbles</childName>
</child>
<child>
<childName>BamBam</childName>
</child>
</family>
In this msg the mum/dad names can come in any order, and some times they are optional -> This is important
I've created the following XSD..
<xs:element name="family">
<xs:complexType>
<xs:all>
<xs:element name="DadsName" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="MumsName" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="child" maxOccurs="unbounded" >
<xs:complexType>
<xs:sequence>
<xs:element name="childName" type="xs:string"/>
<xs:element name="childAge" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
I specifically added the <xs:all>
as the ordering of Mum and Dad can be jumbled, and the elements are optional as well.
Is this correct? I get the error 'The maxOccurs attribute is invalid. The value unBounded is invalid according to its datatype Union'
It looks like you are using an XSD 1.0 processor: what you have written is valid in XSD 1.1. You either need to find an XSD 1.1 processor, or change your aspirations: what you are trying to do can't be defined in 1.0.