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

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

Global simple-type definition that can be referenced within the same schema or by other schemas.

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

May occur within: xs:redefine, xs:schema

Description

Global user-defined simple data types are defined directly beneath document element xs:schema, or redefined using xs:redefine , outside any particular content model’s scope. Their qualified names can be referenced within the same schema or another schema including or importing it.

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

Attribute name is unqualified because the type belongs to the defining schema’s target namespace. References must, however, add the prefix defined for that namespace.

Although simple types belong to their schema’s target namespace, they can be referenced to create types, attributes or elements for any namespace.

Further derivation by list, union, restriction or all of these can be blocked with attribute final.

Restrictions

W3C XML Schema provides no mechanism for adding 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="totalDigits">
    <xs:restriction base="xs:integer">
        <xs:totalDigits value="5"/>
    </xs:restriction>
</xs:simpleType>

Attributes

final
When set, blocks any further derivation of this data type, by list, union, derivation or all of these.

id
Element ID according to W3C XML Schema.

name
Unqualified name of this data type.

   

 

 

 

back to top