XML technologies / XML Schema / XML Schema element reference / xs:simpleType (local definition)

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

Local definition of a simple type; local definitions cannot be referenced.

<xs:simpleType
    id = xs:ID
    {beliebige Attribute mit einem Nicht-Schema-Namensraum}
    >
    Content: (xs:annotation?, (xs:restriction | xs:list | xs:union))
</xs:simpleType>

May occur within: xs:attribute (reference or local definition), xs:attribute (global definition), xs:element (within xs:all), xs:element (reference or local definition), xs:element (global definition), xs:list, xs:restriction (simple type), xs:restriction (simple content), xs:union

Description

Local simple data types are defined directly where needed, during definition of elements, attributes or other simple types, for local anonymous use and therefore cannot be referenced elsewhere in the schema.

Like global simple data types, they are derived from other simple data types, predefined by W3C XML Schema or user-defined, using one of three derivation methods for simple types: xs:restriction to add restrictions to a data type, xs:list to define a list of values, and xs:union to unite the lexical spaces of several data types.

Restrictions

W3C XML Schema provides no mechanism for adding new primitive types or facets or changing the transformation between lexical and value spaces; changing the decimal-point representation, for example, is impossible.

Example

<xs:simpleType name="myInteger">
    <xs:restriction>
        <xs:simpleType>
            <xs:restriction base="xs:integer">
                <xs:maxExclusive value="5"/>
            </xs:restriction>
        </xs:simpleType>
        <xs:minInclusive value="-2"/>
    </xs:restriction>
</xs:simpleType>

Attributes

id
Element ID according to W3C XML Schema.

   

 

 

 

back to top