XMLSchema - Choice + Element with at least one element

I have an xml schema that allows the following:

<xs:sequence>
    <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="A" />
        <xs:element ref="B" />
        <xs:element ref="C" />
    </xs:choice>
    <xs:element ref="D" minOccurs="0" maxOccurs="1"/>
</xs:sequence>

      

This means that I can create an element of 0 or more (A or B or C) and after that 0 or 1 (D). how

<A/><B/><A/><D>

      

or

<A/><B/><A/> 

      

or

<A/><C/><B/><A/>

      

I want to add another constraint: there must be at least one (A or B or C or D).

Can this limit be expressed by xsd?

+3


source to share





All Articles