My xml tag is given below
<ADCNT>
<EM>
<RUID>
</ADCNT>
I can make EM tag as mandatory also the same thing I can do with RUID by providing minOccurs = 1 (<EM minOccurs=1>). But I want if both of them are not present then do not validate the xml against schema. If any one of them is present then validate the xml against schema. Means if EM tag is not present then RUID tag must be present and vice versa.
So, how to solve this problem?
Thanks Sunil kumar Sahoo
You need to make a choice:
<xs:element name="ADCNT">
<xs:complexType>
<xs:choice>
<xs:sequence>
<xs:element ref="EM" minOccurs="1"/>
<xs:element ref="RUID" maxOccurs="0"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="RUID" minOccurs="1"/>
</xs:sequence>
</xs:choice>
</xs:complexType>
</xs:element>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With