属性を持つ要素を考えます。この属性は、列挙からの値のみを持つことができます。
列挙の値によってこの要素の息子を条件付けすることは可能ですか?
私の英語はあまり上手ではないので、例があります:)
<xs:element minOccurs="0" name="datas">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element maxOccurs="1" name="data">
<xs:complexType>
<xs:attribute name="tag" type="xs:string" use="required"/>
<xs:attribute name="expr" type="xs:string" use="required"/>
<xs:attribute name="format" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="choice1"/>
<xs:enumeration value="choice2"/>
<xs:enumeration value="choice3"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<!-- HERE IS SOME SONS -->
<xs:element name="element1" />
<xs:element name="element2" />
<xs:element name="element3" />
</xs:element>
</xs:sequence>
</xs:complexType>
「choice1」を選択すると、element1が必須になり、element2/element3が禁止になります。「choice2」を選択すると、必須の要素2などが含まれます。
それが可能かどうか知っていますか?
答えてくれてありがとう