XSD choice of sequences



I want an element <aaa> to contain either a sequence of element <bbb> or a sequence of two elements <bbb>,<ccc>. For example, the following is valid:



<aaa>
<bbb>
<bbb>
</aaa>


and



<aaa>
<bbb>
<ccc>
<bbb>
<ccc>
</aaa>


but the following is invalid:



<aaa>
<bbb>
<ccc>
<bbb>
</aaa>


I have tried the following scheme



<xs:complexType name="aaa">
<xs:choice minOccurs="0">
<xs:sequence minOccurs="0" maxOccurs="15">
<xs:element name="bbb" type="xxx" />
<xs:element name="ccc" type="xxx"/>
</xs:sequence>
<xs:sequence minOccurs="0" maxOccurs="15">
<xs:element name="bbb" type="xxx" />
</xs:sequence>
</xs:choice>
</xs:complexType>


but I have this error message when validating with JAXP: cos-nonambig: bbb and bbb (or elements from their substitution group) violate "Unique Particle Attribution" Is there a way that I can obtain my goal? Thanks in advance


No comments:

Post a Comment