I'm trying to accomplish the following, here is my XML document :
<TEST>
<A>X</A>
<B>X</B>
<C>Y</C>
</TEST>
All the three element A, B and C must exist and only one of them must have Y value, the others must have X then.
I used the following code but apparently it's not working :
<xsd:complexType name="TEST">
<xsd:choice>
<xsd:sequence>
<xsd:element name="A" type="xsd:string" fixed="Y"/>
<xsd:element name="B" type="xsd:string" fixed="X"/>
<xsd:element name="C" type="xsd:string" fixed="X"/>
</xsd:sequence>
<xsd:sequence>
<xsd:element name="A" type="xsd:string" fixed="X"/>
<xsd:element name="B" type="xsd:string" fixed="Y"/>
<xsd:element name="C" type="xsd:string" fixed="X"/>
</xsd:sequence>
<xsd:sequence>
<xsd:element name="A" type="xsd:string" fixed="X"/>
<xsd:element name="B" type="xsd:string" fixed="X"/>
<xsd:element name="C" type="xsd:string" fixed="Y"/>
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
I've been stuck with this for a while, tried almost everything from asserts, alternatives to restrictions but nothing worked so desperately I tried the choice statement. Hopefully someone gets what I'm trying to do and explain how to accomplish it.