1

How can we got the child minOccur be defined on the basis of other element with the parent. For eg.

The flagExist if true then the ComplexTypeObject child element can be optional. If the flagExist is false then the child element ComplexTypeObject of has to be mandatory.

<xs:group name="GroupObject">
    <xs:sequence>
        <xs:element name="flagExist" type="xs:boolean"/>                                                
        <xs:element name="ComplexTypeObject" type="foo:ComplexTypeObject" minOccurs="0"/>       
    </xs:sequence>
</xs:group>
<xs:complexType name="ComplexTypeObject">
    <xs:sequence>
        <xs:element name="One" type="xs:boolean"/>                          
        <xs:element name="Two" type="xs:string"/>                   
        <xs:element name="Three" type="xs:date"/>
    </xs:sequence>
</xs:complexType>   

It is slightly different from the one asked in the already existing question(Require XML element in XSD when another element has certain value?). In this case the elements in the ComplexTypeObject.One ComplexTypeObject.two ComplexTypeObject.Three has to be made optional, depending on the true/false value of flagExist

0 Answers0