1

I have an element A of type AType defined as an enumeration of strings like this:

<xs:simpleType name="AType">
    <xs:restriction base="xs:string">
        <xs:enumeration value="1"/>
        <xs:enumeration value="2"/>
        <xs:enumeration value="3"/>
    </xs:restriction>
</xs:simpleType>

Then I have a complex type defined like this:

<xs:complexType name="MyComplexType">
    <xs:sequence>
        <xs:element name="A" type="AType"/>
        <xs:element name="B" type="xs:string" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>

Actually, the element named B is present only if the element named A has value "3". Is it possible to express such a boundary with XSD?

nyarlathotep108
  • 5,275
  • 2
  • 26
  • 64

0 Answers0