I want to define a xml schema where the element Connectors have 0-* child elements. Either Sequence, Association or Message in any order and 0 to many times. I.e.
<Connectors>
<Sequence />
<Association />
<Message />
<Sequence />
<Sequence />
<Message />
<Message />
<Association />
</Connectors>
I tried to define the following schema but it seems like the order is fixed.
<xs:element name="Connectors">
<xs:complexType>
<xs:sequence>
<xs:element ref="Association" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Message" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Sequence" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
I solved it by setting to choice and setting minOccurs and maxOccurs attributes.