XML technologies / XML Schema / XML Schema element reference / xs:enumeration

(Excerpt from “XML Schema” by Eric van der Vlist)

Facet restricting a data type to a finite value set.

<xs:enumeration
    id = xs:ID
    Wert = anySimpleType
    {beliebige Attribute mit einem Nicht-Schema-Namensraum}
    >
    Content: (xs:annotation?)
</xs:enumeration>

May occur within: xs:restriction (simple type), xs:restriction (simple content)

May be used as a facet for: xs:anyURI, xs:base64Binary, xs:byte, xs:date, xs:dateTime, xs:decimal, xs:double, xs:duration, xs:ENTITIES, xs:ENTITY, xs:float, xs:gDay, xs:gMonth, xs:gMonthDay, xs:gYear, xs:gYearMonth, xs:hexBinary, xs:ID, xs:IDREF, xs:IDREFS, xs:int, xs:integer, xs:language, xs:long, xs:Name, xs:NCName, xs:negativeInteger, xs:NMTOKEN, xs:NMTOKENS, xs:nonNegativeInteger, xs:nonPositiveInteger, xs:normalizedString, xs:NOTATION, xs:positiveInteger, xs:QName, xs:short, xs:string, xs:time, xs:token, xs:unsignedByte, xs:unsignedInt, xs:unsignedLong, xs:unsignedShort

Description

xs:enumeration defines a list of possible values for a data type’s value space by listing all values in separate xs:enumeration elements within one restriction step, beneath one rs:restriction parent element. Together with xs:pattern, it is one of two facets available for all data types, atomic, list or union. Unlike xs:pattern, xs:enumeration is not available for xs:boolean.

Restrictions

The values of xs:enumeration facets must belong to the base data type’s value space. If the base type already has an enumeration restriction, new values must be a subset of that enumeration, though alternative lexical representations of the same logical values are permitted.

This facet cannot be fixed; it remains available in all derived types.

This facet is unavailable for xs:boolean.

Example

<xs:simpleType name="schemaRecommendations">
    <xs:restriction base="xs:anyURI">
        <xs:enumeration value="http://www.w3.org/TR/xmlschema-0/"/>
        <xs:enumeration value="http://www.w3.org/TR/xmlschema-1/"/>
        <xs:enumeration value="http://www.w3.org/TR/xmlschema-2/"/>
    </xs:restriction>
</xs:simpleType>

Attributes

id
Element ID according to W3C XML Schema.

value
Value to add to the list of possible values for this data type.

   

 

 

 

back to top