Can xsd: enumeration tag be required / required?

Question about the short form. Can the xsd: enumeration tag have the required attribute, like any tag that uses this enumeration, SHOULD use a specific enumeration value at least once?

Details: for example, let's say that I already defined the fruit xml tag in my xsd. The fruit tag has an attribute whose value is the FruitType enumeration. It is defined as such:

<xsd:simpleType name="FruitType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Apple" />
<xsd:enumeration value="Banana" />
<xsd:enumeration value="Peach" />
<xsd:enumeration value="Orange" />
</xsd:restriction>
</xsd:simpleType>

I want to make the required value of the Apple enumeration such that the user has at least one label with the Apple attribute. Is it possible to use such a tag in an xsd enumeration? I thought that maybe we can use use = "required" or minOccurs = "1" in the xsd: enumeration tag. Please let me know.

Thank!

+2
1

" Apple". , - , ? - (, FruitBasket)? , , .

, XSD 1.0. XSD 1.1, , .

<xs:element name="FruitBasket">
  ...
  <xs:assert test=".//Fruit = 'Apple'"/>
</xs:element>

XSD 1.1 Xerces Saxon.

+2

All Articles