This document is also available in these nonnormative formats: XML, XHTML with changes since version 1.0 marked, XHTML with changes since previous Working Draft marked, Independent copy of the schema for schema documents, ↓A schema for builtin datatypes only, in a separate namespace↓, Independent copy of the DTD for schema documents, and List of translations.
Copyright © 2006 W3C^{®} (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This is a ↑Last Call↑ Public Working Draft of XML Schema 1.1↑: Datatypes↑. It is here made available for review by W3C members and the public. ↓It is intended to give an indication of the W3C XML Schema Working Group's intentions for this new version of the XML Schema language and our progress in achieving them. It attempts to be complete in indicating what will change from version 1.0, but does not specify in all cases how things will change. ↓ This version of this document was created on 17 February 2006.
For those primarily interested in the changes since version 1.0, the Changes since version 1.0 (§J) appendix, which summarizes both changes already made and also those in prospect, with links to the relevant sections of this draft, is the recommended starting point. An accompanying version of this document displays in color all changes to normative text since version 1.0; another shows changes since the previous Working Draft.
The major changes since version 1.0 include:
Changes since the previous Working Draft include the following:
Comments on this document should be made in W3C's public installation of Bugzilla, specifying "XML Schema" as the product. Instructions can be found at http://www.w3.org/XML/2006/01/publicbugzilla. If access to Bugzilla is not feasible, please send your comments to the W3C XML Schema comments mailing list, wwwxmlschemacomments@w3.org (archive) Each Bugzilla entry and email message should contain only one comment.
The end of the Last Call review period is 31 March 2006; comments received after that date will be considered if time allows, but no guarantees can be offered.
Although feedback based on any aspect of this specification is welcome, there are certain aspects of the design presented herein for which the Working Group is particularly interested in feedback. These are designated 'priority feedback' aspects of the design, and identified as such in editorial notes at appropriate points in this draft.
Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document has been produced by the W3C XML Schema Working Group as part of the W3C XML Activity. The goals of the XML Schema language version 1.1 are discussed in the Requirements for XML Schema 1.1 document. The authors of this document are the members of the XML Schema Working Group. Different parts of this specification have different editors.
This document was produced under the 5 February 2004 W3C Patent Policy. The Working Group maintains a public list of patent disclosures made in connection with this document; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) with respect to this specification must disclose the information in accordance with section 6 of the W3C Patent Policy.
The English version of this specification is the only normative version. Information about translations of this document is available at http://www.w3.org/2003/03/Translations/byTechnology?technology=xmlschema.
The presentation of this document has been augmented to
identify changes from a previous version, controlled by dgstatusquocolor1.0.xml
, which shows differences from version 1.0 of this specification. Three kinds of changes are highlighted:
↑new, added text↑,
↑changed text↓, and
↓deleted text↓.
The Working Group has two main goals for this version of W3C XML Schema:
The overall aim as regards compatibility is that
The [XML] specification defines limited facilities for applying datatypes to document content in that documents may contain or refer to DTDs that assign types to elements and attributes. However, document authors, including authors of traditional documents and those transporting data in XML, often require a higher degree of type checking to ensure robustness in document understanding and data interchange.
The table below offers two typical examples of XML instances in which datatypes are implicit: the instance on the left represents a billing invoice, the instance on the right a memo or perhaps an email message in XML.
Data oriented  Document oriented 

