Simple Type Definitions
A simple type definition is a set of constraints on the value space and lexical space of a data type. Constraints are in the form of a restriction on the base type or the specification of a list type that is constrained by another simple type definition.
Simple type definitions are for all the built-in primitive and derived data types that are present in schemas.
A simple type definition is a set of constraints on strings and information about their values. This applies to values of attribute elements or element elements that have no child elements. It applies to attribute values and text-only content of elements.
A simple type definition uses the simpleType element, attributes, and valid constraining facets.
Each simple type definition (built-in or derived) is a restriction of some particular simple base type definition. For built-in simple types, this is the simple version ur-type definition, anySimpleType, which is understood to be a restriction of the ur-type definition. Simple types may also be defined whose members are lists of items themselves constrained by some other simple type definition.
Deriving Simple Types Using Restriction
New simple types can be defined using restriction.
Example
The following example shows a simple type definition that is created using a restriction base. The restriction element constrains the values of the simple type definition to values that are positive integers, as defined by the World Wide Web Consortium (W3C) Datatypes specification. These values must also be under 100, as indicated by the maxExclusive element.
<xs:simpleType> <xs:restriction base="xs:positiveInteger"> <xs:maxExclusive value="100"/> </xs:restriction> </xs:simpleType>
Deriving Simple Types Using List
New simple types can be defined using list. Data types derived by list contain a white space-delimited list of values that conform to the base type. A list data type must be derived from an atomic data type.
Example
The following example shows a simple unbounded list of floating-point numbers.
<element name="decimalsList"> <simpleType> <list itemType="decimal"/> </simpleType> </element>
Example
The following example shows an acceptable use of the decimalsList
data type in complying XML documents.
<decimalsList>-2.0 -3.0 8.6</decimalsList>