Я видел XML-схему ( EPP ), которая использовала xsd:choice
с элементом, даже если вместо этого мы можем использовать xsd:enumeration
:
<element name="access" type="epp:dcpAccessType"/>
<complexType name="dcpAccessType">
<choice>
<element name="all"/>
<element name="none"/>
<element name="null"/>
<element name="other"/>
<element name="personal"/>
<element name="personalAndOther"/>
</choice>
</complexType>
, чтобы сделатьясный вопрос, я буду использовать этот пример вместо:
<element name="sport" type="sportType"/>
<!-- using choice-->
<complexType name="sportType">
<choice>
<element name="football"/>
<element name="tennis"/>
</choice>
</complexType>
<!-- Or using enumeration-->
<simpleType name="sportType">
<restriction base="string">
<enumeration value="football"/>
<enumeration value="tennis"/>
</restriction>
</simpleType>
XML-пример с использованием этой схемы:
<!--using choice-->
<sport>
<football/>
</sport>
<!--using enumeration-->
<sport>football</sport>
почему они предпочитают xsd:choice
вместо xsd:enumeration
в этой ситуации ?
Спасибо