<invoice> <orderDate>19990121</orderDate> <shipDate>19990125</shipDate> <billingAddress> <name>Ashok Malhotra</name> <street>123 Microsoft Ave.</street> <city>Hawthorne</city> <state>NY</state> <zip>105320000</zip> </billingAddress> <voice>5551234</voice> <fax>5554321</fax> </invoice> 
<memo importance='high' date='19990323'> <from>Paul V. Biron</from> <to>Ashok Malhotra</to> <subject>Latest draft</subject> <body> We need to discuss the latest draft <emph>immediately</emph>. Either email me at <email> mailto:paul.v.biron@kp.org</email> or call <phone>5559876</phone> </body> </memo> 
The invoice contains several dates and telephone numbers, the postal abbreviation for a state (which comes from an enumerated list of sanctioned values), and a ZIP code (which takes a definable regular form). The memo contains many of the same types of information: a date, telephone number, email address and an "importance" value (from an enumerated list, such as "low", "medium" or "high"). Applications which process invoices and memos need to raise exceptions if something that was supposed to be a date or telephone number does not conform to the rules for valid dates or telephone numbers.
In both cases, validity constraints exist on the content of the instances that are not expressible in XML DTDs. The limited datatyping facilities in XML have prevented validating XML processors from supplying the rigorous type checking required in these situations. The result has been that individual applications writers have had to implement type checking in an ad hoc manner. This specification addresses the need of both document authors and applications writers for a robust, extensible datatype system for XML which could be incorporated into XML processors. As discussed below, these datatypes could be used in other XMLrelated standards as well.
Other specifications on which this one depends are listed in References (§L).
This specification defines some datatypes which depend on definitions in [XML] and [Namespaces in XML]; those definitions, and therefore the datatypes based on them, vary between version 1.0 ([XML 1.0], [Namespaces in XML 1.0]) and version 1.1 ([XML], [Namespaces in XML]) of those specifications. In any given use of this specification, the choice of the 1.0 or the 1.1 definition of those datatypes is implementationdefined.
Conforming implementations of this specification may provide either the 1.1based datatypes or the 1.0based datatypes, or both. If both are supported, the choice of which datatypes to use in a particular assessment episode should be under user control.
The [XML Schema Requirements] document spells out concrete requirements to be fulfilled by this specification, which state that the XML Schema Language must:
This portion of the XML Schema Language discusses datatypes that can be used in an XML Schema. These datatypes can be specified for element content that would be specified as #PCDATA and attribute values of various types in a DTD. It is the intention of this specification that it be usable outside of the context of XML Schemas for a wide range of other XMLrelated activities such as [XSL] and [RDF Schema].
This section describes the conceptual framework behind the ↑data↑type system defined in this specification. The framework has been influenced by the [ISO 11404] standard on languageindependent datatypes as well as the datatypes for [SQL] and for programming languages such as Java.
The datatypes discussed in this specification are ↓computer representations of↓↑for the most part↑ well known abstract concepts such as integer and date. It is not the place of this specification to ↑thoroughly ↑define these abstract concepts; many other publications provide excellent definitions.↑ However, this specification will attempt to describe the abstract concepts well enough that they can be readily recognized and distinguished from other abstractions with which they may be confused.↑
[Definition:] In this specification, a datatype is a 3tuple, consisting of a) a set of distinct values, called its ·value space·, b) a set of lexical representations, called its ·lexical space·, and c) a set of ·facet·s that characterize properties of the ·value space·, individual values or lexical items.
[Definition:] In this specification, a datatype has three properties:
Along with the ·lexical mapping· it is often useful to have an inverse which provides a standard ·lexical representation· for each value. Such a ·canonical mapping· is not required for schema processing, but is described herein for the benefit of users of this specification, and other specifications which might find it useful to reference these descriptions normatively. For some datatypes, notably QName and NOTATION, the mapping from lexical representations to values is contextdependent; for these types, no ·canonical mapping· is defined.
The ·pattern· facet, on the other hand, restricts the ·lexical space· directly. When more than one lexical representation is provided for a given value, the ·pattern· facet may remove the ·canonical representation· while permitting a different lexical representation; in this case, the value remains in the ·value space· but has no ·canonical representation·. This specification provides no recourse in such situations. Applications are free to deal with it as they see fit.
[Definition:] A value space is the set of values for a given datatype. Each value in the value space of a datatype is denoted by one or more literals in its ·lexical space·.
[Definition:] The value space of a datatype is the set of values for that datatype. Associated with each value space are selected operations and relations necessary to permit proper schema processing. Each value in the value space of a datatype is denoted by one or more character strings in its ·lexical space·, according to ·the lexical mapping·. (If the mapping is restricted during a derivation in such a way that a value has no denotation, that value is dropped from the value space.)
The value spaces of datatypes are abstractions, and are defined in ↓Builtin datatypes↓↑Builtin Datatypes and Their Definitions↑ (§3) to the extent needed to clarify them for readers. For example, in defining the numerical datatypes, we assume some general numerical concepts such as number and integer are known. In many cases we provide references to other documents providing more complete definitions.
In addition, other applications are expected to define additional appropriate operations and/or relations on these value spaces (e.g., addition and multiplication on the various numerical datatypes' value spaces), and are permitted where appropriate to even redefine the operations and relations defined within this specification, provided that for schema processing the relations and operations used are those defined herein.
The ·value space· of a ↓given ↓datatype can be defined in one of the following ways:
·value spaces· have certain properties. For example, they always have the property of ·cardinality·, some definition of equality and might be ·ordered·, by which individual values within the ·value space· can be compared to one another. The properties of ·value spaces· that are recognized by this specification are defined in Fundamental facets (§2.5.1).
The relations of identity, equality, and order are required for each value space. A very few datatypes have other relations or operations prescribed for the purposes of this specification.
The identity relation is always defined. Every value space inherently has an identity relation. Two things are identical if and only if they are actually the same thing: i.e., if there is no way whatever to tell them apart. The identity relation is used when making ·facetbased restrictions· by enumeration, when checking identity constraints, and when checking value constraints. These are the only uses of identity for schema processing.
In the identity relation defined herein, values from different ·primitive· datatypes' ·value spaces· are made artificially distinct if they might otherwise be considered identical. For example, there is a number two in the decimal datatype and a number two in the float datatype. In the identity relation defined herein, these two values are considered distinct. Other applications making use of these datatypes may choose to consider values such as these identical, but for the view of ·primitive· datatypes' ·value spaces· used herein, they are distinct.
WARNING: Care must be taken when identifying
values across distinct primitive datatypes. The
·literals· '0.1
' and '0.10000000009
' map
to the same value in float (neither is in the value
space, and each is mapped to the nearest value, namely
0.100000001490116119384765625), but map to distinct values in decimal.
Each ·primitive· datatype has prescribed an equality relation for its value space. The equality relation for most datatypes is the identity relation. In the few cases where it is not, equality has been carefully defined so that for most operations of interest to the datatype, if two values are equal and one is substituted for the other as an argument to any of the operations, the results will always also be equal.
On the other hand, equality need not cover the entire value space of the datatype (though it usually does). In particular, NaN <> NaN in the precisionDecimal, float, and double datatypes.
The equality relation is used in conjunction with order when making ·facetbased restrictions· involving order. This is the only use of equality for schema processing.
For example, the float datatype has an equality which is not the identity ( −0 = +0 , but they are not identical—although they were identical in the 1.0 version of this specification), and whose domain excludes one value, NaN, so that NaN ≠ NaN .
For another example, the dateTime datatype previously lost any timezone information in the ·lexical representation· as the value was converted to ·UTC·; now the timezone is retained and two values representing the same "moment in time" but with different remembered timezones are now equal but not identical.
In the equality relation defined herein, values from different primitive data spaces are made artificially unequal even if they might otherwise be considered equal. For example, there is a number two in the decimal datatype and a number two in the float datatype. In the equality relation defined herein, these two values are considered unequal. Other applications making use of these datatypes may choose to consider values such as these equal (and must do so if they choose to consider them identical); nonetheless, in the equality relation defined herein, they are unequal.
For the purposes of this specification, there is one equality relation for all values of all datatypes (the union of the various datatype's individual equalities, if one consider relations to be sets of ordered pairs). The equality relation is denoted by '=' and its negation by '≠', each used as a binary infix predicate: x = y and x ≠ y . On the other hand, identity relationships are always described in words.
Each datatype has an order relation prescribed. This order may be a partial order, which means that there may be values in the ·value space· which are neither equal, lessthan, nor greaterthan. Such value pairs are incomparable. In many cases, the prescribed order is the "null order": the ultimate partial order, in which no pairs are lessthan or greaterthan; they are all equal or ·incomparable·. [Definition:] Two values that are neither equal, lessthan, nor greaterthan are incomparable. Two values that are not ·incomparable· are comparable. The order relation is used in conjunction with equality when making ·facetbased restrictions· involving order. This is the only use of order for schema processing.
In this specification, this lessthan order relation is denoted by '<' (and its inverse by '>'), the weak order by '≤' (and its inverse by '≥'), and the resulting ·incomparable· relation by '<>', each used as a binary infix predicate: x < y , x ≤ y , x > y , x ≥ y , and x <> y .
The value spaces of primitive datatypes are abstractions, which may have values in common. In the order relation defined herein, these value spaces are made artificially ·incomparable·. For example, the numbers two and three are values in both the precisionDecimal datatype and the float datatype. In the order relation defined herein, two in the decimal datatype and three in the float datatype are incomparable values. Other applications making use of these datatypes may choose to consider values such as these comparable.
While it is not an error to attempt to compare values from the value spaces of two different primitive datatypes, they will always be ·incomparable· and therefore unequal: If x and y are in the value spaces of different primitive datatypes then x <> y (and hence x ≠ y ).
In addition to its ·value space·, each datatype also has a lexical space.
[Definition:] A lexical space is the set of valid literals for a datatype.
For example, "100" and "1.0E2" are two different literals from the ·lexical space· of float which both denote the same value. The type system defined in this specification provides a mechanism for schema designers to control the set of values and the corresponding set of acceptable literals of those values for a datatype.
While the datatypes defined in this specification have, for the most part, a single lexical representation i.e. each value in the datatype's ·value space· is denoted by a single literal in its ·lexical space·, this is not always the case. The example in the previous section showed two literals for the datatype float which denote the same value. Similarly, there ·may· be several literals for one of the date or time datatypes that denote the same value using different timezone indicators.
[Definition:] A canonical lexical representation is a set of literals from among the valid set of literals for a datatype such that there is a onetoone mapping between literals in the canonical lexical representation and values in the ·value space·.
[Definition:] The lexical mapping for a datatype is a prescribed function whose domain is a prescribed set of character strings (the ·lexical space·) and whose range is the ·value space· of that datatype.
[Definition:] The lexical space of a datatype is the prescribed domain of ·the lexical mapping· for that datatype.
[Definition:] The members of the ·lexical space· are lexical representations of the values to which they are mapped.
[Definition:] A sequence of zero or more characters in the Universal Character Set (UCS) which may or may not prove upon inspection to be a member of the ·lexical space· of a given datatype and thus a ·lexical representation· of a given value in that datatype's ·value space·, is referred to as a literal. The term is used indifferently both for character sequences which are members of a particular ·lexical space· and for those which are not.
Should a derivation be made using a derivation mechanism that removes ·lexical representations· from the·lexical space· to the extent that one or more values cease to have any ·lexical representation·, then those values are dropped from the ·value space·.
Conversely, should a derivation remove values then their ·lexical representations· are dropped from the ·lexical space· unless there is a facet value whose impact is defined to cause the otherwisedropped ·lexical representation· to be mapped to another value instead.
For example, '100' and '1.0E2' are two different ·lexical representations· from the float datatype which both denote the same value. The datatype system defined in this specification provides mechanisms for schema designers to control the ·value space· and the corresponding set of acceptable ·lexical representations· of those values for a datatype.
While the datatypes defined in this specification generally have a single ·lexical representation· for each value (i.e., each value in the datatype's ·value space· is denoted by a single ·representation· in its ·lexical space·), this is not always the case. The example in the previous section shows two ·lexical representations· from the float datatype which denote the same value.
[Definition:] The canonical mapping is a prescribed subset of the inverse of a ·lexical mapping· which is onetoone and whose domain (where possible) is the entire range of the ·lexical mapping· (the ·value space·). Thus a ·canonical mapping· selects one ·lexical representation· for each value in the ·value space·.
[Definition:] The canonical representation of a value in the ·value space· of a datatype is the ·lexical representation· associated with that value by the datatype's ·canonical mapping·.
·Canonical mappings· are not available for datatypes whose ·lexical mappings· are context dependent (i.e., mappings for which the value of a ·lexical representation· depends on the context in which it occurs, or for which a character string may or may not be a valid ·lexical representation· similarly depending on its context)
[Definition:] A facet is a single defining aspect of a ·value space·. Generally speaking, each facet characterizes a ·value space· along independent axes or dimensions.
The facets of a datatype serve to distinguish those aspects of one datatype which differ from other datatypes. Rather than being defined solely in terms of a prose description the datatypes in this specification are defined in terms of the synthesis of facet values which together determine the ·value space· and properties of the datatype.
Facets are of two types: fundamental facets that define the datatype and nonfundamental or constraining facets that constrain the permitted values of a datatype.
[Definition:] A fundamental facet is an abstract property which serves to semantically characterize the values in a ·value space·.
All fundamental facets are fully described in Fundamental Facets (§4.2).
[Definition:] A constraining facet is an optional property that can be applied to a datatype to constrain its ·value space·.
Constraining the ·value space· consequently constrains the ·lexical space·. Adding ·constraining facets· to a ·base type· is described in Derivation by restriction (§4.1.2.1).
All constraining facets are fully described in Constraining Facets (§4.3).
It is useful to categorize the datatypes defined in this specification along various dimensions, ↓forming a set of characterization dichotomies↓↑defining terms which can be used to characterize datatypes and the Simple Type Definitions which define them↑.
The first distinction to be made is that between ·atomic·, ·list· and ·union· datatypes.
For example, a single token which ·matches· Nmtoken from [XML] ↓could be the value↓↑is in the value space↑ of ↓an↓↑the↑ ·atomic· datatype ↓(↓NMTOKEN↓);↓↑,↑ while a sequence of such tokens ↓could be the value of a↓↑is in the value space of the↑ ·list· datatype ↓(↓NMTOKENS↓)↓.
↓·atomic· datatypes can be either ·primitive· or derived. The ·value space· of an ·atomic· datatype is a set of "atomic" values, which for the purposes of this specification, are not further decomposable. ↓↑An ·atomic· datatype has a ·value space· consisting of a set of "atomic" values which for purposes of this specification are not further decomposable. ↑ The ·lexical space· of an ·atomic· datatype is a set of ↓literals↓↑·literals·↑ whose internal structure is specific to the datatype in question. ↑There is one ·special· ·atomic· datatype (anyAtomicType), and a number of ·primitive· ·atomic· datatypes which have anyAtomicType as their ·base type·. All other ·atomic· datatypes are derived either from one of the ·primitive· ·atomic· datatypes or from another ·ordinary· ·atomic· datatype. No ·userdefined· datatype may have anyAtomicType as its ·base type·.↑
Several type systems (such as the one described in [ISO 11404]) treat ·list· datatypes as special cases of the more general notions of aggregate or collection datatypes.
↓·list·↓↑·List·↑ datatypes are always ↓·derived·↓↑·constructed·↑↑ from some other type; they are never ·primitive·↑. The ·value space· of a ·list· datatype is a set of finitelength sequences of ·atomic· values. The ·lexical space· of a ·list· datatype is a set of ·literals· ↓whose internal structure↓↑each of which↑ is a spaceseparated sequence of ·literals· of the ↓·atomic· datatype of the items in the ·list·↓↑·item type·↑.
[Definition:] The ·atomic· or ·union· datatype that participates in the definition of a ·list· datatype is ↓known as ↓the ↓itemType↓↑item type↑ of that ·list· datatype.↑ If the ·item type· is a ·union·, each of its ·basic members· must be ·atomic·.↑
<simpleType name='sizes'> <list itemType='decimal'/> </simpleType>
<cerealSizes xsi:type='sizes'> 8 10.5 12 </cerealSizes>
A ·list· datatype can be ↓·derived·↓↑·constructed·↑ from an ↑ordinary ↑↑or ·primitive· ↑·atomic· datatype whose ·lexical space· allows space (such as string or anyURI) or a ·union· datatype any of whose {member type definitions}'s ·lexical space· allows space. ↓In such a case, regardless of the input, list items will be separated at space boundaries.↓↑Since ·list· items are separated at whitespace before the ·lexical representations· of the items are mapped to values, no whitespace will ever occur in the ·lexical representation· of a ·list· item, even when the item type would in principle allow it. For the same reason, when every possible ·lexical representation· of a given value in the ·value space· of the ·item type· includes whitespace, that value can never occur as an item in any value of the ·list· datatype.↑
<simpleType name='listOfString'> <list itemType='string'/> </simpleType>
<someElement xsi:type='listOfString'> this is not list item 1 this is not list item 2 this is not list item 3 </someElement>
When a datatype is derived ↓from↓↑by ·restricting·↑ a ·list· datatype, the following ·constraining facets· apply:
For each of ·length·, ·maxLength· and ·minLength·, the ↓unit of ↓length is measured in number of list items. The value of ·whiteSpace· is fixed to the value collapse.
For ·list· datatypes the ·lexical space· is composed of spaceseparated ·literals· of ↓its↓↑the↑ ·item type·. ↓Hence, a↓↑A↑ny ·pattern· specified when a new datatype is derived from a ·list· datatype ↓is matched against each literal of the ·list· datatype and not against the literals of the datatype that serves as its ·item type·↓↑applies to the members of the ·list· datatype's ·lexical space·, not to the members of the ·lexical space· of the ·item type·.↑
<xs:simpleType name='myList'> <xs:list itemType='xs:integer'/> </xs:simpleType> <xs:simpleType name='myRestrictedList'> <xs:restriction base='myList'> <xs:pattern value='123 (\d+\s)*456'/> </xs:restriction> </xs:simpleType> <someElement xsi:type='myRestrictedList'>123 456</someElement> <someElement xsi:type='myRestrictedList'>123 987 456</someElement> <someElement xsi:type='myRestrictedList'>123 987 567 456</someElement>
The canonicallexicalrepresentation for the ·list· datatype is defined as the lexical form in which each item in the ·list· has the canonical lexical representation of its ·item type·.
The ·canonical mapping· of a ·list· datatype maps each value onto the spaceseparated concatenation of the ·canonical representations· of all the items in the value (in order), using the ·canonical mapping· of the ·item type·.
↓The ·value space· and ·lexical space· of a ·union· datatype are the union of the ·value spaces· and ·lexical spaces· of its ·member types·.↓ ↑Union types may be defined in either of two ways. When a union type is ·constructed· by ·union·, its ·value space·, ·lexical space·, and ·lexical mapping· are the "ordered unions" of the ·value spaces·, ·lexical spaces·, and ·lexical mappings· of its ·member types·. When a union type is defined by ·restricting· another ·union·, its ·value space·, ·lexical space·, and ·lexical mapping· are subsets of the ·value spaces·, ·lexical spaces·, and ·lexical mappings· of its ·base type·.↑ ·Union· datatypes are always ↓·derived·↓↑·constructed·↑↑ from other datatypes; they are never ·primitive·↑. Currently, there are no ·builtin· ·union· datatypes.
<attributeGroup name="occurs"> <attribute name="minOccurs" type="nonNegativeInteger" use="optional" default="1"/> <attribute name="maxOccurs"use="optional" default="1"> <simpleType> <union> <simpleType> <restriction base='nonNegativeInteger'/> </simpleType> <simpleType> <restriction base='string'> <enumeration value='unbounded'/> </restriction> </simpleType> </union> </simpleType> </attribute> </attributeGroup>
Any number (greater than ↓1↓↑0↑) of ↑ordinary ↑↑ or ·primitive· ↑↓·atomic· or ·list·↓ ↓·datatype·s ↓↑·datatypes·↑ can participate in a ·union· type.
[Definition:] The datatypes that participate in the definition of a ·union· datatype are known as the ↓memberTypes↓↑member types↑ of that ·union· datatype.
[Definition:] The transitive membership of a ·union· is the set of its own ·member types·, and the ·member types· of its members, and so on. More formally, if U is a ·union·, then (a) its ·member types· are in the transitive membership of U, and (b) for any datatypes T1 and T2, if T1 is in the transitive membership of U and T2 is one of the ·member types· of T1, then T2 is also in the transitive membership of U.
[Definition:] Those members of the ·transitive membership· of a ·union· datatype U which are themselves not ·union· datatypes are the basic members of U.
[Definition:] If a datatype M is in the ·transitive membership· of a ·union· datatype U, but not one of U's ·member types·, then a sequence of one or more ·union· datatypes necessarily exists, such that the first is one of the ·member types· if U, each is one of the ·member types· of its predecessor in the sequence, and M is one of the ·member types· of the last in the sequence. The ·union· datatypes in this sequence are said to intervene between M and U. When U and M are given by the context, the datatypes in the sequence are referred to as the intervening unions. When M is one of the ·member types· of U, the set of intervening unions is the empty set.
[Definition:] In a valid instance of any ·union·, the first of its members in order which accepts the instance as valid is the active member type. [Definition:] If the ·active member type· is itself a ·union·, one of its members will be its ·active member type·, and so on, until finally a ·basic (nonunion) member· is reached. That ·basic member· is the active basic member of the union.
The order in which the ·member types· are specified in the
definition (that is, ↑in the case of
datatypes defined in a schema document, ↑the order of the
<simpleType> children of the <union>
element, or the order of the QNames in the
↓memberTypes
↓↑memberTypes
↑ attribute) is significant.
During validation, an element or attribute's value is validated against the
·member types· in the order in which they appear in the
definition until a match is found. The evaluation order can be overridden
with the use of xsi:type.
<xsd:element name='size'> <xsd:simpleType> <xsd:union> <xsd:simpleType> <xsd:restriction base='integer'/> </xsd:simpleType> <xsd:simpleType> <xsd:restriction base='string'/> </xsd:simpleType> </xsd:union> </xsd:simpleType> </xsd:element>
<size>1</size> <size>large</size> <size xsi:type='xsd:string'>1</size>
The canonicallexicalrepresentation for a ·union· datatype is defined as the lexical form in which the values have the canonical lexical representation of the appropriate ·member types·.
The ·canonical mapping· of a ·union· datatype maps each value onto the ·canonical representation· of that value obtained using the ·canonical mapping· of the first ·member type· in whose value space it lies.
Next, we distinguish between ·primitive· and derived datatypes.
Next, we distinguish ·special·, ·primitive·, and ·ordinary· (or ·constructed·) datatypes.
For example, in this specification, float is a ↑·primitive· datatype based on a ↑welldefined mathematical concept ↓that cannot be↓↑and not↑ defined in terms of other datatypes, while↓ a↓ integer is ↓a special case of↓↑·constructed· from↑ the more general datatype decimal.
[Definition:] The simple urtype definition is a special restriction of the urtype definition whose name is anySimpleType in the XML Schema namespace. anySimpleType can be considered as the ·base type· of all ·primitive· datatypes. anySimpleType is considered to have an unconstrained lexical space and a ·value space· consisting of the union of the ·value spaces· of all the ·primitive· datatypes and the set of all lists of all members of the ·value spaces· of all the ·primitive· datatypes.
The datatypes defined by this specification fall into ↓both ↓ the ↑categories ·special·,↑ ·primitive·↑,↑ and ↓·derived·↓↓ categories↓↑·ordinary·↑. It is felt that a judiciously chosen set of ·primitive· datatypes will serve ↓the widest possible↓↑a wide↑ audience by providing a set of convenient datatypes that can be used as is, as well as providing a rich enough base from which ↓the↓↑a large↑ variety of datatypes needed by schema designers can be ↓·derived·↓↑·constructed·↑.
As described in more detail in XML Representation of Simple Type Definition Schema Components (§4.1.2), each ·userderived· datatype ·must· be defined in terms of another datatype in one of three ways: 1) by assigning ·constraining facets· which serve to restrict the ·value space· of the ·userderived· datatype to a subset of that of the ·base type·; 2) by creating a ·list· datatype whose ·value space· consists of finitelength sequences of values of its ·item type·; or 3) by creating a ·union· datatype whose ·value space· consists of the union of the ·value spaces· of its ·member types·.
[Definition:] A datatype is said to be derived by restriction from another datatype when values for zero or more ·constraining facets· are specified that serve to constrain its ·value space· and/or its ·lexical space· to a subset of those of its ·base type·.
[Definition:] A datatype is defined by facetbased restriction of another datatype (its ·base type·), when values for zero or more ·constraining facets· are specified that serve to constrain its ·value space· and/or its ·lexical space· to a subset of those of the ·base type·. The ·base type· of a ·facetbased restriction· must be a ·primitive· or ·ordinary· datatype.
[Definition:] Every datatype that is derived by ·restriction· is defined in terms of an existing datatype, referred to as its base type. Base types can be either ·primitive· or derived.
A ·list· datatype can be ↓·derived·↓↑·constructed·↑ from another datatype (its ·item type·) by creating a ·value space· that consists of a finitelength sequence of values of its ·item type·. ↑Datatypes so ·constructed· have anySimpleType as their ·base type·. Note that since the ·value space· and ·lexical space· of any ·list· datatype are necessarily subsets of the ·value space· and ·lexical space· of anySimpleType, any datatype ·constructed· as a ·list· is a ·restriction· of its base type. ↑
One datatype can be ↓·derived·↓↑·constructed·↑ from one or more datatypes by ↓·union·ing↓↑unioning↑ their ↓·value spaces·↓↑·lexical mappings·↑ and, consequently, their ↑·value spaces· and↑ ↓·lexical spaces·↓↑·lexical spaces·↑. ↑Datatypes so ·constructed· also have anySimpleType as their ·base type·. Note that since the ·value space· and ·lexical space· of any ·union· datatype are necessarily subsets of the ·value space· and ·lexical space· of anySimpleType, any datatype ·constructed· as a ·union· is a ·restriction· of its base type. ↑
By 'definition' is meant the explicit identification of the relevant properties of a datatype, in particular its ·value space·, ·lexical space·, and ·lexical mapping·.
The properties of the ·special· and ·primitive· datatypes are defined by this specification. A Simple Type Definition is present for each of these datatypes in every valid schema; it serves as a representation of the datatype, but by itself it does not capture all the relevant information and does not suffice (without knowledge of this specification) to define the datatype.
For all other datatypes, a Simple Type Definition does suffice. The properties of an ·ordinary· datatype can be inferred from the datatype's Simple Type Definition and the properties of the ·base type·, ·item type· if any, and ·member types· if any. All ·ordinary· datatypes can be defined in this way.
By 'derivation' is meant the relation of a datatype to its ·base type·, or to the ·base type· of its ·base type·, and so on.
[Definition:] Every datatype is associated with another datatype, its base type. Base types can be ·special·, ·primitive·, or ·ordinary·.
[Definition:] A datatype T is immediately derived from another datatype X if and only if X is the ·base type· of T.
More generally, [Definition:] A datatype R is derived from another datatype B if and only if one of the following is true:
It is a consequence of these definitions that every datatype other than anySimpleType is derived from anySimpleType.
Since each datatype has exactly one ·base type·, and every datatype is derived directly or indirectly from anySimpleType, it follows that the ·base type· relation arranges all simple types into a tree structure, which is conventionally referred to as the derivation hierarchy.
By 'restriction' is meant the definition of a datatype whose ·value space· and ·lexical space· are subsets of those of its ·base type·.
Formally, [Definition:] A datatype R is a restriction of another datatype B when
Note that all three forms of datatype ·construction· produce ·restrictions· of the ·base type·: ·facetbased restriction· does so by means of ·constraining facets·, while ·construction· by ·list· or ·union· does so because those ·constructions· take anySimpleType as the ·base type·. It follows that all datatypes are ·restrictions· of anySimpleType. This specification provides no means by which a datatype may be defined so as to have a larger ·lexical space· or ·value space· than its ·base type·.
By 'construction' is meant the creation of a datatype by defining it in terms of another.
[Definition:] All ·ordinary· datatypes are defined in terms of, or constructed from, other datatypes, either by ·restricting· the ·value space· or ·lexical space· of a ·base type· using zero or more ·constraining facets· or by specifying the new datatype as a ·list· of items of some ·item type·, or by defining it as a ·union· of some specified sequence of ·member types·. These three forms of ·construction· are often called "·facetbased restriction·", "·construction· by ·list·", and "·construction· by ·union·", respectively. Datatypes so constructed may be understood fully (for purposes of a type system) in terms of (a) the properties of the datatype(s) from which they are constructed, and (b) their Simple Type Definition. This distinguishes ·ordinary· datatypes from the ·special· and ·primitive· datatypes, which can be understood only in the light of documentation (namely, their descriptions elsewhere in this specification). All ·ordinary· datatypes are ·constructed·, and all ·constructed· datatypes are ·ordinary·.
Conceptually there is no difference between the ↑·ordinary·↑ ·builtin· ↓·derived·↓ datatypes included in this specification and the ↓·userderived·↓↑·userdefined·↑ datatypes which will be created by individual schema designers. The ·builtin· ↓·derived·↓↑·constructed·↑ datatypes are those which are believed to be so common that if they were not defined in this specification many schema designers would end up ↓"reinventing"↓↑reinventing↑ them. Furthermore, including these ↓·derived·↓↑·constructed·↑ datatypes in this specification serves to demonstrate the mechanics and utility of the datatype generation facilities of this specification.
Each builtin datatype in this specification ↓(both ·primitive· and derived)↓ can be uniquely addressed via a URI Reference constructed as follows:
For example, to address the int datatype, the URI is:
http://www.w3.org/2001/XMLSchema#int
Additionally, each facet definition element can be uniquely addressed via a URI constructed as follows:
For example, to address the maxInclusive facet, the URI is:
http://www.w3.org/2001/XMLSchema#maxInclusive
Additionally, each facet usage in a builtin ↓datatype definition↓ ↑Simple Type Definition↑ can be uniquely addressed via a URI constructed as follows:
.
') followed by the name of the facet
For example, to address the usage of the maxInclusive facet in the definition of int, the URI is:
http://www.w3.org/2001/XMLSchema#int.maxInclusive
The ·builtin· datatypes defined by this specification are designed to be used with the XML Schema definition language as well as other XML specifications. To facilitate usage within the XML Schema definition language, the ·builtin· datatypes in this specification have the namespace name:
To facilitate usage in specifications other than the XML Schema definition language, such as those that do not want to know anything about aspects of the XML Schema definition language other than the datatypes, each ↑non·special·↑ ·builtin· datatype is also defined in the namespace whose URI is:
This applies to both ·builtin· ·primitive· and ·builtin· derived datatypes.
XMLSchemadatatypes
namespace and the definitions therein are deprecated as of
XML Schema 1.1.Each ↓·userderived·↓↑·userdefined·↑ datatype is also associated with a unique namespace. However, ↓·userderived·↓↑·userdefined·↑ datatypes do not come from the namespace defined by this specification; rather, they come from the namespace of the schema in which they are defined (see XML Representation of Schemas in [XML Schema Part 1: Structures]).
The two datatypes at the root of the hierarchy of simple types are anySimpleType and anyAtomicType.
[Definition:] The definition of anySimpleType is a special ·restriction· of anyType. anySimpleType has an unconstrained ·lexical space·, a ·value space· consisting of the union of the ·value spaces· of all the ·primitive· datatypes and the set of all lists of all members of the ·value spaces· of all the ·primitive· datatypes.
For further details of anySimpleType and its representation as a Simple Type Definition, see Builtin Simple Type Definitions (§4.1.7).
The ·value space· of anySimpleType is the union of the ·value spaces· of all the ·primitive· datatypes defined here, and of all sets of lists formed from the members of the ·primitive· datatypes.
The ·lexical space· of anySimpleType is the set of all finitelength sequences of characters (as defined in [XML]) that ·match· the Char production from [XML]. This is equivalent to the union of the ·lexical spaces· of all ·primitive· and all possible ·ordinary· datatypes.
It is implementationdefined whether an implementation of this specification supports the Char production from [XML], or that from [XML 1.0], or both. See Dependencies on Other Specifications (§1.3).
The ·lexical mapping· of anySimpleType is the union
of the ·lexical mappings· of
all ·primitive· datatypes and all list datatypes.
It will be noted that this mapping is not a function: a given
·literal· may map to one value or to several values of different
·primitive· datatypes, and it may be indeterminate which value is to
be preferred in a particular context. When the datatypes defined here
are used in the context of [XML Schema Part 1: Structures], the
xsi:type
attribute defined by that specification in section
xsi:type can be used
to indicate which value a ·literal· which is the content of an element
should map to. In other contexts, other rules (such as type coercion
rules) may be employed to determine which value is to be used.
When a new datatype is defined by ·facetbased restriction·, anySimpleType must not be used as the ·base type·. So no ·constraining facets· are directly applicable to anySimpleType.
[Definition:] anyAtomicType is a special ·restriction· of anySimpleType. The ·value· and ·lexical spaces· of anyAtomicType are the unions of the ·value· and ·lexical spaces· of all the ·primitive· datatypes, and anyAtomicType is their ·base type·.
For further details of anyAtomicType and its representation as a Simple Type Definition, see Builtin Simple Type Definitions (§4.1.7).
The ·value space· of anyAtomicType is the union of the ·value spaces· of all the ·primitive· datatypes defined here.
The ·lexical space· of anyAtomicType is the set of all finitelength sequences of characters (as defined in [XML]) that ·match· the Char production from [XML]. This is equivalent to the union of the ·lexical spaces· of all ·primitive· datatypes.
It is implementationdefined whether an implementation of this specification supports the Char production from [XML], or that from [XML 1.0], or both. See Dependencies on Other Specifications (§1.3).
The ·lexical mapping· of anyAtomicType is the union
of the ·lexical mappings· of
all ·primitive· datatypes.
It will be noted that this mapping is not a function: a given
·literal· may map to one value or to several values of different
·primitive· datatypes, and it may be indeterminate which value is to
be preferred in a particular context. When the datatypes defined here
are used in the context of [XML Schema Part 1: Structures], the
xsi:type
attribute defined by that specification in section
xsi:type can be used
to indicate which value a ·literal· which is the content of an element
should map to. In other contexts, other rules (such as type coercion
rules) may be employed to determine which value is to be used.
When a new datatype is defined by ·facetbased restriction·, anyAtomicType must not be used as the ·base type·. So no ·constraining facets· are directly applicable to anyAtomicType.
The ·primitive· datatypes defined by this specification are described below. For each datatype, the ·value space· ↑is described; ↑↓and ↓↑the ↑·lexical space· ↓are↓↑is↑ defined↓,↓ ↑using an extended Backus Naur Format grammar (and in most cases also a regular expression using the regular expression language of Regular Expressions (§I));↑ ·constraining facets· which apply to the datatype are listed↑;↑ and any datatypes ↓·derived·↓↑·constructed·↑ from this datatype are specified.
↓·primitive·↓↑·Primitive·↑ datatypes can only be added by revisions to this specification.
[Definition:] The string datatype represents character strings in XML.↓ The ·value space· of string is the set of finitelength sequences of characters (as defined in [XML]) that ·match· the Char production from [XML]. A character is an atomic unit of communication; it is not further specified except to note that every character has a corresponding Universal Character Set code point, which is an integer.↓
The ·value space· of string is the set of finitelength sequences of characters (as defined in [XML]) that ·match· the Char production from [XML]. A character is an atomic unit of communication; it is not further specified except to note that every character has a corresponding Universal Character Set (UCS) code point, which is an integer.
It is implementationdefined whether an implementation of this specification supports the Char production from [XML], or that from [XML 1.0], or both. See Dependencies on Other Specifications (§1.3).
Equality for string is identity. No order is prescribed.
The ·lexical space· of string is the set of finitelength sequences of characters (as defined in [XML]) that ·match· the Char production from [XML].
It is implementationdefined whether an implementation of this specification supports the Char production from [XML], or that from [XML 1.0], or both. See Dependencies on Other Specifications (§1.3).
The ·lexical mapping· for string is ·stringLexicalMap·, and the ·canonical mapping· is ·stringCanonicalMap·; each is a subset of the identity function.
↓string has the following ·constraining facets·:↓
↑string has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
preserve
↑↑Datatypes derived by restriction from string↑ may also specify values for the following↑ ·constraining facets·:↑
string has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from string:
[Definition:] boolean ↓has the ·value space· required to support the mathematical concept of binaryvalued logic: {true, false}↓↑represents the values of twovalued logic↑.
boolean has the ·value space· of twovalued logic: {true, false}.
An instance of a datatype that is defined as ·boolean· can have the following legal literals {true, false, 1, 0}.
The ·canonical representation· for boolean is the set of literals {true, false}.
boolean's lexical space is a set of four ·literals·:
The ·lexical mapping· for boolean is ·booleanLexicalMap·; the ·canonical mapping· is ·booleanCanonicalMap·.
↓boolean has the following ·constraining facets·:↓
↑boolean and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from boolean↑ may also specify values for the following↑ ·constraining facets·:↑
boolean has the following values for its ·fundamental facets·:
[Definition:] decimal represents a subset of the real numbers, which can be represented by decimal numerals. The ·value space· of decimal is the set of numbers that can be obtained by ↓multiplying↓↑dividing↑ an integer by a non↓positive↓↑negative↑ power of ten, i.e., expressible as ↓i × 10^n↓↑i / 10^{n}↑ where i and n are integers and ↓n >= 0↓↑n ≥ 0↑. Precision is not reflected in this value space; the number 2.0 is not distinct from the number 2.00. ↑(The datatype precisionDecimal may be used for values in which precision is significant.)↑ The ↓·orderrelation·↓↑order relation↑ on decimal is the order relation on real numbers, restricted to this subset.
The lexical space of decimal is the set of
lexical representations which match the grammar given above, or
(equivalently) the regular expression
'
?(([09]+(.[09]*)?)(.[09]+))
'.
The mapping from lexical representations to values is the usual one for decimal numerals; it is given formally in:
The mapping from lexical representations to values is the usual one for decimal numerals; it is given formally in ·decimalLexicalMap·.
The mapping from values to ·canonical representations· is given formally in ·decimalCanonicalMap·.
The ·canonical representation· for decimal is defined by prohibiting certain options from the Lexical ↓representation↓↑Mapping↑ (§3.3.3.1). Specifically, the preceding optional "+" sign is prohibited. The decimal point is required. Leading and trailing zeroes are prohibited subject to the following: there must be at least one digit to the right and to the left of the decimal point which may be a zero.
The mapping from values to ·canonical representations· is given formally in ·decimalCanonicalMap·.
↓decimal has the following ·constraining facets·:↓
↑decimal and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from decimal↑ may also specify values for the following↑ ·constraining facets·:↑
decimal has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from decimal:
[Definition:] The precisionDecimal datatype represents the numeric value and (arithmetic) precision of decimal numbers which retain precision; it also includes special values for positive and negative infinity and "not a number", and it differentiates between "positive zero" and "negative zero". This datatype is introduced to provide a variant of decimal that closely corresponds to the floatingpoint decimal datatypes described by the expected forthcoming revision of IEEE/ANSI 754. Precision of values is retained, and the special values (two zeroes, infinities, and notanumber) are included.
Precision is sometimes given in absolute, sometimes in relative terms. [Definition:] The arithmetic precision of a value is expressed in absolute quantitative terms, by indicating how many digits to the right of the decimal point are significant. "5" has an arithmetic precision of 0, and "5.01" an arithmetic precision of 2.
NaN
'. Accordingly, in English text we
use 'NaN' to refer to that value. Similarly we use 'INF'
and '−INF' to refer to the two value objects whose ·numericalValue·
is positiveInfinity and negativeInfinity. These three value objects
are also informally called "notanumber", "positive infinity",
and "negative infinity".
The latter two together are called
"the infinities".Equality and order for precisionDecimal are defined as follows:
precisionDecimal's lexical space is the set of all
decimal numerals with or without a decimal
point, numerals in scientific (exponential) notation, and
the character strings 'INF
',
'+INF
', 'INF
',
and 'NaN
'.
The ·lexical mapping· for precisionDecimal is ·precisionDecimalLexicalMap·. The ·canonical mapping· is ·precisionDecimalCanonicalMap·.
↓precisionDecimal has the following ·constraining facets·:↓
↑precisionDecimal and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from precisionDecimal↑ may also specify values for the following↑ ·constraining facets·:↑
precisionDecimal has the following values for its ·fundamental facets·:
[Definition:] ↑The ↑float↑ datatype↑ is↓ patterned after↓ the IEEE singleprecision 32bit floating point ↑data↑type [IEEE 7541985]↑ with the minor exception noted below↑.↓ The basic ·value space· of float consists of the values m × 2^e, where m is an integer whose absolute value is less than 2^24, and e is an integer between 149 and 104, inclusive. In addition to the basic ·value space· described above, the ·value space· of float also contains the following three special values: positive and negative infinity and notanumber (NaN). The ·orderrelation· on float is: x < y iff y  x is positive for x and y in the value space. Positive infinity is greater than all other nonNaN values. NaN equals itself but is incomparable with (neither greater than nor less than) any other value in the ·value space·. ↓↑ Floating point numbers are certain subsets of the rational numbers, and are often used to approximate arbitrary real numbers.↑
Any value incomparable with the value used for the four bounding facets (·minInclusive·, ·maxInclusive·, ·minExclusive·, and ·maxExclusive·) will be excluded from the resulting restricted ·value space·. In particular, when "NaN" is used as a facet value for a bounding facet, since no other float values are ·comparable· with it, the result is a ·value space· either having NaN as its only member (the inclusive cases) or that is empty (the exclusive cases). If any other value is used for a bounding facet, NaN will be excluded from the resulting restricted ·value space·; to add NaN back in requires union with the NaNonly space.
This datatype differs from that of [IEEE 7541985] in that there is only one NaN and only one zero. This makes the equality and ordering of values in the data space differ from that of [IEEE 7541985] only in that for schema purposes NaN = NaN.
A ·literal· in the ·lexical space· representing a decimal number d maps to the normalized value in the ·value space· of float that is closest to d in the sense defined by [Clinger, WD (1990)]; if d is exactly halfway between two such values then the even value is chosen.
The ·value space· of float contains the nonzero numbers m × 2^{e} , where m is an integer whose absolute value is less than 2^{24}, and e is an integer between −149 and 104, inclusive. In addition to these values, the ·value space· of float also contains the following special values: positiveZero, negativeZero, positiveInfinity, negativeInfinity, and notANumber.
NaN
'. Accordingly, in English
text we generally use 'NaN' to refer to that value. Similarly,
we use 'INF' and '−INF' to refer to the two
values positiveInfinity and negativeInfinity,
and '0' and '−0' to refer to
positiveZero and negativeZero.Equality and order for float are defined as follows:
0 and −0 are thus distinct for purposes of enumerations and identity constraints, but equal for purposes of minimum and maximum values.
float values have a lexical representation
consisting of a mantissa followed, optionally, by the character
'E
' or 'e
',
followed by an exponent. The exponent ·must·
be an integer. The mantissa must be a
decimal number. The representations
for exponent and mantissa must follow the lexical rules for
integer and decimal. If the
'E
' or 'e
' and
the following exponent are omitted, an exponent value of 0 is assumed.
The special values
positive
and negative infinity and notanumber have lexical representations
INF
, INF
and
NaN
, respectively.
Lexical representations for zero may take a positive or negative sign.
For example, 1E4, 1267.43233E12, 12.78e2, 12
, 0, 0
and INF
are all legal ·literals· for float.
The ·canonical representation· for float is defined by prohibiting certain options from the Lexical representation (§3.3.5.2). Specifically, the exponent must be indicated by "E". Leading zeroes and the preceding optional "+" sign are prohibited in the exponent. If the exponent is zero, it must be indicated by "E0". For the mantissa, the preceding optional "+" sign is prohibited and the decimal point is required. Leading and trailing zeroes are prohibited subject to the following: number representations must be normalized such that there is a single digit which is nonzero to the left of the decimal point and at least a single digit to the right of the decimal point unless the value being represented is zero. The ·canonical representation· for zero is 0.0E0.
The ·lexical space· of float is
the set of all decimal numerals with or without a decimal
point, numerals in scientific (exponential) notation, and
the ·literals· 'INF
',
'INF
', and 'NaN
'
The floatRep production is equivalent to this regular expression:
(+)?(([09]+(.[09]*)?)(.[09]+))((eE)(+)?[09]+)??INFNaN
The float datatype is designed to implement for schema processing the singleprecision floatingpoint datatype of [IEEE 7541985]. That specification does not specify specific ·lexical representations·, but does prescribe requirements on any ·lexical mapping· used. Any ·lexical mapping· that maps the ·lexical space· just described onto the ·value space·, satisfies the requirements of [IEEE 7541985], and correctly handles the special values (numericalSpecialRep ·literals·), satisfies the conformance requirements of this specification.
Since IEEE allows some variation in rounding of values, processors conforming to this specification may exhibit some variation in their ·lexical mappings·.
The ·lexical mapping· ·floatLexicalMap· is provided as an example of a simple algorithm that yields a conformant mapping, and that provides the most accurate rounding possible—and is thus useful for insuring interimplementation reproducibility and interimplementation roundtripping. The simple rounding algorithm used in ·floatLexicalMap· may be more efficiently implemented using the algorithms of [Clinger, WD (1990)].
The ·canonical mapping· ·floatCanonicalMap· is provided as an example of a mapping that does not produce unnecessarily long ·canonical representations·. Other algorithms which do not yield identical results for mapping from float values to character strings are permitted by [IEEE 7541985].
↓float has the following ·constraining facets·:↓
↑float and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from float↑ may also specify values for the following↑ ·constraining facets·:↑
float has the following values for its ·fundamental facets·:
[Definition:] The double datatype is↓ patterned after↓ the IEEE doubleprecision 64bit floating point ↑data↑type [IEEE 7541985]↑ with the minor exception noted below↑.↓ The basic ·value space· of double consists of the values m × 2^e, where m is an integer whose absolute value is less than 2^{53}, and e is an integer between 1075 and 970, inclusive. In addition to the basic ·value space· described above, the ·value space· of double also contains the following three special values: positive and negative infinity and notanumber (NaN). The ·orderrelation· on double is: x < y iff y  x is positive for x and y in the value space. Positive infinity is greater than all other nonNaN values. NaN equals itself but is incomparable with (neither greater than nor less than) any other value in the ·value space·. ↓↑ Floating point numbers are certain subsets of the rational numbers, and are often used to approximate arbitrary real numbers.↑
Any value incomparable with the value used for the four bounding facets (·minInclusive·, ·maxInclusive·, ·minExclusive·, and ·maxExclusive·) will be excluded from the resulting restricted ·value space·. In particular, when "NaN" is used as a facet value for a bounding facet, since no other double values are ·comparable· with it, the result is a ·value space· either having NaN as its only member (the inclusive cases) or that is empty (the exclusive cases). If any other value is used for a bounding facet, NaN will be excluded from the resulting restricted ·value space·; to add NaN back in requires union with the NaNonly space.
This datatype differs from that of [IEEE 7541985] in that there is only one NaN and only one zero. This makes the equality and ordering of values in the data space differ from that of [IEEE 7541985] only in that for schema purposes NaN = NaN.
A ·literal· in the ·lexical space· representing a decimal number d maps to the normalized value in the ·value space· of double that is closest to d; if d is exactly halfway between two such values then the even value is chosen. This is the best approximation of d ([Clinger, WD (1990)], [Gay, DM (1990)]), which is more accurate than the mapping required by [IEEE 7541985].
The ·value space· of double contains the nonzero numbers m × 2^{e} , where m is an integer whose absolute value is less than 2^{53}, and e is an integer between −1074 and 971, inclusive. In addition to these values, the ·value space· of double also contains the following special values: positiveZero, negativeZero, positiveInfinity, negativeInfinity, and notANumber.
NaN
'. Accordingly, in English
text we generally use 'NaN' to refer to that value. Similarly,
we use 'INF' and '−INF' to refer to the two
values positiveInfinity and negativeInfinity,
and '0' and '−0' to refer to
positiveZero and negativeZero.Equality and order for double are defined as follows:
0 and −0 are thus distinct for purposes of enumerations and identity constraints, but equal for purposes of minimum and maximum values.
double values have a lexical representation
consisting of a mantissa followed, optionally, by the character "E" or
"e", followed by an exponent. The exponent ·must· be
an integer. The mantissa must be
a decimal number. The representations
for exponent and mantissa must follow the lexical rules for
integer and
decimal. If the 'E
' or 'e
' and
the following exponent are omitted, an exponent value of 0 is assumed.
The special values
positive
and negative infinity and notanumber have lexical representations
INF
, INF
and
NaN
, respectively.
Lexical representations for zero may take a positive or negative sign.
For example, 1E4, 1267.43233E12, 12.78e2, 12
, 0, 0
and INF
are all legal ·literals· for double.
The ·canonical representation· for double is defined by prohibiting certain options from the Lexical representation (§3.3.6.2). Specifically, the exponent must be indicated by "E". Leading zeroes and the preceding optional "+" sign are prohibited in the exponent. If the exponent is zero, it must be indicated by "E0". For the mantissa, the preceding optional "+" sign is prohibited and the decimal point is required. Leading and trailing zeroes are prohibited subject to the following: number representations must be normalized such that there is a single digit which is nonzero to the left of the decimal point and at least a single digit to the right of the decimal point unless the value being represented is zero. The ·canonical representation· for zero is 0.0E0.
The ·lexical space· of double is
the set of all decimal numerals with or without a decimal
point, numerals in scientific (exponential) notation, and
the ·literals· 'INF
',
'INF
', and 'NaN
'
The doubleRep production is equivalent to this regular expression:
(+)?(([09]+(.[09]*)?)(.[09]+))((eE)(+)?[09]+)??INFNaN
The double datatype is designed to implement for schema processing the doubleprecision floatingpoint datatype of [IEEE 7541985]. That specification does not specify specific ·lexical representations·, but does prescribe requirements on any ·lexical mapping· used. Any ·lexical mapping· that maps the ·lexical space· just described onto the ·value space·, satisfies the requirements of [IEEE 7541985], and correctly handles the special values (numericalSpecialRep ·literals·), satisfies the conformance requirements of this specification.
Since IEEE allows some variation in rounding of values, processors conforming to this specification may exhibit some variation in their ·lexical mappings·.
The ·lexical mapping· ·doubleLexicalMap· is provided as an example of a simple algorithm that yields a conformant mapping, and that provides the most accurate rounding possible—and is thus useful for insuring interimplementation reproducibility and interimplementation roundtripping. The simple rounding algorithm used in ·doubleLexicalMap· may be more efficiently implemented using the algorithms of [Clinger, WD (1990)].
The ·canonical mapping· ·doubleCanonicalMap· is provided as an example of a mapping that does not produce unnecessarily long ·canonical representations·. Other algorithms which do not yield identical results for mapping from float values to character strings are permitted by [IEEE 7541985].
↓double has the following ·constraining facets·:↓
↑double and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from double↑ may also specify values for the following↑ ·constraining facets·:↑
double has the following values for its ·fundamental facets·:
[Definition:] duration represents a duration of time. The ·value space· of duration is a sixdimensional space where the coordinates designate the Gregorian year, month, day, hour, minute, and second components defined in § 5.5.3.2 of [ISO 8601], respectively. These components are ordered in their significance by their order of appearance i.e. as year, month, day, hour, minute, and second.
Note:
All ·minimally conforming· processors ·must· support year values with a minimum of 4 digits (i.e.,YYYY
) and a minimum fractional second precision of
milliseconds or three decimal digits (i.e. s.sss
).
However, ·minimally conforming· processors
·may· set an applicationdefined limit on the maximum number
of digits they are prepared to support in these two cases, in which
case that applicationdefined maximum number ·must·
be clearly documented.
[Definition:] duration
is a datatype that represents
durations of time. The concept of duration being captured is
drawn from those of [ISO 8601], specifically
durations without fixed endpoints. For example,
"15 days" (whose most common lexical representation
in duration is "'P15D
'") is
a duration value; "15 days beginning 12 July
1995" and "15 days ending 12 July 1995" are
not. duration can provide addition and
subtraction operations between duration values and
between duration/dateTime value pairs,
and can be the result of subtracting dateTime
values. However, only addition to dateTime
is required for XML Schema processing and is
defined in
the function ·dateTimePlusDuration·.
Duration values can be modelled as twoproperty tuples. Each value consists of an integer number of months and a decimal number of seconds. The ·seconds· value must not be negative if the ·months· value is positive and must not be positive if the ·months· is negative.
duration is partially ordered. Equality of duration is defined in terms of equality of dateTime; order for duration is defined in terms of the order of dateTime. Specifically, the equality or order of two duration values is determined by adding each duration in the pair to each of the following four dateTime values:
If all four resulting dateTime value pairs are ordered the same way (less than, equal, or greater than), then the original pair of duration values is ordered the same way; otherwise the original pair is ·incomparable·.
Under the definition just given, two duration values are equal if and only if they are identical.
Note:
Two totally ordered datatypes (yearMonthDuration and dayTimeDuration) are derived from duration in ↓Derived datatypes↓↑Other Builtin Datatypes↑ (§3.4).The lexical representation for duration is the [ISO 8601] extended format PnYn MnDTnH nMnS, where nY represents the number of years, nM the number of months, nD the number of days, 'T' is the date/time separator, nH the number of hours, nM the number of minutes and nS the number of seconds. The number of seconds can include decimal digits to arbitrary precision.
The values of the Year, Month, Day, Hour and Minutes components are not restricted but allow an arbitrary integer. Similarly, the value of the Seconds component allows an arbitrary decimal. Thus, the lexical representation of duration does not follow the alternative format of § 5.5.3.2.1 of [ISO 8601].
An optional preceding minus sign ('') is allowed, to indicate a negative duration. If the sign is omitted a positive duration is indicated. See also ISO 8601 Date and Time Formats (§G).
For example, to indicate a duration of 1 year, 2 months, 3 days, 10
hours, and 30 minutes, one would write: P1Y2M3DT10H30M
.
One could also indicate a duration of minus 120 days as:
P120D
.
Reduced precision and truncated representations of this format are allowed provided they conform to the following:
For example, P1347Y, P1347M and P1Y2MT2H are all allowed; P0Y1347M and P0Y1347M0D are allowed. P1347M is not allowed although P1347M is allowed. P1Y2MT is not allowed.
The ·lexical representations· of duration are more or less based on the pattern:
PnYnMnDTnHnMnS
More precisely, the ·lexical space· of duration is the set of character strings that satisfy durationLexicalRep as defined by the following productions:
Thus, a durationLexicalRep consists of one or more of a duYearFrag,
duMonthFrag, duDayFrag, duHourFrag,
duMinuteFrag, and/or duSecondFrag, in order, with letters
'P
' and 'T
' (and perhaps a '
')
where appropriate.
The language accepted by the durationLexicalRep production is the set of strings which satisfy all of the following three regular expressions:
?P([09]+Y)?([09]+M)?([09]+D)?(T([09]+H)?([09]+M)?((([09]+(.[09]*)?)(.[09]+))S)?)?
' matches only strings in which the fields occur in the proper order..*[YMDHS].*
' matches only
strings in which at least one field occurs..*[^T]
' matches
only strings in which 'T
' is not the final character, so that
if 'T
' appears, something follows it. The first rule
ensures that what follows 'T
' will be an hour,
minute, or second field.The intersection of these three regular expressions is equivalent to the following (after removal of the white space inserted here for legibility):
?P(((([09]+Y([09]+M)?)
( ([09]+M) ) )(([09]+D(T(([09]+H([09]+M)?([09]+(\.[09]+)?S)?)
( ([09]+M) ([09]+(\.[09]+)?S)?)
( ([09]+(\.[09]+)?S) ) ))?)
( (T(([09]+H([09]+M)?([09]+(\.[09]+)?S)?)
( ([09]+M) ([09]+(\.[09]+)?S)?)
( ([09]+(\.[09]+)?S) ) )) ) )?)
( (([09]+D(T(([09]+H([09]+M)?([09]+(\.[09]+)?S)?)
( ([09]+M) ([09]+(\.[09]+)?S)?)
( ([09]+(\.[09]+)?S) ) ))?)
( (T(([09]+H([09]+M)?([09]+(\.[09]+)?S)?)
( ([09]+M) ([09]+(\.[09]+)?S)?)
( ([09]+(\.[09]+)?S) ) )) ) ) ) )
The ·lexical mapping· for duration is ·durationMap·.
·The canonical mapping· for duration is ·durationCanonicalMap·.
In general, the ·orderrelation· on duration is a partial order since there is no determinate relationship between certain durations such as one month (P1M) and 30 days (P30D). The ·orderrelation· of two duration values x and y is x < y iff s+x < s+y for each qualified dateTime s in the list below. These values for s cause the greatest deviations in the addition of dateTimes and durations. Addition of durations to time instants is defined in Adding durations to dateTimes (§H).
The following table shows the strongest relationship that can be determined between example durations. The symbol <> means that the order relation is indeterminate. Note that because of leapseconds, a seconds field can vary from 59 to 60. However, because of the way that addition is defined in Adding durations to dateTimes (§H), they are still totally ordered.
Relation  

P1Y  > P364D  <> P365D  <> P366D  < P367D  
P1M  > P27D  <> P28D  <> P29D  <> P30D  <> P31D  < P32D  
P5M  > P149D  <> P150D  <> P151D  <> P152D  <> P153D  < P154D 
Implementations are free to optimize the computation of the ordering relationship. For example, the following table can be used to compare durations of a small number of months against days.
Months  1  2  3  4  5  6  7  8  9  10  11  12  13  ...  

Days  Minimum  28  59  89  120  150  181  212  242  273  303  334  365  393  ... 
Maximum  31  62  92  123  153  184  215  245  276  306  337  366  397  ... 
In comparing duration values with minInclusive, minExclusive, maxInclusive and maxExclusive facet values, indeterminate comparisons should be considered as "false".
For example, a datatype could be defined to correspond to the [SQL] datatype YearMonth interval that required a four digit year field and a two digit month field but required all other fields to be unspecified. This datatype could be defined as below and would have a total order.
<simpleType name='SQLYearMonthInterval'> <restriction base='duration'> <pattern value='P\p{Nd}{4}Y\p{Nd}{2}M'/> </restriction> </simpleType>
↓duration has the following ·constraining facets·:↓
↑duration and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from duration↑ may also specify values for the following↑ ·constraining facets·:↑
duration has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from duration:
[Definition:] dateTime values may be viewed as objects with integervalued year, month, day, hour and minute properties, a decimalvalued second property, and a boolean timezoned property. Each such object also has one decimalvalued method or computed property, timeOnTimeline, whose value is always a decimal number; the values are dimensioned in seconds, the integer 0 is 00010101T00:00:00 and the value of timeOnTimeline for other dateTime values is computed using the Gregorian algorithm as modified for leapseconds. The timeOnTimeline values form two related "timelines", one for timezoned values and one for nontimezoned values. Each timeline is a copy of the ·value space· of decimal, with integers given units of seconds.
dateTime represents instants of time, optionally marked with a particular timezone. Values representing the same instant but having different timezones are equal but not identical.
The ·value space· of dateTime is closely related to the dates and times described in ISO 8601. For clarity, the text above specifies a particular origin point for the timeline. It should be noted, however, that schema processors need not expose the timeOnTimeline value to schema users, and there is no requirement that a timelinebased implementation use the particular origin described here in its internal representation. Other interpretations of the ·value space· which lead to the same results (i.e., are isomorphic) are of course acceptable.
All timezoned times are Coordinated Universal Time (·UTC·, sometimes called "Greenwich Mean Time"). Other timezones indicated in lexical representations are converted to ·UTC· during conversion of literals to values. "Local" or untimezoned times are presumed to be the time in the timezone of some unspecified locality as prescribed by the appropriate legal authority; currently there are no legally prescribed timezones which are durations whose magnitude is greater than 14 hours. The value of each numericvalued property (other than timeOnTimeline) is limited to the maximum value within the interval determined by the nexthigher property. For example, the day value can never be 32, and cannot even be 29 for month 02 and year 2002 (February 2002).
Note:
The date and time datatypes described in this recommendation were inspired by [ISO 8601]. '0001' is the lexical representation of the year 1 of the Common Era (1 CE, sometimes written "AD 1" or "1 AD"). There is no year 0, and '0000' is not a valid lexical representation. '0001' is the lexical representation of the year 1 Before Common Era (1 BCE, sometimes written "1 BC").Those using this (1.0) version of this Recommendation to
represent negative years should be aware that the interpretation of lexical
representations beginning with a ''
is likely to change in
subsequent versions.
[ISO 8601] makes no mention of the year 0; in [ISO 8601:1998 Draft Revision] the form '0000' was disallowed and this recommendation disallows it as well. However, [ISO 8601:2000 Second Edition], which became available just as we were completing version 1.0, allows the form '0000', representing the year 1 BCE. A number of external commentators have also suggested that '0000' be allowed, as the lexical representation for 1 BCE, which is the normal usage in astronomical contexts. It is the intention of the XML Schema Working Group to allow '0000' as a lexical representation in the dateTime, date, gYear, and gYearMonth datatypes in a subsequent version of this Recommendation. '0000' will be the lexical representation of 1 BCE (which is a leap year), '0001' will become the lexical representation of 2 BCE (not 1 BCE as in this (1.0) version), '0002' of 3 BCE, etc.
dateTime uses the date/timeSevenPropertyModel, with no properties except ·timezone· permitted to be absent. The ·timezone· property remains ·optional·.
Note that 1 BCE, 5 BCE, and so on (years 0000, 0004, etc. in the lexical representation defined here) are leap years in the proleptic Gregorian calendar used for the date/time datatypes defined here. Version 1.0 of this specification was unclear about the treatment of leap years before the common era; caution should be used if existing schemas or data specify dates of 29 February for any years before the common era. With that possible exception, schemas and data valid under the old interpretation remain valid under the new.
Equality and order are as prescribed in The Sevenproperty Model (§D.2.1). dateTime values are ordered by their ·timeOnTimeline· value.
Although dateTime and other types related to dates and times have only a partial order, it is possible for datatypes derived from dateTime to have total orders, if they are restricted (e.g. using the pattern facet) to the subset of values with, or the subset of values without, timezones. Similar restrictions on other date and timerelated types will similarly produce totally ordered subtypes. Note, however, that such restrictions do not affect the value shown, for a given Simple Type Definition, in the ordered facet.
The ·lexical space· of dateTime consists of
finitelength sequences of characters of the form:
''? yyyy '' mm '' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
,
where
For example, 20021010T12:00:0005:00 (noon on 10 October 2002, Central Daylight Savings Time as well as Eastern Standard Time in the U.S.) is 20021010T17:00:00Z, five hours later than 20021010T12:00:00Z.
For further guidance on arithmetic with dateTimes and durations, see Adding durations to dateTimes (§H).
Except for trailing fractional zero digits in the seconds representation, '24:00:00' time representations, and timezone (for timezoned values), the mapping from literals to values is onetoone. Where there is more than one possible representation, the ·canonical representation· is as follows:
24
';0
';Z
' (All timezoned dateTime values are
·UTC·.).
The lexical representations for dateTime are as follows:

' monthFrag '
' dayFrag 'T
' ((hourFrag ':
' minuteFrag ':
' secondFrag) 
endOfDayFrag) timezoneFrag? Constraint: Dayofmonth Representations
3
' or be '29
'
unless the value to
which it would map would satisfy the value constraint on
·day· values
("Constraint: Dayofmonth Values") given above.In such representations:
0
' digits are prohibited except to bring the
digit count up to four.
It represents the ·year· value.
', 'T
', and
':
', separate the various numerals.Z
' is an alternative representation of the timezone of
UTC, which is, of course, zero minutes from UTC.For example, 20021010T12:00:00−05:00 (noon on 10 October 2002, Central Daylight Savings Time as well as Eastern Standard Time in the U.S.) is equal to 20021010T17:00:00Z, five hours later than 20021010T12:00:00Z.
The dateTimeLexicalRep production is equivalent to this regular expression once whitespace is removed.
\?([19][09][09][09]+)(0[09][09][09])\(0[19])(1[02])\(0[19])([12][09])(3[01])
T(([01][09])(2[03]):[05][09]:([05][09])(\.[09]+)?)(24:00:00(\.0+)?)
([+\](0[09])(1[04]):[05][09])?
Note that neither the dateTimeLexicalRep production nor this regular expression alone enforce the constraint on dateTimeLexicalRep given above.
The ·lexical mapping· for dateTime is ·dateTimeLexicalMap·. The ·canonical mapping· is ·dateTimeCanonicalMap·.
The mapping so defined is onetoone, except that '+00:00', '00:00', and 'Z' all represent the same zerolength duration timezone, ·UTC·; 'Z' is its ·canonical representation·.
When a timezone is added to a ·UTC· dateTime, the result is the date and time "in that timezone". For example, 20021010T12:00:00+05:00 is 20021010T07:00:00Z and 20021010T00:00:00+05:00 is 20021009T19:00:00Z.
In general, the ·orderrelation· on dateTime is a partial order since there is no determinate relationship between certain instants. For example, there is no determinate ordering between (a) 20000120T12:00:00 and (b) 20000120T12:00:00Z. Based on timezones currently in use, (c) could vary from 20000120T12:00:00+12:00 to 20000120T12:00:0013:00. It is, however, possible for this range to expand or contract in the future, based on local laws. Because of this, the following definition uses a somewhat broader range of indeterminate values: +14:00..14:00.
The following definition uses the notation S[year] to represent the year field of S, S[month] to represent the month field, and so on. The notation (Q & "14:00") means adding the timezone 14:00 to Q, where Q did not already have a timezone. This is a logical explanation of the process. Actual implementations are free to optimize as long as they produce the same results.
The ordering between two dateTimes P and Q is defined by the following algorithm:
A.Normalize P and Q. That is, if there is a timezone present, but it is not Z, convert it to Z using the addition operation defined in Adding durations to dateTimes (§H)
B. If P and Q either both have a time zone or both do not have a time zone, compare P and Q field by field from the year field down to the second field, and return a result as soon as it can be determined. That is:
C.Otherwise, if P contains a time zone and Q does not, compare as follows:
D. Otherwise, if P does not contain a time zone and Q does, compare as follows:
Examples:
Determinate  Indeterminate 

20000115T00:00:00 < 20000215T00:00:00  20000101T12:00:00 <> 19991231T23:00:00Z 
20000115T12:00:00 < 20000116T12:00:00Z  20000116T12:00:00 <> 20000116T12:00:00Z 
20000116T00:00:00 <> 20000116T12:00:00Z 
↓dateTime has the following ·constraining facets·:↓
↑dateTime and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from dateTime↑ may also specify values for the following↑ ·constraining facets·:↑
dateTime has the following values for its ·fundamental facets·:
[Definition:] time represents an instant of time that recurs every day. The ·value space· of time is the space of time of day values as defined in § 5.3 of [ISO 8601]. Specifically, it is a set of zeroduration daily time instances.
time represents instants of time that recur at the same point in each calendar day, or that occur in some arbitrary calendar day.
Since the lexical representation allows an optional time zone indicator, time values are partially ordered because it may not be able to determine the order of two values one of which has a time zone and the other does not. The order relation on time values is the Order relation on dateTime (§3.3.8.6) using an arbitrary date. See also Adding durations to dateTimes (§H). Pairs of time values with or without time zone indicators are totally ordered.
time uses the date/timeSevenPropertyModel, with ·year·, ·month·, and ·day· required to be absent. ·timezone· remains ·optional·.
Equality and order are as prescribed in The Sevenproperty Model (§D.2.1). time values (points in time in an "arbitrary" day) are ordered taking into account their ·timezone·.
A calendar ( or "local time") day with an early timezone begins earlier than the same calendar day with a later timezone. Since the timezones allowed spread over 28 hours, there are timezone pairs for which a given calendar day in the two timezones are totally disjoint—the earlier day ends before the same day starts in the later timezone. The moments in time represented by a single calendar day are spread over a 52hour interval, from the beginning of the day in the +14:00 timezone to the end of that day in the −14:00 timezone.
Examples that show the difference from version 1.0 of this specification (see Lexical Mappings (§3.3.9.4) for the notations):
08:00:00+10:00 < 17:00:00+10:00 (just as 08:00:00Z has always been less than 17:00:00Z, but in version 1.0 08:00:00+10:00 > 17:00:00+10:00 )
00:00:00+01:00 is less than every value with ·timezone· Z
Each value with ·timezone· +13:00 is less than every value with ·timezone· −13:00
22:00:00Z > 03:00:00+05:00 (since 19711231T03:00:00+05 is 19791230T22:00:00Z, not 19791231T22:00:00Z); in the previous version of this specification 22:00:00Z = 03:00:00+05:00 )
The lexical representation for time is the left truncated lexical representation for dateTime: hh:mm:ss.sss with optional following time zone indicator. For example, to indicate 1:20 pm for Eastern Standard Time which is 5 hours behind Coordinated Universal Time (·UTC·), one would write: 13:20:0005:00. See also ISO 8601 Date and Time Formats (§G).
The ·canonical representation· for time is defined by prohibiting certain options from the Lexical representation (§3.3.9.2). Specifically, either the time zone must be omitted or, if present, the time zone must be Coordinated Universal Time (·UTC·) indicated by a "Z". Additionally, the ·canonical representation· for midnight is 00:00:00.
The lexical representations for time are "projections" of those of dateTime, as follows:
The timeLexicalRep production is equivalent to this regular expression, once whitespace is removed:
(((([01][09])(2[03])):([05][09]):(([05][09])(\.[09]+)?))
(24:00:00(\.0+)?))
(Z((+)(0[09]1[04]):[05][09]))?
Note that neither the timeLexicalRep production nor this regular expression alone enforce the constraint on timeLexicalRep given above.
The ·lexical mapping· for time is ·timeLexicalMap·; the ·canonical mapping· is ·timeCanonicalMap·.
↓time has the following ·constraining facets·:↓
↑time and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from time↑ may also specify values for the following↑ ·constraining facets·:↑
time has the following values for its ·fundamental facets·:
[Definition:] ↓The ·value space· of date consists of topopen intervals of exactly one day in length on the timelines of dateTime, beginning on the beginning moment of each day (in each timezone), i.e. '00:00:00', up to but not including '24:00:00' (which is identical with '00:00:00'↓↑date represents topopen intervals of exactly one day in length on the timelines of dateTime, beginning on the beginning moment of each day (in each timezone), up to but not including the beginning moment↑ of the next day). For nontimezoned values, the topopen intervals disjointly cover the nontimezoned timeline, one per day. For timezoned values, the intervals begin at every minute and therefore overlap.
A "date object" is an object with year, month, and day properties just like those of dateTime objects, plus an optional timezonevalued timezone property. (As with values of dateTime timezones are a special case of durations.) Just as a dateTime object corresponds to a point on one of the timelines, a date object corresponds to an interval on one of the two timelines as just described.
Timezoned date values track the starting moment of their day, as determined by their timezone; said timezone is generally recoverable for ·canonical representations·. [Definition:] The recoverable timezone is that duration which is the result of subtracting the first moment (or any moment) of the timezoned date from the first moment (or the corresponding moment) ·UTC· on the same date. ·recoverable timezone·s are always durations between '+12:00' and '11:59'. This "timezone normalization" (which follows automatically from the definition of the date ·value space·) is explained more in Lexical representation (§3.3.10.2).
For example: the first moment of 20021010+13:00 is 20021010T00:00:00+13, which is 20021009T11:00:00Z, which is also the first moment of 2002100911:00. Therefore 20021010+13:00 is 2002100911:00; they are the same interval.
date uses the date/timeSevenPropertyModel, with ·hour·, ·minute·, and ·second· required to be absent. ·timezone· remains ·optional·.
Equality and order are as prescribed in The Sevenproperty Model (§D.2.1).
Examples that show the difference from version 1.0 (see Lexical Mappings (§3.3.10.4) for the notations):
20001212+13:00 < 20001212+11:00 (just as 20001212+12:00 has always been less than 20001212+11:00, but in version 1.0 20001212+13:00 > 20001212+11:00 , since 20001212+13:00's "recoverable timezone" was −11:00)
20001212+13:00 = 20001213−11:00 (whereas under 1.0, as just stated, 20001212+13:00 = 20001212−11:00)
For the following discussion, let the "date portion" of a dateTime or date object be an object similar to a dateTime or date object, with similar year, month, and day properties, but no others, having the same value for these properties as the original dateTime or date object.
The ·lexical space· of
date consists of finitelength
sequences of characters of the form:
''? yyyy '' mm '' dd zzzzzz?
where the date and optional timezone are represented exactly the
same way as they are for dateTime. The first moment of the
interval is that represented by:
'' yyyy '' mm '' dd 'T00:00:00' zzzzzz?
and the least upper bound of the interval is the timeline point represented
(noncanonically) by:
'' yyyy '' mm '' dd 'T24:00:00' zzzzzz?
.
Given a member of the date ·value space·, the date portion of the ·canonical representation· (the entire representation for nontimezoned values, and all but the timezone representation for timezoned values) is always the date portion of the dateTime ·canonical representation· of the interval midpoint (the dateTime representation, truncated on the right to eliminate 'T' and all following characters). For timezoned values, append the canonical representation of the ·recoverable timezone·.
The lexical representations for date are "projections" of those of dateTime, as follows:

' monthFrag '
' dayFrag timezoneFrag? Constraint: Dayofmonth Representations
3
' or be '29
'
unless the value to
which it would map would satisfy the value constraint on
·day· values
("Constraint: Dayofmonth Values") given above.The dateLexicalRep production is equivalent to this regular expression:
\?([19][09][09][09]+)(0[09][09][09])\(0[19])(1[02])\([02][09])(3[01])((+\)(0[09]1[04]):[05][09])?
Note that neither the dateLexicalRep production nor this regular expression alone enforce the constraint on dateLexicalRep given above.
The ·lexical mapping· for date is ·dateLexicalMap·. The ·canonical mapping· is ·dateCanonicalMap·.
[Definition:] gYearMonth represents a specific gregorian month in a specific gregorian year. The ·value space· of gYearMonth is the set of Gregorian calendar months as defined in § 5.2.1 of [ISO 8601]. Specifically, it is a set of onemonth long, nonperiodic instances e.g. 199910 to represent the whole month of 199910, independent of how many days this month has.
gYearMonth represents specific whole Gregorian months in specific Gregorian years.
Since the lexical representation allows an optional time zone indicator, gYearMonth values are partially ordered because it may not be possible to unequivocally determine the order of two values one of which has a time zone and the other does not. If gYearMonth values are considered as periods of time, the order relation on gYearMonth values is the order relation on their starting instants. This is discussed in Order relation on dateTime (§3.3.8.6). See also Adding durations to dateTimes (§H). Pairs of gYearMonth values with or without time zone indicators are totally ordered.
gYearMonth uses the date/timeSevenPropertyModel, with ·day·, ·hour·, ·minute·, and ·second· required to be absent. ·timezone· remains ·optional·.
Equality and order are as prescribed in The Sevenproperty Model (§D.2.1).
An example that shows the difference from version 1.0 (see Lexical ↓representation↓↑Mappings↑ (§3.3.11.2) for the notations):
200012+13:00 < 200012+11:00 (just as 200012+12:00 has always been less than 2000−12+11:00, but in version 1.0 200012+13:00 > 200012+11:00 , since 2000−12+13:00's "recoverable timezone" was −11:00)
The lexical representation for gYearMonth is the reduced (right truncated) lexical representation for dateTime: CCYYMM. No left truncation is allowed. An optional following time zone qualifier is allowed. To accommodate year values outside the range from 0001 to 9999, additional digits can be added to the left of this representation and a preceding "" sign is allowed.
For example, to indicate the month of May 1999, one would write: 199905. See also ISO 8601 Date and Time Formats (§G).
The lexical representations for gYearMonth are "projections" of those of dateTime, as follows:
The gYearMonthLexicalRep is equivalent to this regular expression:
\?([19][09][09][09]+)(0[09][09][09])\(0[19])(1[02])((+\)(0[09]1[04]):[05][09])?
The ·lexical mapping· and ·canonical mapping· for gYearMonth are the following functions:
The ·lexical mapping· for gYearMonth is ·gYearMonthLexicalMap·. The ·canonical mapping· is ·gYearMonthCanonicalMap·.
↓gYearMonth has the following ·constraining facets·:↓
↑gYearMonth and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from gYearMonth↑ may also specify values for the following↑ ·constraining facets·:↑
gYearMonth has the following values for its ·fundamental facets·:
[Definition:] gYear represents a gregorian calendar year. The ·value space· of gYear is the set of Gregorian calendar years as defined in § 5.2.1 of [ISO 8601]. Specifically, it is a set of oneyear long, nonperiodic instances e.g. lexical 1999 to represent the whole year 1999, independent of how many months and days this year has.
gYear represents Gregorian calendar years.
Since the lexical representation allows an optional time zone indicator, gYear values are partially ordered because it may not be possible to unequivocally determine the order of two values one of which has a time zone and the other does not. If gYear values are considered as periods of time, the order relation on gYear values is the order relation on their starting instants. This is discussed in Order relation on dateTime (§3.3.8.6). See also Adding durations to dateTimes (§H). Pairs of gYear values with or without time zone indicators are totally ordered.
gYear uses the date/timeSevenPropertyModel, with ·month·, ·day·, ·hour·, ·minute·, and ·second· required to be absent. ·timezone· remains ·optional·.
Equality and order are as prescribed in The Sevenproperty Model (§D.2.1).
An example that shows the difference from version 1.0 (see Lexical ↓representation↓↑Mappings↑ (§3.3.12.2) for the notations):
2000+13:00 < 2000+11:00 (just as 2000+12:00 has always been less than 2000+11:00, but in version 1.0 2000+13:00 > 2000+11:00 , since 2000+13:00's "recoverable timezone" was −11:00)
The lexical representation for gYear is the reduced (right truncated) lexical representation for dateTime: CCYY. No left truncation is allowed. An optional following time zone qualifier is allowed as for dateTime. To accommodate year values outside the range from 0001 to 9999, additional digits can be added to the left of this representation and a preceding "" sign is allowed.
For example, to indicate 1999, one would write: 1999. See also ISO 8601 Date and Time Formats (§G).
The lexical representations for gYear are "projections" of those of dateTime, as follows:
The gYearLexicalRep is equivalent to this regular expression:
\?([19][09][09][09]+)(0[09][09][09])((+\)(0[09]1[04]):[05][09])?
The ·lexical mapping· and ·canonical mapping· for gYear are the following functions:
The ·lexical mapping· for gYear is ·gYearLexicalMap·. The ·canonical mapping· is ·gYearCanonicalMap·.
↓gYear has the following ·constraining facets·:↓
↑gYear and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from gYear↑ may also specify values for the following↑ ·constraining facets·:↑
gYear has the following values for its ·fundamental facets·:
[Definition:] gMonthDay is a gregorian date that recurs, specifically a day of the year such as the third of May. Arbitrary recurring dates are not supported by this datatype. The ·value space· of gMonthDay is the set of calendar dates, as defined in § 3 of [ISO 8601]. Specifically, it is a set of oneday long, annually periodic instances.
gMonthDay represents whole calendar days that recur at the same point in each calendar year, or that occur in some arbitrary calendar year.
This datatype can be used, for example, to record birthdays; an instance of the datatype could be used to say that someone's birthday occurs on the 14th of September every year.
Since the lexical representation allows an optional time zone indicator, gMonthDay values are partially ordered because it may not be possible to unequivocally determine the order of two values one of which has a time zone and the other does not. If gMonthDay values are considered as periods of time, in an arbitrary leap year, the order relation on gMonthDay values is the order relation on their starting instants. This is discussed in Order relation on dateTime (§3.3.8.6). See also Adding durations to dateTimes (§H). Pairs of gMonthDay values with or without time zone indicators are totally ordered.
gMonthDay uses the date/timeSevenPropertyModel, with ·year·, ·hour·, ·minute·, and ·second· required to be absent. ·timezone· remains ·optional·.
Equality and order are as prescribed in The Sevenproperty Model (§D.2.1).
An example that shows the difference from version 1.0 (see Lexical ↓representation↓↑Mappings↑ (§3.3.13.2) for the notations):
1212+13:00 < 1212+11:00 (just as 1212+12:00 has always been less than 1212+11:00, but in version 1.0 1212+13:00 > 1212+11:00 , since 1212+13:00's "recoverable timezone" was −11:00)
The lexical representation for gMonthDay is the left truncated lexical representation for date: MMDD. An optional following time zone qualifier is allowed as for date. No preceding sign is allowed. No other formats are allowed. See also ISO 8601 Date and Time Formats (§G).
The lexical representations for gMonthDay are "projections" of those of dateTime, as follows:

' monthFrag '
' dayFrag timezoneFrag? Constraint: Dayofmonth Representations
3
' or be '29
'
unless the value to
which it would map would satisfy the value constraint on
·day· values
("Constraint: Dayofmonth Values") given above.The gMonthDayLexicalRep is equivalent to this regular expression:
\\(0[19])(1[02])\([02][09])(3[01])((+\)(0[09]1[04]):[05][09])?
Note that neither the gMonthDayLexicalRep production nor this regular expression alone enforce the constraint on gMonthDayLexicalRep given above.
This datatype can be used to represent a specific day in a month. To say, for example, that my birthday occurs on the 14th of September ever year.
The ·lexical mapping· and ·canonical mapping· for gMonthDay are the following functions:
The ·lexical mapping· for gMonthDay is ·gMonthDayLexicalMap·. The ·canonical mapping· is ·gMonthDayCanonicalMap·.
↓gMonthDay has the following ·constraining facets·:↓
↑gMonthDay and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from gMonthDay↑ may also specify values for the following↑ ·constraining facets·:↑
gMonthDay has the following values for its ·fundamental facets·:
[Definition:] gDay is a gregorian day that recurs, specifically a day of the month such as the 5th of the month. Arbitrary recurring days are not supported by this datatype. The ·value space· of gDay is the space of a set of calendar dates as defined in § 3 of [ISO 8601]. Specifically, it is a set of oneday long, monthly periodic instances.
↑[Definition:] gDay represents whole days within an arbitrary month—days that recur at the same point in each (Gregorian) month.↑ This datatype ↓can be↓↑is↑ used to represent a specific day of the month. To ↓say, for example, that I get my paycheck↓↑indicate, for example, that an employee gets a paycheck↑ on the 15th of each month. ↑(Obviously, days beyond 28 cannot occur in all months; they are nonetheless permitted, up to 31.)↑
Since the lexical representation allows an optional time zone indicator, gDay values are partially ordered because it may not be possible to unequivocally determine the order of two values one of which has a time zone and the other does not. If gDay values are considered as periods of time, in an arbitrary month that has 31 days, the order relation on gDay values is the order relation on their starting instants. This is discussed in Order relation on dateTime (§3.3.8.6). See also Adding durations to dateTimes (§H). Pairs of gDay values with or without time zone indicators are totally ordered.
gDay uses the date/timeSevenPropertyModel, with ·year·, ·month·, ·hour·, ·minute·, and ·second· required to be absent. ·timezone· remains ·optional· and ·day· must be between 1 and 31 inclusive.
Equality and order are as prescribed in The Sevenproperty Model (§D.2.1). Since gDay values (days) are ordered by their first moments, it is possible for apparent anomalies to appear in the order when ·timezone· values differ by at least 24 hours. (It is possible for ·timezone· values to differ by up to 28 hours.)
Examples that may appear anomalous (see Lexical Mappings (§3.3.14.3) for the notations):
The lexical representation for gDay is the left truncated lexical representation for date: DD . An optional following time zone qualifier is allowed as for date. No preceding sign is allowed. No other formats are allowed. See also ISO 8601 Date and Time Formats (§G).
The lexical representations for gDay are "projections" of those of dateTime, as follows:
The gDayLexicalRep is equivalent to this regular expression:
\\\([02][09]3[01])((+\)(0[09]1[04]):[05][09])?
The ·lexical mapping· for gDay is ·gDayLexicalMap·. The ·canonical mapping· is ·gDayCanonicalMap·.
↓gDay has the following ·constraining facets·:↓
↑gDay and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from gDay↑ may also specify values for the following↑ ·constraining facets·:↑
gDay has the following values for its ·fundamental facets·:
[Definition:] gMonth is a gregorian month that recurs every year. The ·value space· of gMonth is the space of a set of calendar months as defined in § 3 of [ISO 8601]. Specifically, it is a set of onemonth long, yearly periodic instances.
↓This datatype can be used to represent a specific month. To say, for example, that Thanksgiving falls in the month of November.↓↑gMonth represents whole (Gregorian) months within an arbitrary year—months that recur at the same point in each year. It might be used, for example, to say what month annual Thanksgiving celebrations fall in different countries (11 in the United States, 10 in Canada, and possibly other months in other countries).↑
Since the lexical representation allows an optional time zone indicator, gMonth values are partially ordered because it may not be possible to unequivocally determine the order of two values one of which has a time zone and the other does not. If gMonth values are considered as periods of time, the order relation on gMonth is the order relation on their starting instants. This is discussed in Order relation on dateTime (§3.3.8.6). See also Adding durations to dateTimes (§H). Pairs of gMonth values with or without time zone indicators are totally ordered.
gMonth uses the date/timeSevenPropertyModel, with ·year·, ·day·, ·hour·, ·minute·, and ·second· required to be absent. ·timezone· remains ·optional·.
Equality and order are as prescribed in The Sevenproperty Model (§D.2.1).
An example that shows the difference from version 1.0 (see Lexical ↓representation↓↑Mappings↑ (§3.3.15.2) for the notations):
12+13:00 < 12+11:00 (just as 12+12:00 has always been less than 12+11:00, but in version 1.0 12+13:00 > 12+11:00 , since 12+13:00's "recoverable timezone" was −11:00)
The lexical representation for gMonth is the left and right truncated lexical representation for date: MM. An optional following time zone qualifier is allowed as for date. No preceding sign is allowed. No other formats are allowed. See also ISO 8601 Date and Time Formats (§G).
The lexical representations for gMonth are "projections" of those of dateTime, as follows:
The gMonthLexicalRep is equivalent to this regular expression:
\\(0[19])(1[02])((+\)(0[09]1[04]):[05][09])?
The ·lexical mapping· and ·canonical mapping· for gMonth are defined as follows:
The ·lexical mapping· for gMonth is ·gMonthLexicalMap·. The ·canonical mapping· is ·gMonthCanonicalMap·.
↓gMonth has the following ·constraining facets·:↓
↑gMonth and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from gMonth↑ may also specify values for the following↑ ·constraining facets·:↑
gMonth has the following values for its ·fundamental facets·:
[Definition:] hexBinary represents arbitrary hexencoded binary data.
The ·value space· of hexBinary is the set of finitelength sequences of binary octets.
hexBinary has a ·lexical representation· where
each binary octet is encoded as a character tuple, consisting of two
hexadecimal digits ([09afAF]) representing the octet code. For example,
'0FB7
' is a hex encoding for the 16bit integer 4023
(whose binary representation is 111110110111).
More formally, the ·lexical space· of hexBinary is the set of literals matching the hexBinary production.
The set recognized by hexBinary is the same as that recognized by the regular
expression '([09afAF]{2})*
'.
The ·lexical mapping· of hexBinary is ·hexBinaryMap·.
The ·canonical representation· for hexBinary is defined by prohibiting certain options from the Lexical Representation (§3.3.16.2). Specifically, the lower case hexadecimal digits ([af]) are not allowed.
The ·canonical mapping· of hexBinary is given formally in ·hexBinaryCanonical·.
↓hexBinary has the following ·constraining facets·:↓
↑hexBinary and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from hexBinary↑ may also specify values for the following↑ ·constraining facets·:↑
hexBinary has the following values for its ·fundamental facets·:
[Definition:] base64Binary represents ↑arbitrary↑ Base64encoded ↓arbitrary↓ binary data.↓ The ·value space· of base64Binary is the set of finitelength sequences of binary octets.↓ For base64Binary data the entire binary stream is encoded using the Base64 ↓Alphabet in [RFC 2045]↓↑Encoding defined in [RFC 3548], which is derived from the encoding described in [RFC 2045]↑.
The ·value space· of base64Binary is the set of finitelength sequences of binary octets.
The ↓lexical forms↓↑·lexical representations·↑ of base64Binary values are
limited to the 65 characters of the Base64 Alphabet defined in
↓[RFC 2045]↓↑[RFC 3548]↑, i.e., az
, AZ
,
09
, the plus sign (+), the forward slash (/) and the
equal sign (=), together with
↓the characters defined in [XML] as
white space↓↑the space character
(#x20)↑. No other characters are allowed.
For compatibility with older mail gateways, [RFC 2045] suggests that ↓b↓↑B↑ase64 data should have lines limited to at most 76 characters in length. This linelength limitation is not ↑required by [RFC 3548] and is not↑ mandated in the ↓lexical forms↓↑·lexical representations·↑ of base64Binary data↓ and ↓↑. It↑ ↓must not↓↑must not↑ be enforced by XML Schema processors.
The ·lexical space· of base64Binary is ↓given by the following grammar (the notation is that used in [XML]); legal lexical forms must match↓↑the set of literals which ·match·↑ the Base64Binary production.
Base64Binary ::= ((B64S B64S B64S B64S)*
((B64S B64S B64S B64) 
(B64S B64S B16S '=') 
(B64S B04S '=' #x20? '=')))?
B64S ::= B64 #x20?
B16S ::= B16 #x20?
B04S ::= B04 #x20?
B04 ::= [AQgw]
B16 ::= [AEIMQUYcgkosw048]
B64 ::= [AZaz09+/]
Note that this grammar requires the number of nonwhitespace characters in the ↓lexical form↓↑·lexical representation·↑ to be a multiple of four, and for equals signs to appear only at the end of the ↓lexical form↓↑·lexical representation·↑; ↓strings↓↑literals↑ which do not meet these constraints are not legal ↓lexical forms↓↑·lexical representations·↑ of base64Binary because they cannot successfully be decoded by ↓b↓↑B↑ase64 decoders.
The ·lexical mapping· for base64Binary is as given in [RFC 2045] and [RFC 3548].
The canonical ↓lexical form↓↑·lexical representation·↑ of a base64Binary data value is the ↓b↓↑B↑ase64 encoding of the value which matches the Canonicalbase64Binary production in the following grammar:
Canonicalbase64Binary ::= (B64
B64 B64 B64)*
((B64 B64 B16 '=')  (B64 B04 '=='))?
That is, the ·canonical representation· of a base64Binary value is the ·lexical representation· which maps to that value and contains no whitespace. The ·canonical mapping· for base64Binary is thus the encoding algorithm for Base64 data given in [RFC 2045] and [RFC 3548], with the proviso that no characters except those in the Base64 Alphabet are to be written out.
The length of a base64Binary value is the number of octets it contains. This may be calculated from the ↓lexical form↓↑·lexical representation·↑ by removing whitespace and padding characters and performing the calculation shown in the pseudocode below:
lex2 := killwhitespace(lexform)  remove whitespace characters
lex3 := strip_equals(lex2)  strip padding characters at end
length := floor (length(lex3) * 3 / 4)  calculate length
Note on encoding: [RFC 2045] ↑and [RFC 3548]↑ explicitly reference↓s↓ USASCII encoding. However, decoding of base64Binary data in an XML entity is to be performed on the Unicode characters obtained after character encoding processing as specified by [XML].
↓base64Binary has the following ·constraining facets·:↓
↑base64Binary and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from base64Binary↑ may also specify values for the following↑ ·constraining facets·:↑
base64Binary has the following values for its ·fundamental facets·:
[Definition:] anyURI represents ↓a Uniform Resource Identifier Reference (URI)↓↑an Internationalized Resource Identifier Reference (IRI)↑. An anyURI value can be absolute or relative, and may have an optional fragment identifier (i.e., it may be ↓a URI↓↑an IRI↑ Reference). This type should be used ↓to specify the intention that↓↑when↑ the value fulfills the role of ↓a URI as defined by [RFC 2396], as amended by [RFC 2732]↓↑an IRI, as defined in [RFC 3987] or its successor(s) in the IETF Standards Track↑.
The ·lexical space· of anyURI is finitelength character sequences↓ which, when the algorithm defined in Section 5.4 of [XML Linking Language] is applied to them, result in strings which are legal URIs according to [RFC 2396], as amended by [RFC 2732]↓.
Each URI scheme imposes specialized syntax rules for URIs in that scheme, including restrictions on the syntax of allowed fragment identifiers. Because it is impractical for processors to check that a value is a contextappropriate URI reference, neither the syntactic constraints defined by the definitions of individual schemes nor the generic syntactic constraints defined by [RFC 3987] and [RFC 3986] and their successors are part of this datatype as defined here. Applications which depend on anyURI values being legal according to the rules of the relevant specifications should make arrangements to check values against the appropriate definitions of IRI, URI, and specific schemes.
%20
').
The ·lexical mapping· for anyURI is the identity mapping.
↓anyURI has the following ·constraining facets·:↓
↑anyURI and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from anyURI↑ may also specify values for the following↑ ·constraining facets·:↑
anyURI has the following values for its ·fundamental facets·:
[Definition:] QName represents XML qualified names. The ·value space· of QName is the set of tuples {namespace name, local part}, where namespace name is an anyURI and local part is an NCName. The ·lexical space· of QName is the set of strings that ·match· the QName production of [Namespaces in XML].
It is implementationdefined whether an implementation of this specification supports the QName production from [Namespaces in XML], or that from [Namespaces in XML 1.0], or both. See Dependencies on Other Specifications (§1.3).
↓QName has the following ·constraining facets·:↓
↑QName and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from QName↑ may also specify values for the following↑ ·constraining facets·:↑
QName has the following values for its ·fundamental facets·:
The use of ·length·, ·minLength· and ·maxLength· on ↑QName or↑ datatypes derived from QName is deprecated. Future versions of this specification may remove these facets for this datatype.
[Definition:] NOTATION represents the NOTATION attribute type from [XML]. The ·value space· of NOTATION is the set of QNames of notations declared in the current schema. The ·lexical space· of NOTATION is the set of all names of notations declared in the current schema (in the form of QNames).
For compatibility (see Terminology (§1.6)) NOTATION should be used only on attributes and should only be used in schemas with no target namespace.
↓NOTATION has the following ·constraining facets·:↓
↑NOTATION and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑Datatypes derived by restriction from NOTATION↑ may also specify values for the following↑ ·constraining facets·:↑
NOTATION has the following values for its ·fundamental facets·:
The use of ·length·, ·minLength· and ·maxLength· on ↑NOTATION or↑ datatypes derived from NOTATION is deprecated. Future versions of this specification may remove these facets for this datatype.
This section gives conceptual definitions for all ·builtin· ↓·derived·↓↑·ordinary·↑ datatypes defined by this specification. The XML representation used to define ↓·derived·↓ datatypes (whether ·builtin· or ↓·userderived·↓↑·userdefined·↑) is given in ↓section ↓XML Representation of Simple Type Definition Schema Components (§4.1.2) and the complete definitions of the ·builtin· ↓·derived·↓↑·ordinary·↑ datatypes are provided in ↓Appendix A↓↑the appendix↑ Schema for ↑Schema Documents (Datatypes)↑ ↓Datatype Definitions↓ (normative) (§A).
[Definition:] normalizedString represents white space normalized strings. The ·value space· of normalizedString is the set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters. The ·lexical space· of normalizedString is the set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters. The ·base type· of normalizedString is string.
↓normalizedString has the following ·constraining facets·:↓
↑normalizedString has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
replace
↑↑Datatypes derived by restriction from normalizedString↑ may also specify values for the following↑ ·constraining facets·:↑
normalizedString has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from normalizedString:
[Definition:] token represents tokenized strings. The ·value space· of token is the set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces. The ·lexical space· of token is the set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces. The ·base type· of token is normalizedString.
↓token has the following ·constraining facets·:↓
↑token has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
collapse
↑↑Datatypes derived by restriction from token↑ may also specify values for the following↑ ·constraining facets·:↑
token has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from token:
[Definition:] language represents ↑formal↑ natural language identifiers↑,↑ as defined by [RFC 3066]↑or its successor(s) in the IETF Standards Track↑. ↓The ·value space· of language is the set of all strings that are valid language identifiers as defined [RFC 3066]. ↓The ↑·value space· and ↑·lexical space· of language ↓is↓↑are↑ the set of all strings that conform to the pattern
[azAZ]{1,8}([azAZ09]{1,8})*
↑, This is the set of strings accepted by the grammar given in [RFC 3066]↑. The ·base type· of language is token.
MN
' and
'mn
' therefore correspond to distinct values and
have distinct canonical forms. Users of this specification should be
aware of this fact, the consequence of which is that the
caseinsensitive treatment of language values prescribed by
[RFC 3066] does not follow from the definition of
this datatype given here; applications which require
casesensitivity should make appropriate adjustments.↓language has the following ·constraining facets·:↓
↑language has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[azAZ]{1,8}([azAZ09]{1,8})*
↑collapse
↑↑Datatypes derived by restriction from language↑ may also specify values for the following↑ ·constraining facets·:↑
language has the following values for its ·fundamental facets·:
[Definition:] NMTOKEN represents the NMTOKEN attribute type from [XML]. The ·value space· of NMTOKEN is the set of tokens that ·match· the Nmtoken production in [XML]. The ·lexical space· of NMTOKEN is the set of strings that ·match· the Nmtoken production in [XML]. The ·base type· of NMTOKEN is token.
It is implementationdefined whether an implementation of this specification supports the NMTOKEN production from [XML], or that from [XML 1.0], or both. See Dependencies on Other Specifications (§1.3).
For compatibility (see Terminology (§1.6)) NMTOKEN should be used only on attributes.
↓NMTOKEN has the following ·constraining facets·:↓
↑NMTOKEN has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
\c+
↑collapse
↑↑Datatypes derived by restriction from NMTOKEN↑ may also specify values for the following↑ ·constraining facets·:↑
NMTOKEN has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·constructed· from NMTOKEN:
[Definition:] NMTOKENS represents the NMTOKENS attribute type from [XML]. The ·value space· of NMTOKENS is the set of finite, nonzerolength sequences of ·NMTOKEN·s. The ·lexical space· of NMTOKENS is the set of spaceseparated lists of tokens, of which each token is in the ·lexical space· of NMTOKEN. The ·item type· of NMTOKENS is .
For compatibility (see Terminology (§1.6)) NMTOKENS should be used only on attributes.
↓NMTOKENS has the following ·constraining facets·:↓
↑NMTOKENS has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
1
↑↑Datatypes derived by restriction from NMTOKENS↑ may also specify values for the following↑ ·constraining facets·:↑
NMTOKENS has the following values for its ·fundamental facets·:
[Definition:] Name represents XML Names. The ·value space· of Name is the set of all strings which ·match· the Name production of [XML]. The ·lexical space· of Name is the set of all strings which ·match· the Name production of [XML]. The ·base type· of Name is token.
It is implementationdefined whether an implementation of this specification supports the Name production from [XML], or that from [XML 1.0], or both. See Dependencies on Other Specifications (§1.3).
↓Name has the following ·constraining facets·:↓
↑Name has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
\i\c*
↑collapse
↑↑Datatypes derived by restriction from Name↑ may also specify values for the following↑ ·constraining facets·:↑
Name has the following values for its ·fundamental facets·:
[Definition:] NCName represents XML "noncolonized" Names. The ·value space· of NCName is the set of all strings which ·match· the NCName production of [Namespaces in XML]. The ·lexical space· of NCName is the set of all strings which ·match· the NCName production of [Namespaces in XML]. The ·base type· of NCName is Name.
It is implementationdefined whether an implementation of this specification supports the NCName production from [Namespaces in XML], or that from [Namespaces in XML 1.0], or both. See Dependencies on Other Specifications (§1.3).
↓NCName has the following ·constraining facets·:↓
↑NCName has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
\i\c* ∩ [\i[:]][\c[:]]*
↑collapse
↑↑Datatypes derived by restriction from NCName↑ may also specify values for the following↑ ·constraining facets·:↑
NCName has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from NCName:
[Definition:] ID represents the ID attribute type from [XML]. The ·value space· of ID is the set of all strings that ·match· the NCName production in [Namespaces in XML]. The ·lexical space· of ID is the set of all strings that ·match· the NCName production in [Namespaces in XML]. The ·base type· of ID is NCName.
For compatibility (see Terminology (§1.6)) ID should be used only on attributes.
↓ID has the following ·constraining facets·:↓
↑ID has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
\i\c* ∩ [\i[:]][\c[:]]*
↑collapse
↑↑Datatypes derived by restriction from ID↑ may also specify values for the following↑ ·constraining facets·:↑
ID has the following values for its ·fundamental facets·:
[Definition:] IDREF represents the IDREF attribute type from [XML]. The ·value space· of IDREF is the set of all strings that ·match· the NCName production in [Namespaces in XML]. The ·lexical space· of IDREF is the set of strings that ·match· the NCName production in [Namespaces in XML]. The ·base type· of IDREF is NCName.
For compatibility (see Terminology (§1.6)) this datatype should be used only on attributes.
↓IDREF has the following ·constraining facets·:↓
↑IDREF has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
\i\c* ∩ [\i[:]][\c[:]]*
↑collapse
↑↑Datatypes derived by restriction from IDREF↑ may also specify values for the following↑ ·constraining facets·:↑
IDREF has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·constructed· from IDREF:
[Definition:] IDREFS represents the IDREFS attribute type from [XML]. The ·value space· of IDREFS is the set of finite, nonzerolength sequences of IDREFs. The ·lexical space· of IDREFS is the set of spaceseparated lists of tokens, of which each token is in the ·lexical space· of IDREF. The ·item type· of IDREFS is .
For compatibility (see Terminology (§1.6)) IDREFS should be used only on attributes.
↓IDREFS has the following ·constraining facets·:↓
↑IDREFS has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
1
↑↑Datatypes derived by restriction from IDREFS↑ may also specify values for the following↑ ·constraining facets·:↑
IDREFS has the following values for its ·fundamental facets·:
[Definition:] ENTITY represents the ENTITY attribute type from [XML]. The ·value space· of ENTITY is the set of all strings that ·match· the NCName production in [Namespaces in XML] and have been declared as an unparsed entity in a document type definition. The ·lexical space· of ENTITY is the set of all strings that ·match· the NCName production in [Namespaces in XML]. The ·base type· of ENTITY is NCName.
For compatibility (see Terminology (§1.6)) ENTITY should be used only on attributes.
↓ENTITY has the following ·constraining facets·:↓
↑ENTITY has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
\i\c* ∩ [\i[:]][\c[:]]*
↑collapse
↑↑Datatypes derived by restriction from ENTITY↑ may also specify values for the following↑ ·constraining facets·:↑
ENTITY has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·constructed· from ENTITY:
[Definition:] ENTITIES represents the ENTITIES attribute type from [XML]. The ·value space· of ENTITIES is the set of finite, nonzerolength sequences of ·ENTITY·s that have been declared as unparsed entities in a document type definition. The ·lexical space· of ENTITIES is the set of spaceseparated lists of tokens, of which each token is in the ·lexical space· of ENTITY. The ·item type· of ENTITIES is .
For compatibility (see Terminology (§1.6)) ENTITIES should be used only on attributes.
↓ENTITIES has the following ·constraining facets·:↓
↑ENTITIES has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
1
↑↑Datatypes derived by restriction from ENTITIES↑ may also specify values for the following↑ ·constraining facets·:↑
ENTITIES has the following values for its ·fundamental facets·:
[Definition:] integer is derived from decimal by fixing the value of ·fractionDigits· to be 0 and disallowing the trailing decimal point. This results in the standard mathematical concept of the integer numbers. The ·value space· of integer is the infinite set {...,2,1,0,1,2,...}. The ·base type· of integer is decimal.
The ·canonical representation· for integer is defined by prohibiting certain options from the Lexical representation (§3.4.13.1). Specifically, the preceding optional "+" sign is prohibited and leading zeroes are prohibited.
↓integer has the following ·constraining facets·:↓
↑integer and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑integer has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑↑Datatypes derived by restriction from integer↑ may also specify values for the following↑ ·constraining facets·:↑
integer has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from integer:
[Definition:] nonPositiveInteger is derived from integer by setting the value of ·maxInclusive· to be 0. This results in the standard mathematical concept of the nonpositive integers. The ·value space· of nonPositiveInteger is the infinite set {...,2,1,0}. The ·base type· of nonPositiveInteger is integer.
The ·canonical representation· for nonPositiveInteger is defined by prohibiting certain options from the Lexical representation (§3.4.14.1). In the canonical form for zero, the sign must be omitted. Leading zeroes are prohibited.
↓nonPositiveInteger has the following ·constraining facets·:↓
↑nonPositiveInteger and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑nonPositiveInteger has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑0
↑↑Datatypes derived by restriction from nonPositiveInteger↑ may also specify values for the following↑ ·constraining facets·:↑
nonPositiveInteger has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from nonPositiveInteger:
[Definition:] negativeInteger is derived from nonPositiveInteger by setting the value of ·maxInclusive· to be 1. This results in the standard mathematical concept of the negative integers. The ·value space· of negativeInteger is the infinite set {...,2,1}. The ·base type· of negativeInteger is nonPositiveInteger.
The ·canonical representation· for negativeInteger is defined by prohibiting certain options from the Lexical representation (§3.4.15.1). Specifically, leading zeroes are prohibited.
↓negativeInteger has the following ·constraining facets·:↓
↑negativeInteger and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑negativeInteger has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑1
↑↑Datatypes derived by restriction from negativeInteger↑ may also specify values for the following↑ ·constraining facets·:↑
negativeInteger has the following values for its ·fundamental facets·:
[Definition:] long is derived from integer by setting the value of ·maxInclusive· to be 9223372036854775807 and ·minInclusive· to be 9223372036854775808. The ·base type· of long is integer.
The ·canonical representation· for long is defined by prohibiting certain options from the Lexical representation (§3.4.16.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
↓long has the following ·constraining facets·:↓
↑long and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑long has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑9223372036854775807
↑9223372036854775808
↑↑Datatypes derived by restriction from long↑ may also specify values for the following↑ ·constraining facets·:↑
long has the following values for its ·fundamental facets·:
[Definition:] int is derived from long by setting the value of ·maxInclusive· to be 2147483647 and ·minInclusive· to be 2147483648. The ·base type· of int is long.
The ·canonical representation· for int is defined by prohibiting certain options from the Lexical representation (§3.4.17.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
↓int has the following ·constraining facets·:↓
↑int and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑int has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑2147483647
↑2147483648
↑↑Datatypes derived by restriction from int↑ may also specify values for the following↑ ·constraining facets·:↑
int has the following values for its ·fundamental facets·:
[Definition:] short is derived from int by setting the value of ·maxInclusive· to be 32767 and ·minInclusive· to be 32768. The ·base type· of short is int.
The ·canonical representation· for short is defined by prohibiting certain options from the Lexical representation (§3.4.18.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
↓short has the following ·constraining facets·:↓
↑short and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑short has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑32767
↑32768
↑↑Datatypes derived by restriction from short↑ may also specify values for the following↑ ·constraining facets·:↑
short has the following values for its ·fundamental facets·:
[Definition:] byte is derived from short by setting the value of ·maxInclusive· to be 127 and ·minInclusive· to be 128. The ·base type· of byte is short.
The ·canonical representation· for byte is defined by prohibiting certain options from the Lexical representation (§3.4.19.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
↓byte has the following ·constraining facets·:↓
↑byte and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑byte has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑127
↑128
↑↑Datatypes derived by restriction from byte↑ may also specify values for the following↑ ·constraining facets·:↑
byte has the following values for its ·fundamental facets·:
[Definition:] nonNegativeInteger is derived from integer by setting the value of ·minInclusive· to be 0. This results in the standard mathematical concept of the nonnegative integers. The ·value space· of nonNegativeInteger is the infinite set {0,1,2,...}. The ·base type· of nonNegativeInteger is integer.
The ·canonical representation· for nonNegativeInteger is defined by prohibiting certain options from the Lexical representation (§3.4.20.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
↓nonNegativeInteger has the following ·constraining facets·:↓
↑nonNegativeInteger and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑nonNegativeInteger has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑0
↑↑Datatypes derived by restriction from nonNegativeInteger↑ may also specify values for the following↑ ·constraining facets·:↑
nonNegativeInteger has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from nonNegativeInteger:
[Definition:] unsignedLong is derived from nonNegativeInteger by setting the value of ·maxInclusive· to be 18446744073709551615. The ·base type· of unsignedLong is nonNegativeInteger.
The ·canonical representation· for unsignedLong is defined by prohibiting certain options from the Lexical representation (§3.4.21.1). Specifically, leading zeroes are prohibited.
↓unsignedLong has the following ·constraining facets·:↓
↑unsignedLong and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑unsignedLong has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑18446744073709551615
↑0
↑↑Datatypes derived by restriction from unsignedLong↑ may also specify values for the following↑ ·constraining facets·:↑
unsignedLong has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from unsignedLong:
[Definition:] unsignedInt is derived from unsignedLong by setting the value of ·maxInclusive· to be 4294967295. The ·base type· of unsignedInt is unsignedLong.
The ·canonical representation· for unsignedInt is defined by prohibiting certain options from the Lexical representation (§3.4.22.1). Specifically, leading zeroes are prohibited.
↓unsignedInt has the following ·constraining facets·:↓
↑unsignedInt and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑unsignedInt has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑4294967295
↑0
↑↑Datatypes derived by restriction from unsignedInt↑ may also specify values for the following↑ ·constraining facets·:↑
unsignedInt has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from unsignedInt:
[Definition:] unsignedShort is derived from unsignedInt by setting the value of ·maxInclusive· to be 65535. The ·base type· of unsignedShort is unsignedInt.
The ·canonical representation· for unsignedShort is defined by prohibiting certain options from the Lexical representation (§3.4.23.1). Specifically, the leading zeroes are prohibited.
↓unsignedShort has the following ·constraining facets·:↓
↑unsignedShort and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑unsignedShort has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑65535
↑0
↑↑Datatypes derived by restriction from unsignedShort↑ may also specify values for the following↑ ·constraining facets·:↑
unsignedShort has the following values for its ·fundamental facets·:
The following ·builtin· datatypes are ·derived· from unsignedShort:
[Definition:] unsignedByte is derived from unsignedShort by setting the value of ·maxInclusive· to be 255. The ·base type· of unsignedByte is unsignedShort.
The ·canonical representation· for unsignedByte is defined by prohibiting certain options from the Lexical representation (§3.4.24.1). Specifically, leading zeroes are prohibited.
↓unsignedByte has the following ·constraining facets·:↓
↑unsignedByte and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑unsignedByte has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑255
↑0
↑↑Datatypes derived by restriction from unsignedByte↑ may also specify values for the following↑ ·constraining facets·:↑
unsignedByte has the following values for its ·fundamental facets·:
[Definition:] positiveInteger is derived from nonNegativeInteger by setting the value of ·minInclusive· to be 1. This results in the standard mathematical concept of the positive integer numbers. The ·value space· of positiveInteger is the infinite set {1,2,...}. The ·base type· of positiveInteger is nonNegativeInteger.
The ·canonical representation· for positiveInteger is defined by prohibiting certain options from the Lexical representation (§3.4.25.1). Specifically, the optional "+" sign is prohibited and leading zeroes are prohibited.
↓positiveInteger has the following ·constraining facets·:↓
↑positiveInteger and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
0
(fixed)↑collapse
(fixed)↑↑positiveInteger has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[\+]?[09]+
↑1
↑↑Datatypes derived by restriction from positiveInteger↑ may also specify values for the following↑ ·constraining facets·:↑
positiveInteger has the following values for its ·fundamental facets·:
[Definition:] yearMonthDuration is a datatype derived from duration by restricting its ·lexical representations· to instances of yearMonthDurationLexicalRep. The ·value space· of yearMonthDuration is therefore that of duration restricted to those whose ·seconds· property is 0. This results in a duration datatype which is totally ordered.
The lexical space is reduced from that of duration by disallowing duDayFrag and duTimeFrag fragments in the ·lexical representations·.
The lexical
space of yearMonthDuration consists of
strings which match the regular expression
'?P((([09]+Y)([09]+M)?)([09]+M))
' or the
expression '?P[09]+(Y([09]+M)?M)
', but the
formal definition of yearMonthDuration uses a
simpler regular expression in its ·pattern·
facet: '[^DT]*
'. This pattern matches only
strings of characters which contain no 'D'
and no 'T', thus restricting the ·lexical space·
of duration to strings with no day, hour,
minute, or seconds fields.
The ·canonical mapping· is that of duration restricted in its range to the ·lexical space· (which reduces its domain to omit any values not in the yearMonthDuration value space).
PT0S
')
is not in the
·lexical space· of yearMonthDuration.↓yearMonthDuration has the following ·constraining facets·:↓
↑yearMonthDuration and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑yearMonthDuration has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[^DT]*
↑↑Datatypes derived by restriction from yearMonthDuration↑ may also specify values for the following↑ ·constraining facets·:↑
yearMonthDuration has the following values for its ·fundamental facets·:
[Definition:] dayTimeDuration is a datatype derived from duration by restricting its ·lexical representations· to instances of dayTimeDurationLexicalRep. The ·value space· of dayTimeDuration is therefore that of duration restricted to those whose ·months· property is 0. This results in a duration datatype which is totally ordered.
The lexical space is reduced from that of duration by disallowing duYearFrag and duMonthFrag fragments in the ·lexical representations·.
The lexical space of
dayTimeDuration consists of
strings in the ·lexical space· of duration which
match the regular expression '[^YM]*[DT].*
';
this pattern eliminates all durations with year or month fields,
leaving only those with day, hour, minutes, and/or seconds
fields.
The ·canonical mapping· is that of duration restricted in its range to the ·lexical space· (which reduces its domain to omit any values not in the yearMonthDuration value space).
↓dayTimeDuration has the following ·constraining facets·:↓
↑dayTimeDuration and all datatypes derived from it by restriction have the following ·constraining facets·↑↑ with fixed values; these facets must not be changed from the values shown:↑
collapse
(fixed)↑↑dayTimeDuration has the following ·constraining facets·↑↑ with the values shown; these facets may be further restricted in the derivation of new types:↑
[^YM]*(T.*)?
↑↑Datatypes derived by restriction from dayTimeDuration↑ may also specify values for the following↑ ·constraining facets·:↑
dayTimeDuration has the following values for its ·fundamental facets·:
This section presents the mechanisms necessary to integrate datatypes into the context of [XML Schema Part 1: Structures], mostly in terms of the Schema Component abstraction introduced there. The account of datatypes given in this specification is also intended to be useful in other contexts. Any specification or other formal system intending to use datatypes as defined above, particularly if definition of new datatypes via facetbased restriction is envisaged, will need to provide analogous mechanisms for some, but not necessarily all, of what follows below. For example, the {target namespace} and {final} properties are required because of particular aspects of [XML Schema Part 1: Structures] which are not in principle necessary for the use of datatypes as defined here.
The following sections provide full details on the properties and significance of each kind of schema component involved in datatype definitions. For each property, the kinds of values it is allowed to have is specified. Any property not identified as optional is required to be present; optional properties which are not present have absent as their value. Any property identified as a having a set, subset or ·list· value may have an empty value unless this is explicitly ruled out: this is not the same as absent. Any property value identified as a superset or a subset of some set may be equal to that set, unless a proper superset or subset is explicitly called for.
For more information on the notion of ↓datatype (↓schema↓)↓ components, see Schema Component Details of [XML Schema Part 1: Structures].
↑[Definition:] A component may be referred to as the owner of its properties, and of the values of those properties.↑
Simple Type Definitions provide for:
The Simple Type Definition schema component has the following properties:
Either an Attribute Declaration, an Element Declaration, a Complex Type Definition or a Simple Type Definition.
If the datatype has been ·derived· by ·restriction· then the Simple Type Definition component from which it is ·derived·, otherwise the Simple Type Definition for anySimpleType (§4.1.6).
With one exception, the {base type definition} of any Simple Type Definition is a Simple Type Definition. The exception is ·anySimpleType·, which has anyType, a Complex Type Definition, as its {base type definition}.
↓Must be a↓↑If nonabsent, must be a ·primitive·↑ builtin definition.
Must not be empty if {variety} is union, otherwise must be absent.
↓Datatypes↓↑Simple type definitions↑ are identified by their {name} and {target namespace}. Except for anonymous ↓datatypes↓↑Simple Type Definitions↑ (those with no {name}), ↓datatype definitions↓↑Simple Type Definitions↑ ↓·must·↓↑must↑ be uniquely identified within a schema. ↑Within a valid schema, each Simple Type Definition uniquely determines one datatype. The ·value space·, ·lexical space·, ·lexical mapping·, etc., of a Simple Type Definition are the ·value space·, ·lexical space·, etc., of the datatype uniquely determined (or "defined") by that Simple Type Definition.↑
If {variety} is ·atomic· then the ·value space· of the datatype defined will be a subset of the ·value space· of {base type definition} (which is a subset of the ·value space· of {primitive type definition}). If {variety} is ·list· then the ·value space· of the datatype defined will be the set of finitelength sequence↑s↑ of values from the ·value space· of {item type definition}. If {variety} is ·union· then the ·value space· of the datatype defined will be↑ a subset (possibly an improper subset) of↑ the union of the ·value spaces· of each ↓datatype↓↑Simple Type Definition↑ in {member type definitions}.
If {variety} is ·atomic· then the {variety} of {base type definition} must be ·atomic·↑, unless the {base type definition} is anySimpleType↑. If {variety} is ·list· then the {variety} of {item type definition} must be either ·atomic· or ·union·↑, and if {item type definition} is ·union· then all its ·basic members· must be ·atomic·↑. If {variety} is ·union· then {member type definitions} must be a list of ↓datatype definitions↓↑Simple Type Definitions↑.
The value of {facets} consists of the set of ·facet·s specified directly in the datatype definition unioned with the possibly empty set of {facets} of {base type definition}.
The value of {fundamental facets} consists of the set of ·fundamental facet·s and their values.
The {facets} property determines the ·value space· and ·lexical space· of the datatype being defined by imposing constraints which must be satisfied by values and ·lexical representations·.
The {fundamental facets} property provides some basic information about the datatype being defined: its cardinality, whether an ordering is defined for it by this specification, whether it has upper and lower bounds, and whether it is numeric.
If {final} is the empty set then the type can be used in deriving other types; the explicit values restriction, list and union prevent further derivations↑ of Simple Type Definitions↑ by ↓·restriction·↓↑·facetbased restriction·↑, ·list· and ·union· respectively↓.↓↑; the explicit value extension prevents any derivation of Complex Type Definitions by extension.↑
The {context} property is only relevant for anonymous type definitions, for which its value is the component in which this type definition appears as the value of a property, e.g. {item type definition} or {base type definition}.
The XML representation for a Simple Type Definition schema component is a <simpleType> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
simpleType
Element Information Item<simpleType
final =
(#all  List of (list  union  restriction  extension))
id = ID
name = NCName
{any attributes with nonschema namespace . . .}>
Content: (annotation?, (restriction  list  union))
</simpleType>
<restriction
base = QName
id = ID
{any attributes with nonschema namespace . . .}>
Content: (annotation?, (simpleType?, (minExclusive  minInclusive  maxExclusive  maxInclusive  totalDigits  fractionDigits  maxScale  minScale  length  minLength  maxLength  enumeration  whiteSpace  pattern)*))
</restriction>
<list
id = ID
itemType = QName
{any attributes with nonschema namespace . . .}>
Content: (annotation?, simpleType?)
</list>
<union
id = ID
memberTypes = List of QName
{any attributes with nonschema namespace . . .}>
Content: (annotation?, simpleType*)
</union>
name
↓↑name
↑ [attribute], if
present↑ on the <simpleType> element↑,
otherwise ↓null↓↑absent↑
targetNamespace
↓↑targetNamespace
↑ [attribute]
of the parent ↓schema
↓↑schema
↑ element information
item↑, if present,
otherwise absent↑.base
[attribute] of <restriction>,
if present, otherwise the
type definition corresponding to the <simpleType> among
the [children] of <restriction>.final
[attribute],
if present, otherwise the actual value of the
finalDefault
[attribute] of the ancestor
schema
element information item,
if present,
otherwise the empty string, as follows:
#all
finalDefault
[attribute] of
schema may include
values other than
restriction, list or union, those values
are ignored in the determination of {final}
{
restriction, extension, list,
union}
, determined as follows.
[Definition:] Let
FS be
the actual value of the
final
[attribute],
if present, otherwise the actual value of the
finalDefault
[attribute] of the ancestor
schema
element,
if present, otherwise the empty string. Then the property value is
the appropriate case among the following:
SKU
'
(the barcode number that appears on products) from the
·builtin· datatype string by
supplying a value for the ·pattern· facet.
<simpleType name='SKU'> <restriction base='string'> <pattern value='\d{3}[AZ]{2}'/> </restriction> </simpleType>
SKU
' is the name of the new
·userdefined· datatype, string is
its ·base type·
and
·pattern· is the facet.
itemType
[attribute] of <list>,
or (b)
corresponding to the <simpleType> among
the [children] of <list>, whichever is present.
itemType
[attribute] or a <simpleType> [child], but not both.<simpleType name='listOfFloat'> <list itemType='float'/> </simpleType>
memberTypes
[attribute] of <union>, if
any, and (b) those corresponding to the <simpleType>s
among the [children] of <union>, if any, in order.
memberTypes
[attribute] or one or more <simpleType> [children],
or both.Editorial Note: Priority Feedback Request
Note that the rule just given allows ·unions· to be members of other
·unions·. This is a change from version 1.0 of this specification,
which prohibited ·unions· in {member type definitions} and replaced
any reference to a ·union· M, in the XML declaration of a
second ·union· U, with the members of M. This
had the unintended consequence that that if M had facets
they were lost, and U erroneously accepted values not
accepted by M. In order to correct this error, this
version of this specification allows ·unions· in
{member type definitions} and removes the wording which replaced
references to ·unions· with their members.
The XML Schema Working Group solicits input from implementors and
users of this specification as to whether this change is an acceptable
way of repairing the problem in version 1.0 of this specification, or
whether it would be preferable to allow ·unions· as members of other
·unions· only if they have an empty {facets} property. If such a
change would make this specification more (or less) attractive to
users or implementors, please let us know.
<xsd:attribute name="size"> <xsd:simpleType> <xsd:union> <xsd:simpleType> <xsd:restriction base="xsd:positiveInteger"> <xsd:minInclusive value="8"/> <xsd:maxInclusive value="72"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType> <xsd:restriction base="xsd:NMTOKEN"> <xsd:enumeration value="small"/> <xsd:enumeration value="medium"/> <xsd:enumeration value="large"/> </xsd:restriction> </xsd:simpleType> </xsd:union> </xsd:simpleType> </xsd:attribute>
<p> <font size='large'>A header</font> </p> <p> <font size='12'>this is a test</font> </p>
A ↓·derived·↓ datatype can be ↓·derived·↓↑·constructed·↑ from a ·primitive· datatype or ↓another derived↓↑an ·ordinary·↑ datatype by one of three means: by ↓restriction↓↑·facetbased restriction·↑, by ↓list↓↑·list·↑ or by ↓union↓↑·union·↑.
base
[attribute]
or the <simpleType> [children],
whichever is present.
<simpleType name='Sku'> <restriction base='string'> <pattern value='\d{3}[AZ]{2}'/> </restriction> </simpleType>
itemType
[attribute]
or the <simpleType> [children],
whichever is present.
A ·list· datatype must be ·derived· from an ·atomic· or a ·union· datatype, known as the ·item type· of the ·list· datatype. This yields a datatype whose ·value space· is composed of finitelength sequences of values from the ·value space· of the ·item type· and whose ·lexical space· is composed of spaceseparated lists of ·literals· of the ·item type·.
<simpleType name='listOfFloat'> <list itemType='float'/> </simpleType>
As mentioned in List Datatypes (§2.6.1.2), when a datatype is derived from a ·list· datatype, the following ·constraining facets· can be used:
regardless of the ·constraining facets· that are applicable to the ·atomic· datatype that serves as the ·item type· of the ·list·.
For each of ·length·, ·maxLength· and ·minLength·, the unit of length is measured in number of list items. The value of ·whiteSpace· is fixed to the value collapse.
memberTypes
[attribute], if any,
in order, followed by the Simple Type Definition components
resolved to by the
<simpleType> [children], if any, in order.
If {variety} is union for
any Simple Type Definition components resolved
to above, then
the Simple Type Definition is replaced by its
{member type definitions}.
A ·union· datatype can be ·derived· from one or more ·atomic·, ·list· or other ·union· datatypes, known as the ·member types· of that ·union· datatype.
<xsd:attribute name="size"> <xsd:simpleType> <xsd:union> <xsd:simpleType> <xsd:restriction base="xsd:positiveInteger"> <xsd:minInclusive value="8"/> <xsd:maxInclusive value="72"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType> <xsd:restriction base="xsd:NMTOKEN"> <xsd:enumeration value="small"/> <xsd:enumeration value="medium"/> <xsd:enumeration value="large"/> </xsd:restriction> </xsd:simpleType> </xsd:union> </xsd:simpleType> </xsd:attribute>
<p> <font size='large'>A header</font> </p> <p> <font size='12'>this is a test</font> </p>
As mentioned in Union datatypes (§2.6.1.3), when a datatype is derived from a ·union· datatype, the only following ·constraining facets· can be used:
regardless of the ·constraining facets· that are applicable to the datatypes that participate in the ·union·
itemType
[attribute] or the
<simpleType> [child] of the <list> element
must be present, but not both.
base
[attribute] or the
simpleType
[child] of the <restriction>
element must be present, but not both.
memberTypes
[attribute] of the <union>
element must be nonempty or
there must be at least one simpleType
[child].
That is, the constraints on Simple Type Definitions and on datatype derivation defined in this specification have as a consequence that a ·literal· L is datatypevalid with respect to a Simple Type Definition T if and only if either T corresponds to a ·special· datatype or all of the following are true:
Note that whiteSpace facets do not take part in checking Datatype Valid. In cases where this specification is used in conjunction with schemavalidation of XML documents, whiteSpace facets are used to normalize infoset values before the normalized results are checked for datatype validity. In the case of unions the whiteSpace facet to use is the one associated with B in clause 2.3 above.
If {variety} is absent, then no facets are applicable. (This is true for anySimpleType.)
If {variety} is list, then the applicable facets are length, minLength, maxLength, pattern, enumeration, and whiteSpace.
If {variety} is union, then the applicable facets are pattern and enumeration.
If {variety} is atomic, and {primitive type definition} is absent then no facets are applicable. (This is true for anyAtomicType.)
In all other cases ({variety} is atomic and {primitive type definition} is not absent), then the applicable facets are shown in the table below.
There is a simple type definition nearly equivalent to the simple version of the urtype definition present in every schema by definition. It has the following properties:
The Simple Type Definition of anySimpleType is present in every schema. It has the following properties:
anySimpleType
'http://www.w3.org/2001/XMLSchema
'The definition of anySimpleType is the root of the Simple Type Definition hierarchy; as such it mediates between the other simple type definitions, which all eventually trace back to it via their {base type definition} properties, and the definition of anyType, which is its {base type definition}.
The Simple Type Definition of anyAtomicType is present in every schema. It has the following properties:
anyAtomicType
'http://www.w3.org/2001/XMLSchema
'Simple type definitions for all the builtin primitive datatypes, namely string, boolean, float, double, decimal, precisionDecimal, dateTime, duration, time, date, gMonth, gMonthDay, gDay, gYear, gYearMonth, hexBinary, base64Binary, anyURI are present by definition in every schema. All have a very similar structure, with only the {name}, the {base type definition} (which is selfreferential), the {fundamental facets} and in one case the {facets} varying from one to the next:
http://www.w3.org/2001/XMLSchema
'Similarly, Simple Type Definitions for all the builtin ·ordinary· datatypes are present by definition in every schema, with properties as specified in ↓Derived datatypes↓↑Other Builtin Datatypes↑ (§3.4) and as represented in XML in ↑Illustrative XML representations for the builtin ordinary type definitions↑ (§C.2).
http://www.w3.org/2001/XMLSchema
'[Definition:] Each fundamental facet is a schema component that provides a limited piece of information about some aspect of each datatype. For example, cardinality is a ·fundamental facet·. Most ·fundamental facets· are given a value fixed with each primitive datatype's definition, and this value is not changed by subsequent ·derivations· (even when it would perhaps be reasonable to expect an application to give a more accurate value based on the constraining facets used to define the ·derivation·). The cardinality and bounded facets are exceptions to this rule; their values may change as a result of certain ·derivations·.
The term [Definition:] Fundamental Facet refers to any of the components defined in this section.
A ·fundamental facet· can occur only in the {fundamental facets} of a Simple Type Definition, and this is the only place where ·fundamental facet· components occur. Each kind of ·fundamental facet· component occurs (once) in each Simple Type Definition's {fundamental facets} set.
Every ·value space· supports the notion of equality, with the following rules:
On every datatype, the operation Equal is defined in terms of the equality property of the ·value space·: for any values a, b drawn from the ·value space·, Equal(a,b) is true if a = b, and false otherwise.
Note that in consequence of the above:
[Definition:] An order relation on a ·value space· is a mathematical relation that imposes a ·total order· or a ·partial order· on the members of the ·value space·.
[Definition:] A ·value space·, and hence a datatype, is said to be ordered if there exists an ·orderrelation· defined for that ·value space·.
[Definition:] A partial order is an ·orderrelation· that is irreflexive, asymmetric and transitive.
A ·partial order· has the following properties:
The notation a <> b is used to indicate the case when a != b and neither a < b nor b < a. For any values a and b from different ·primitive· ·value spaces·, a <> b.
[Definition:] When a <> b, a and b are incomparable,[Definition:] otherwise they are comparable.
[Definition:] A total order is an ·partial order· such that for no a and b is it the case that a <> b.
A ·total order· has all of the properties specified above for ·partial order·, plus the following property:
·ordered· provides for:
Some datatypes have a nontrivial order relation associated with their value spaces (see Order (§2.2.3)). (There is always a trivial partial ordering wherein every value pair that is not equal is incomparable, which could be associated with any value space.) The ordered facet value is a "nearboolean": one of false, partial, and total, as prescribed in Fundamental Facets (§F.1) for ·primitive· datatypes; all ·ordinary· datatypes inherit this value without change. The value for a ·list· is always false and the value for a ·union· is computed as described below.
A false value means no order is prescribed; a total value assures that the prescribed order is a total order; a partial value means that the prescribed order is a partial order, but not (for the primitive type in question) a total order. Derivation of new datatypes from datatypes with partial orders may impose constraints which make the effective ordering either a trivial order or a nontrivial total order, but the value of the ordered facet is not changed to reflect this.
[Definition:] A ·value space·, and hence a datatype, is said to be ordered if this specification prescribes a nontrivial order for that ·value space·.
{value} depends on {variety}, {facets} and {member type definitions} in the Simple Type Definition component in which a ·ordered· component appears as a member of {fundamental facets}.
When {variety} is ·atomic·, {value} is inherited from {value} of {base type definition}. For all ·primitive· types {value} is as specified in the table in Fundamental Facets (§F.1).
{value} depends on the ·owner's· {variety}, {facets}, and {member type definitions}.
The appropriate case among the following must be true:
[Definition:] A value u in an ·ordered· ·value space· U is said to be an inclusive upper bound of a ·value space· V (where V is a subset of U) if for all v in V, u >= v.
[Definition:] A value u in an ·ordered· ·value space· U is said to be an exclusive upper bound of a ·value space· V (where V is a subset of U) if for all v in V, u > v.
[Definition:] A value l in an ·ordered· ·value space· L is said to be an inclusive lower bound of a ·value space· V (where V is a subset of L) if for all v in V, l <= v.
[Definition:] A value l in an ·ordered· ·value space· L is said to be an exclusive lower bound of a ·value space· V (where V is a subset of L) if for all v in V, l < v.
[Definition:] A datatype is bounded if its ·value space· has either an ·inclusive upper bound· or an ·exclusive upper bound· and either an ·inclusive lower bound· or an ·exclusive lower bound·.
·bounded· provides for:
Some ordered datatypes have the property that there is one value greater than or equal to every other value, and another that is less than or equal to every other value. (In the case of ·ordinary· datatypes, these two values are not necessarily in the value space of the derived datatype, but they must be in the value space of the primitive datatype from which they have been derived.) The bounded facet value is boolean and is generally true for such bounded datatypes. However, it will remain false when the mechanism for imposing such a bound is difficult to detect, as, for example, when the boundedness occurs because of derivation using a pattern component.
{value} depends on ↑the ·owner's·↑ {variety}, {facets} and {member type definitions}↓ in the Simple Type Definition component in which a bounded component appears as a member of {fundamental facets}↓.
When ↑the ·owner· is ·primitive·, {value} is as specified in the table in Fundamental Facets (§F.1). Otherwise, when the ·owner's·↑ {variety} is atomic, if one of minInclusive or minExclusive and one of maxInclusive or maxExclusive are ↓among {facets}↓↑members of the ·owner's· {facets} set↑, then {value} is true; ↓else↓↑otherwise↑ {value} is false.
When ↑the ·owner's· ↑{variety} is list, ↓if ·length· or both of ·minLength· and ·maxLength· are among {facets}, then {value} is true; else↓ {value} is false.
When the ↑·owner's· ↑{variety} is union, if {value} is true for every member of ↓{member type definitions}and all members of {member type definitions}↓↑the ·owner's· {member type definitions} set and ↑↓ share a common ancestor↓↑all of the ·owner's· ·basic members· have the same {primitive type definition}↑, then {value} is true; ↓else↓↑otherwise↑ {value} is false.
[Definition:] Every ·value space· has associated with it the concept of cardinality. Some ·value spaces· are finite, some are countably infinite while still others could conceivably be uncountably infinite (although no ·value space· defined by this specification is uncountable infinite). A datatype is said to have the cardinality of its ·value space·.
It is sometimes useful to categorize ·value spaces· (and hence, datatypes) as to their cardinality. There are two significant cases:
·cardinality· provides for:
Every value space has a specific number of members. This number can be characterized as finite or infinite. (Currently there are no datatypes with infinite value spaces larger than countable.) The cardinality facet value is either finite or countably infinite and is generally finite for datatypes with finite value spaces. However, it will remain countably infinite when the mechanism for causing finiteness is difficult to detect, as, for example, when finiteness occurs because of a derivation using a pattern component.
{value} depends on ↑the ·owner's· ↑{variety}, {facets}, and {member type definitions}↓ in the Simple Type Definition component in which a cardinality component appears as a member of {fundamental facets}↓.
When {variety} is ·atomic· and {value} of {base type definition} is finite, then {value} is finite.
When the ·owner· is ·primitive·, {value} is as specified in the table in Fundamental Facets (§F.1). Otherwise, when the ·owner's· {variety} is atomic, {value} is countably infinite unless any of the following conditions are true, in which case {value} is finite:
When ↑the ·owner's·↑ {variety} is list, if length or both ↓of ↓minLength and maxLength are ↓among {facets}↓↑members of the ·owner's· {facets} set and the ·owner's· {item type definition}'s cardinality {value} is finite↑ then {value} is finite; ↓else↓↑otherwise↑ {value} is countably infinite.
When the ·↓parent's↓↑owner's↑· {variety} is union, if cardinality's {value} is finite for every member of ↑the ·owner's· ↑{member type definitions}↑ set↑ then {value} is finite, ↓else↓↑otherwise↑ {value} is countably infinite.
[Definition:] A datatype is said to be numeric if its values are conceptually quantities (in some mathematical number system).
[Definition:] A datatype whose values are not ·numeric· is said to be nonnumeric.
·numeric· provides for:
Some value spaces are made up of things that are conceptually numeric, others are not. The numeric facet value indicates which are considered numeric.
{value} depends on ↑the ·owner's· ↑{variety}, {facets}, {base type definition} and {member type definitions}↓ in the Simple Type Definition component in which a ·cardinality· component appears as a member of {fundamental facets}↓.
When ↑the ·owner· is ·primitive·, {value} is as specified in the table in Fundamental Facets (§F.1). Otherwise, when the ·owner's· ↑{variety} is atomic, {value} is inherited from ↑the ·owner's· {base type definition}'s numeric↑{value}↓ of {base type definition}. For all ·primitive· types {value} is as specified in the table in Fundamental Facets (§F.1)↓.
When ↑the ·owner's· ↑{variety} is list, {value} is false.
When ↑the ·owner's· ↑{variety} is union, if ↑numeric's ↑{value} is true for every member of ↑the ·owner's· ↑{member type definitions}↑ set↑ then {value} is true, ↓else↓↑otherwise↑ {value} is false.
[Definition:] constraining facets are schema components whose values may be set or changed during ·derivation· (subject to facetspecific controls) to control various aspects of the derived datatype. For example, whiteSpace is a ·constraining facet·. ·Constraining Facets· are given a value as part of the ·derivation· when an ·ordinary· datatype is defined by ·restricting· a ·primitive· or ·ordinary· datatype; a few ·constraining facets· have default values that are also provided for ·primitive· datatypes.
The term [Definition:] Constraining Facet refers to any of the components defined in this section.
[Definition:] length is the number of units of length, where units of length varies depending on the type that is being derived from. The value of length ·must· be a nonNegativeInteger.
For string and datatypes derived from string, length is measured in units of characters as defined in [XML]. For anyURI, length is measured in units of characters (as for string). For hexBinary and base64Binary and datatypes derived from them, length is measured in octets (8 bits) of binary data. For datatypes ↓·derived·↓↑·constructed·↑ by ·list·, length is measured in number of list items.
·length· provides for:
<simpleType name='productCode'> <restriction base='string'> <length value='8' fixed='true'/> </restriction> </simpleType>
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for length other than {value}.
The XML representation for a length schema component is a <length> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
length
Element Information Item<length
fixed = boolean : false
id = ID
value = nonNegativeInteger
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</length>
The use of ·length· on ↓datatypes derived from QName and NOTATION↓↑QName, NOTATION, and datatypes derived from them↑ is deprecated. Future versions of this specification may remove this facet for these datatypes.
[Definition:] minLength is the minimum number of units of length, where units of length varies depending on the type that is being derived from. The value of minLength ·must· be a nonNegativeInteger.
For string and datatypes derived from string, minLength is measured in units of characters as defined in [XML]. For hexBinary and base64Binary and datatypes derived from them, minLength is measured in octets (8 bits) of binary data. For datatypes ↓·derived·↓↑·constructed·↑ by ·list·, minLength is measured in number of list items.
·minLength· provides for:
<simpleType name='nonemptystring'> <restriction base='string'> <minLength value='1'/> </restriction> </simpleType>
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for minLength other than {value}.
The XML representation for a minLength schema component is a <minLength> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
minLength
Element Information Item<minLength
fixed = boolean : false
id = ID
value = nonNegativeInteger
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</minLength>
The use of ·minLength· on ↓datatypes derived from QName and NOTATION↓↑QName, NOTATION, and datatypes derived from them↑ is deprecated. Future versions of this specification may remove this facet for these datatypes.
[Definition:] maxLength is the maximum number of units of length, where units of length varies depending on the type that is being derived from. The value of maxLength ·must· be a nonNegativeInteger.
For string and datatypes derived from string, maxLength is measured in units of characters as defined in [XML]. For hexBinary and base64Binary and datatypes derived from them, maxLength is measured in octets (8 bits) of binary data. For datatypes ↓·derived·↓↑·constructed·↑ by ·list·, maxLength is measured in number of list items.
·maxLength· provides for:
<simpleType name='forminput'> <restriction base='string'> <maxLength value='50'/> </restriction> </simpleType>
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for maxLength other than {value}.
The XML representation for a maxLength schema component is a <maxLength> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
maxLength
Element Information Item<maxLength
fixed = boolean : false
id = ID
value = nonNegativeInteger
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</maxLength>
The use of ·maxLength· on ↓datatypes derived from QName and NOTATION↓↑QName, NOTATION, and datatypes derived from them↑ is deprecated. Future versions of this specification may remove this facet for these datatypes.
[Definition:] pattern is a constraint on the ·value space· of a datatype which is achieved by constraining the ·lexical space· to ·literals· which match ↓a specific pattern↓↑each member of a set of patterns↑. The value of pattern ↓·must·↓↑must↑ be a ↑set of ·regular expressions·↑.
·pattern· provides for:
<simpleType name='betteruszipcode'> <restriction base='string'> <pattern value='[09]{5}([09]{4})?'/> </restriction> </simpleType>
The XML representation for a pattern schema component is a <pattern> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
pattern
Element Information Item<pattern
id = ID
value = string
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</pattern>
value
[attribute].↓
value
[attribute]value
[attributes], in order,
separated by '
', so forming a single regular expression with multiple
·branches·.Thus, to impose two ·pattern· constraints simultaneously, schema authors may either write a single ·pattern· which expresses the intersection of the two ·pattern·s they wish to impose, or define each ·pattern· on a separate type derivation step.
value
[attribute] must be a
·regular expression· as
defined in Regular Expressions (§I).Thus, to impose two pattern constraints simultaneously, schema authors may either write a single pattern which expresses the intersection of the two patterns they wish to impose, or define each pattern on a separate type derivation step.
[Definition:] enumeration constrains the ·value space· to a specified set of values.
enumeration does not impose an order relation on the ·value space· it creates; the value of the ·ordered· property of the derived datatype remains that of the datatype from which it is derived.
·enumeration· provides for:
<simpleType name='holidays'> <annotation> <documentation>some US holidays</documentation> </annotation> <restriction base='gMonthDay'> <enumeration value='0101'> <annotation> <documentation>New Year's day</documentation> </annotation> </enumeration> <enumeration value='0704'> <annotation> <documentation>4th of July</documentation> </annotation> </enumeration> <enumeration value='1225'> <annotation> <documentation>Christmas</documentation> </annotation> </enumeration> </restriction> </simpleType>
The XML representation for an enumeration schema component is an <enumeration> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
enumeration
Element Information Item<enumeration
id = ID
value = anySimpleType
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</enumeration>
value
[attribute].value
[attribute] must be
Datatype Valid (§4.1.4) with respect to the
{base type definition} of the Simple Type Definition
corresponding to the
nearest
<simpleType> ancestor
element.[Definition:] whiteSpace constrains the ·value space· of types derived from string such that the various behaviors specified in Attribute Value Normalization in [XML] are realized. The value of whiteSpace must be one of {preserve, replace, collapse}.
hexadecimal A
(line feed), which is denoted by
U+000A. This notation is to be distinguished from

, which is the XML character reference to that same UCS
code point.
whiteSpace is applicable to all ·atomic· and
·list· datatypes. For all ·atomic·
datatypes other than string (and types derived
by ↓·restriction·↓↑·facetbased restriction·↑ from it) the value of whiteSpace is
collapse
and cannot be changed by a schema author; for
string the value of whiteSpace is
preserve
; for any type derived by
↓·restriction·↓↑·facetbased restriction·↑ from
string the value of whiteSpace can
be any of the three legal values. For all datatypes
↓·derived·↓↑·constructed·↑ by ·list· the
value of whiteSpace is collapse
and cannot
be changed by a schema author. For all datatypes
↓·derived·↓↑·constructed·↑ by ·union·
whiteSpace does not apply directly; however, the
normalization behavior of ·union· types is controlled by
the value of whiteSpace on that one of the
↓·member types·↓↑·basic members·↑
against which the ·union·
is successfully validated.
·whiteSpace· provides for:
<simpleType name='token'> <restriction base='normalizedString'> <whiteSpace value='collapse'/> </restriction> </simpleType>
replace
" and
"collapse
" may appear to provide a
convenient way to "unwrap" text (i.e. undo the effects of
prettyprinting and wordwrapping). In some cases, especially
highly constrained data consisting of lists of artificial tokens
such as part numbers or other identifiers, this appearance is
correct. For naturallanguage data, however, the whitespace
processing prescribed for these values is not only unreliable but
will systematically remove the information needed to perform
unwrapping correctly. For Asian scripts, for example, a correct
unwrapping process will replace line boundaries not with blanks but
with zerowidth separators or nothing. In consequence, it is
normally unwise to use these values for naturallanguage data, or
for any data other than lists of highly constrained tokens.If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for whiteSpace other than {value}.
The XML representation for a whiteSpace schema component is a <whiteSpace> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
whiteSpace
Element Information Item<whiteSpace
fixed = boolean : false
id = ID
value = (collapse  preserve  replace)
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</whiteSpace>
[Definition:] maxInclusive is the ↓·inclusive upper bound·↓↑inclusive upper bound↑ of the ·value space· for a datatype with the ·ordered· property. The value of maxInclusive ·must· be ↑equal to some value↑ in the ·value space· of the ·base type·.
·maxInclusive· provides for:
<simpleType name='onehundredorless'> <restriction base='integer'> <maxInclusive value='100'/> </restriction> </simpleType>
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for maxInclusive other than {value}.
The XML representation for a maxInclusive schema component is a <maxInclusive> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
maxInclusive
Element Information Item<maxInclusive
fixed = boolean : false
id = ID
value = anySimpleType
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</maxInclusive>
fixed
[attribute], if present, otherwise false
↓, if present, otherwise false↓
[Definition:] maxExclusive is the ↓·exclusive upper bound·↓ ↑exclusive upper bound↑ of the ·value space· for a datatype with the ·ordered· property. The value of maxExclusive ·must· be ↑equal to some value↑ in the ·value space· of the ·base type· or be equal to {value} in {base type definition}.
·maxExclusive· provides for:
<simpleType name='lessthanonehundredandone'> <restriction base='integer'> <maxExclusive value='101'/> </restriction> </simpleType>
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for maxExclusive other than {value}.
The XML representation for a maxExclusive schema component is a <maxExclusive> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
maxExclusive
Element Information Item<maxExclusive
fixed = boolean : false
id = ID
value = anySimpleType
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</maxExclusive>
[Definition:] minExclusive is the ↓·exclusive lower bound·↓ ↑exclusive lower bound↑ of the ·value space· for a datatype with the ·ordered· property. The value of minExclusive ·must· be ↑equal to some value↑ in the ·value space· of the ·base type· or be equal to {value} in {base type definition}.
·minExclusive· provides for:
<simpleType name='morethanninetynine'> <restriction base='integer'> <minExclusive value='99'/> </restriction> </simpleType>
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for minExclusive other than {value}.
The XML representation for a minExclusive schema component is a <minExclusive> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
minExclusive
Element Information Item<minExclusive
fixed = boolean : false
id = ID
value = anySimpleType
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</minExclusive>
[Definition:] minInclusive is the ↓·inclusive lower bound·↓ ↑inclusive lower bound↑ of the ·value space· for a datatype with the ·ordered· property. The value of minInclusive ·must· be ↑equal to some value↑ in the ·value space· of the ·base type·.
·minInclusive· provides for:
<simpleType name='onehundredormore'> <restriction base='integer'> <minInclusive value='100'/> </restriction> </simpleType>
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for minInclusive other than {value}.
The XML representation for a minInclusive schema component is a <minInclusive> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
minInclusive
Element Information Item<minInclusive
fixed = boolean : false
id = ID
value = anySimpleType
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</minInclusive>
[Definition:] totalDigits controls the maximum number of values in the ·value space· of datatypes derived from decimal, by restricting it to numbers that are expressible as i × 10^n where i and n are integers such that i < 10^totalDigits and 0 <= n <= totalDigits. The value of totalDigits ·must· be a positiveInteger.
[Definition:] totalDigits restricts the magnitude and ·arithmetic precision· of values in the ·value spaces· of precisionDecimal and decimal and datatypes derived from them. The effect must be described separately for the two primitive types.
For decimal, if the {value} of totalDigits is t, the effect is to require that values be equal to i / 10^{n}, for some integers i and n, with  i  < 10^{t} and 0 ≤ n ≤ t. This has as a consequence that the values are expressible using at most t digits in decimal notation.
For precisionDecimal, values with ·numericalValue· of nV and ·arithmeticPrecision· of aP, if the {value} of totalDigits is t, the effect is to require that (aP + 1 + log_{10}( nV ) ·div· 1) ≤ t, for values other than zero, NaN, and the infinities. This means in effect that values are expressible in scientific notation using at most t digits for the coefficient.
The {value} of totalDigits must be a positiveInteger.
The term 'totalDigits' is chosen to reflect the fact that it restricts the ·value space· to those values that can be represented lexically using at most totalDigits digits↑ in decimal notation, or at most totalDigits digits for the coefficient, in scientific notation↑. Note that it does not restrict the ·lexical space· directly; a lexical representation that adds ↓additional leading zero digits or trailing fractional↓↑nonsignificant leading or trailing↑ zero digits is still permitted. ↑It also has no effect on the values NaN, INF, and INF.↑
If {fixed} is true, then types for which the current type is the {base type definition} ↓cannot↓ ↑must not↑ specify a value for totalDigits other than {value}.
The XML representation for a totalDigits schema component is a <totalDigits> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
totalDigits
Element Information Item<totalDigits
fixed = boolean : false
id = ID
value = positiveInteger
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</totalDigits>
[Definition:] fractionDigits ↓controls the size of the minimum difference between values in the ·value space· of datatypes derived from decimal, by restricting the ·value space· to numbers that are expressible as i × 10^n where i and n are integers and 0 <= n <= fractionDigits.↓↑places an upper limit on the ·arithmetic precision· of decimal values: if the {value} of fractionDigits = f, then the value space is restricted to values equal to i / 10^{n} for some integers i and n and 0 ≤ n ≤ f.↑ The value of fractionDigits ·must· be a nonNegativeInteger
The term fractionDigits is chosen to reflect the fact that it restricts the ·value space· to those values that can be represented lexically ↑in decimal notation↑ using at most fractionDigits to the right of the decimal point. Note that it does not restrict the ·lexical space· directly; a ↓non·canonical representation·↓↑lexical representation↑ that adds ↓additional leading zero digits or nonsignificant trailing fractional↓↑nonsignificant leading or trailing↑ zero digits is still permitted.
<simpleType name='celsiusBodyTemp'> <restriction base='decimal'> <totalDigits value='4'/> <fractionDigits value='1'/> <minInclusive value='36.4'/> <maxInclusive value='40.5'/> </restriction> </simpleType>
If {fixed} is true, then types for which the current type is the {base type definition} ↓cannot↓↑must not↑ specify a value for fractionDigits other than {value}.
The XML representation for a fractionDigits schema component is a <fractionDigits> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
fractionDigits
Element Information Item<fractionDigits
fixed = boolean : false
id = ID
value = nonNegativeInteger
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</fractionDigits>
[Definition:] maxScale places an upper limit on the ·arithmetic precision· of precisionDecimal values: if the {value} of maxScale = m, then only values with ·arithmeticPrecision· ≤ m are retained in the ·value space·. As a consequence, every value in the value space will have ·numericalValue· equal to i / 10^{n} for some integers i and n, with n ≤ m. The {value} of maxScale must be an integer. If it is negative, the numeric values of the datatype are restricted to multiples of 10 (or 100, or …).
The term 'maxScale' is chosen to reflect the fact that it restricts the ·value space· to those values that can be represented lexically in scientific notation using an integer coefficient and a scale (or negative exponent) no greater than maxScale. (It has nothing to do with the use of the term 'scale' to denote the radix or base of a notation.) Note that maxScale does not restrict the ·lexical space· directly; a lexical representation that adds nonsignificant leading or trailing zero digits, or that uses a lower exponent with a noninteger coefficient is still permitted.
<simpleType name='decimal32'> <restriction base='precisionDecimal'> <totalDigits value='7'/> <maxScale value='95'/> <minScale value='96'/> </restriction> </simpleType>
If {fixed} is true, then types for which the current type is the {base type definition} must not specify a value for maxScale other than {value}.
The XML representation for a maxScale schema component is a <maxScale> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
maxScale
Element Information Item<maxScale
fixed = boolean : false
id = ID
value = integer
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</maxScale>
[Definition:] minScale places a lower limit on the ·arithmetic precision· of precisionDecimal values. If the {value} of minScale is m, then the value space is restricted to values with ·arithmeticPrecision· ≥ m. As a consequence, every value in the value space will have ·numericalValue· equal to i / 10^{n} for some integers i and n, with n ≥ m.
The term minScale is chosen to reflect the fact that it restricts the ·value space· to those values that can be represented lexically in exponential form using an integer coefficient and a scale (negative exponent) at least as large as minScale. Note that it does not restrict the ·lexical space· directly; a lexical representation that adds additional leading zero digits, or that uses a larger exponent (and a correspondingly smaller coefficient) is still permitted.
DECIMAL(8,2)
. The effect is to allow values
between 999,999.99 and 999,999.99, with a fixed interval
of 0.01 between values.
<simpleType name='price'> <restriction base='precisionDecimal'> <totalDigits value='8'/> <minScale value='2'/> <maxScale value='2'/> </restriction> </simpleType>
If {fixed} is true, then types for which the current type is the {base type definition} must not specify a value for minScale other than {value}.
The XML representation for a minScale schema component is a <minScale> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
minScale
Element Information Item<minScale
fixed = boolean : false
id = ID
value = integer
{any attributes with nonschema namespace . . .}>
Content: (annotation?)
</minScale>
Note that it is not an error for minScale to be greater than totalDigits.
[Definition:] Minimally conforming processors ·must· completely and correctly implement the ·Constraint on Schemas· and ·Validation Rule·.
[Definition:] Processors which accept schemas in the form of XML documents as described in XML Representation of Simple Type Definition Schema Components (§4.1.2) (and other relevant portions of Datatype components (§4)) are additionally said to provide conformance to the XML Representation of Schemas, and ·must·, when processing schema documents, completely and correctly implement all ·Schema Representation Constraint·s in this specification, and ·must· adhere exactly to the specifications in XML Representation of Simple Type Definition Schema Components (§4.1.2) (and other relevant portions of Datatype components (§4)) for mapping the contents of such documents to schema components for use in validation.
Some ·primitive· datatypes defined in this specification have infinite ·value spaces·; no finite implementation can completely handle all their possible values. For some such datatypes, minimum implementation limits are specified below. For other infinite types such as string, hexBinary, and base64Binary, no minimum implementation limits are specified.
When this specification is used in the context of other languages (as it is, for example, by [XML Schema Part 1: Structures]), the host language may specify other minimum implementation limits.
When presented with a literal or value exceeding the capacity of its partial implementation of a datatype, a minimally conforming implementation of this specification will sometimes be unable to determine with certainty whether the value is datatypevalid or not. Sometimes it will be unable to represent the value correctly through its interface to any downsteam application.
When either of these is so, a conforming processor must indicate to the user and/or downstream application that it cannot process the input data with assured correctness (much as it would indicate if it ran out of memory). When the datatype validity of a value or literal is uncertain because it exceeds the capacity of a partial implementation, the literal or value must not be treated as invalid, and the unsupported value must not be quietly changed to a supported value.
This specification does not constrain the method used to indicate that a literal or value in the input data has exceeded the capacity of the implementation, or the form such indications take.
·Minimally conforming· processors which set an application or implementationdefined limit on the size of the values supported must clearly document that limit.
These are the partialimplementation ·minimal conformance· requirements:
Editorial Note: Priority Feedback Request
The XML Schema Working Group requests feedback from implementors and users of XML Schema concerning the minimum and recommended implementation limits for precisionDecimal. If other limits, larger or smaller, would make this datatype more attractive to users or implementors, please let us know.