This document is also available in these non-normative 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 built-in datatypes only, in a separate namespace, Independent copy of the DTD for schema documents, and List of translations.
Copyright © 2005 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, and document use rules apply.
XML Schema: Datatypes is part 2 of the specification of the XML Schema language. It defines facilities for defining datatypes to be used in XML Schemas as well as other XML specifications. The datatype language, which is itself represented in XML, provides a superset of the capabilities found in XML document type definitions (DTDs) for specifying datatypes on elements and attributes.
Issue (RQ-152i):RQ-152 (xml1.1)How should this specification be aligned with XML 1.1? The changes in character set and name characters, and the question of what determines which ones to use, must be addressed.
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 Public Working Draft of XML Schema 1.1. 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.
For those primarily interested in the changes since version 1.0, the Changes since version 1.0 (§I) 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. Accompanying versions of this document display in color all changes to normative text since version 1.0 and since the previous Working Draft.
This draft was published on 24 February 2005. The major changes are:
Please send comments on this Working Draft to www-xml-schema-comments@w3.org (archive).
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.
Patent disclosures relevant to this specification may be found on the Working Group's Patent disclosure page in conformance with the W3C Patent Policy of 5 February 2004. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) with respect to this specification should 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.
Text in this document which does not now have Working Group consensus is marked: ||this way||.
1 Introduction
1.1 Introduction to Version 1.1
1.2 Purpose
1.3 Requirements
1.4 Scope
1.5 Terminology
1.6 Constraints and Contributions
2 Datatype System
2.1 Datatype
2.2 Value space
2.3 The Lexical Space and Lexical Mapping
2.4 Datatype dichotomies
3 Built-in datatypes
3.1 Namespace considerations
3.2 Primitive datatypes
3.3 Derived datatypes
4 Datatype components
4.1 Simple Type Definition
4.2 Fundamental Facets
4.3 Constraining Facets
4.4 Auxiliary Components
5 Conformance
A Schema for Datatype Definitions (normative)
B DTD for Datatype Definitions (non-normative)
C Temporary Stuff (to be added elsewhere)
D Built-up Value Spaces
D.1 Numerical Values
D.2 Date/time Values
E Function Definitions
E.1 Generic Number-related Functions
E.2 Date/time-related Definitions
F Datatypes and Facets
F.1 Fundamental Facets
G Adding durations to dateTimes
G.1 Algorithm
G.2 Commutativity and Associativity
H Regular Expressions
H.1 Character Classes
I Changes since version 1.0
I.1 Changes Already Made
I.2 Specific Outstanding Issues
J Glossary (non-normative)
K References
K.1 Normative
K.2 Non-normative
L Acknowledgements (non-normative)
Issue (RQ-21i):RQ-21 (regex/BNF for all primitive types)Current plan is that all datatypes defined herein will have EBNF productions at least approximately defining their lexical space, and will include a nonnormative regex derived from the EBNF if a user wishes to copy it directly.
Issue (RQ-24-2i):RQ-24 (systematic facets: canonical representations for all datatypes)It is not possible for all datatypes to have canonical representations of all values without violating the rules of derivation or adding special-purpose constraining facets which the WG does not deem appropriate. The WG has not yet decided how to deal with datatypes whose lexical and/or canonical mappings are context sensitive.
Issue (RQ-148i):RQ-148 (clarify use of "truncation)The word will probably be removed.
Issue (RQ-120i):RQ-120 (consistent use of "derived)"Derivations" other than "derivations by restriction" will be renamed "constructions".
The Working Group has two main goals for this version of W3C XML Schema:
These goals are slightly in tension with one another -- the following summarizes the Working Group's strategic guidelines for changes between versions 1.0 and 1.1:
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>1999-01-21</orderDate> <shipDate>1999-01-25</shipDate> <billingAddress> <name>Ashok Malhotra</name> <street>123 Microsoft Ave.</street> <city>Hawthorne</city> <state>NY</state> <zip>10532-0000</zip> </billingAddress> <voice>555-1234</voice> <fax>555-4321</fax> </invoice> |
<memo importance='high' date='1999-03-23'> <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>555-9876</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 XML-related standards as well.
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 XML-related activities such as [XSL] and [RDF Schema].
The terminology used to describe XML Schema Datatypes is defined in the body of this specification. The terms defined in the following list are used in building those definitions and in describing the actions of a datatype processor:
This specification provides three different kinds of normative statements about schema components, their representations in XML and their contribution to the schema-validation of information items:
This section describes the conceptual framework behind the datatype system defined in this specification. The framework has been influenced by the [ISO 11404] standard on language-independent datatypes as well as the datatypes for [SQL] and for programming languages such as Java.
The datatypes discussed in this specification are 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 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.
[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 Built-in datatypes (§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.
The ·value space· of a datatype can be defined in one of the following ways:
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 restrictions by enumeration, and when checking identity 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. It turns out that, for example, 0.1 and 0.10000000009 are effectively identical in
float but not in decimal. (Neither 0.1 nor 0.10000000009 are in
the float value space, but ·the lexical mapping·
of float maps both '0.1
' and '0.10000000009
' to
the same number (0.100000001490116119384765625) that is in the float value space.)
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, it has been carefully defined so as to be a congruence relation for most other operations of interest to the datatype. (This means simply that 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. For example, identity is by definition a congruence relation for all other operations of interest.) Equality is always a congruence for the order relation.
On the other hand, equality need not cover the entire value space of the datatype (though it usually does).
The equality relation is used in conjunction with order when making restrictions involving order. This is the only use of equality for schema processing.
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, less-than, nor greater-than. Such value pairs are incomparable. In many cases, the prescribed order is the "null order": the ultimate partial order, in which no pairs are less-than or greater-than; they are all equal or ·incomparable·. [Definition:] Two values that are neither equal, less-than, nor greater-than are incomparable. Two values that are not ·incomparable· are comparable. The order relation is used in conjunction with equality when making restrictions involving order. This is the only use of order for schema processing.
In this specification, this less-than 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 pDecimal 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 alway 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 ).
[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.
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 otherwise-dropped ·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.
Issue (RQ-129i):RQ-129 (remove dependency on canonical representations)The dependencies are in Part 1; they will be resolved there. Text in this Part will reflect that canonical representation are provided for the benefit of other users, including other specifications that might want to reference these datatypes.
Issue (RQ-126i):RQ-126 (restricting away canonical representations)Given the "pattern" constraining facet, restricting away canonical representations cannot be prohibited without undue processing expense. A warning will be inserted, and RQ-129 will insure that loss of canonical representations will not affect schema processing.
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 one-to-one 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)
It is useful to categorize the datatypes defined in this specification along various dimensions, forming a set of characterization dichotomies.
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 of an ·atomic· datatype (NMTOKEN); while a sequence of such tokens could be the value of a ·list· datatype (NMTOKENS).
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 whose internal structure is specific to the datatype in question. There is one "special" atomic type (anyAtomicType) and a number of ·primitive· atomic types, which have anyAtomicType as their base type. All other atomic types are derived by restriction either from one of the primitive atomic types or from another ordinary atomic type. No user-defined type 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· datatypes are always ·derived·. The ·value space· of a ·list· datatype is a set of finite-length sequences of ·atomic· values. The ·lexical space· of a ·list· datatype is a set of literals whose internal structure is a space-separated sequence of literals of the ·atomic· datatype of the items in the ·list·.
[Definition:] The ·atomic· or ·union· datatype that participates in the definition of a ·list· datatype is known as the itemType of that ·list· datatype.
<simpleType name='sizes'> <list itemType='decimal'/> </simpleType>
<cerealSizes xsi:type='sizes'> 8 10.5 12 </cerealSizes>
A ·list· datatype can be ·derived· from an ordinary ·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.
<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 a ·list· datatype, the following ·constraining facet·s 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 space-separated literals of its ·itemType·. Hence, any ·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 ·itemType·.
<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 canonical-lexical-representation for the ·list· datatype is defined as the lexical form in which each item in the ·list· has the canonical lexical representation of its ·itemType·.
The ·value space· and ·lexical space· of a ·union· datatype are the union of the ·value space·s and ·lexical space·s of its ·memberTypes·. ·union· datatypes are always ·derived·. Currently, there are no ·built-in· ·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) of ordinary ·atomic· or ·list· ·datatype·s can participate in a ·union· type.
[Definition:] The datatypes that participate in the definition of a ·union· datatype are known as the memberTypes of that ·union· datatype.
The order in which the ·memberTypes· are specified in the definition (that is, the order of the <simpleType> children of the <union> element, or the order of the QNames in the memberTypes attribute) is significant. During validation, an element or attribute's value is validated against the ·memberTypes· 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 canonical-lexical-representation for a ·union· datatype is defined as the lexical form in which the values have the canonical lexical representation of the appropriate ·memberTypes·.
Next, we distinguish between ·primitive·, ·constructed·, and ·derived· datatypes.
For example, in this specification, float is a well-defined mathematical concept that cannot be defined in terms of other datatypes, while a integer is a special case of the more general datatype decimal.
[Definition:] The definition of anySimpleType is a special restriction of anyType. anySimpleType is considered to have an unconstrained lexical space and a ·value space· consisting of the union of the ·value space·s of all the ·primitive· datatypes and the set of all lists of all members of the ·value space·s of all the ·primitive· datatypes.
The datatypes defined by this specification fall into both the ·primitive· and ·derived· categories. It is felt that a judiciously chosen set of ·primitive· datatypes will serve the widest possible 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 variety of datatypes needed by schema designers can be ·derived·.
In the example above, integer is ·derived· from decimal.
As described in more detail in XML Representation of Simple Type Definition Schema Components (§4.1.2), each ·user-derived· datatype ·must· be defined in terms of another datatype in one of three ways: 1) by assigning ·constraining facet·s which serve to restrict the ·value space· of the ·user-derived· datatype to a subset of that of the ·base type·; 2) by creating a ·list· datatype whose ·value space· consists of finite-length sequences of values of its ·itemType·; or 3) by creating a ·union· datatype whose ·value space· consists of the union of the ·value space·s of its ·memberTypes·.
[Definition:] A datatype is said to be ·derived· by restriction from another datatype when values for zero or more ·constraining facet·s are specified that serve to constrain its ·value space· and/or its ·lexical space· to a subset of those of its ·base type·.
[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· from another datatype (its ·itemType·) by creating a ·value space· that consists of a finite-length sequence of values of its ·itemType·.
One datatype can be ·derived· from one or more datatypes by ·union·ing their ·value space·s and, consequently, their ·lexical space·s.
Conceptually there is no difference between the ·built-in· ·derived· datatypes included in this specification and the ·user-derived· datatypes which will be created by individual schema designers. The ·built-in· ·derived· 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" them. Furthermore, including these ·derived· datatypes in this specification serves to demonstrate the mechanics and utility of the datatype generation facilities of this specification.
Each built-in 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 built-in datatype definition can be uniquely addressed via a URI constructed as follows:
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 ·built-in· 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 ·built-in· 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 ·built-in· datatype is also defined in the namespace whose URI is:
This applies to both ·built-in· ·primitive· and ·built-in· ·derived· datatypes.
Each ·user-derived· datatype is also associated with a unique namespace. However, ·user-derived· 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 ·primitive· datatypes defined by this specification are described below. For each datatype, the ·value space· and ·lexical space· are defined, ·constraining facet·s which apply to the datatype are listed and any datatypes ·derived· from this datatype are specified.
·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 finite-length 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.
string has the following ·constraining facets·:
The following ·built-in· datatypes are ·derived· from string:
[Definition:] boolean has the ·value space· required to support the mathematical concept of binary-valued logic: {true, false}.
An instance of a datatype that is defined as ·boolean· can have the following legal literals {true, false, 1, 0}.
Issue (RQ-150i):RQ-150 (minimum number of digits for decimal)The minimum number of digits implementations are required to support will be lowered to 16 digits; a health warning will be added to note that implementations of derived datatypes may support more digits of precision than the base decimal type does, but that they are not required to do so.
[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 dividing an integer by a non-negative power of ten, i.e., expressible as i / 10n where i and n are integers and n ≥ 0. Precision is not reflected in this value space; the number 2.0 is not distinct from the number 2.00. (The datatype pDecimal may be used for values in which precision is significant.) The order relation on decimal is the order relation on real numbers, restricted to this subset.
decimal has a lexical representation
consisting of a finite-length sequence of decimal digits (#x30-#x39) separated
by a period as a decimal indicator.
An optional leading sign is allowed.
If the sign is omitted, "+" is assumed. Leading and trailing zeroes are optional.
If the fractional part is zero, the period and following zero(es) can
be omitted.
For example: -1.23, 12678967.543233, +100000.00, 210
.
The lexical space of decimal is the set of
lexical representations which match the grammar given above, or
(equivalently) the regular expression
'-?(([0-9]+(.[0-9]*)?)|(.[0-9]+))
'.
The mapping from lexical representations to values is the usual one for decimal numerals; it is given formally in:
The canonical representation for decimal is defined by prohibiting certain options from the Lexical representation (§3.2.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:
decimal has the following ·constraining facets·:
The following ·built-in· datatypes are ·derived· from decimal:
[Definition:] The pDecimal 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". The special values are introduced to make the datatype correspond closely to the floating-point decimal datatypes described by the forthcoming revision of IEEE/ANSI 754.
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 "not-a-number", "positive infinity",
and "negative infinity".
The latter two together are called
"the infinities".Equality and order for pDecimal are defined as follows:
pDecimal'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 lexicalMappings
facet can remove any one or two of the three subsets of
numerals, with corresponding reductions in
the value space. Using this facet
rather than pattern will change the canonical
mapping to insure that the resulting datatype will still have canonical
representations of all its values.
The lexical mapping and canonical mapping for pDecimal are the following functions:
The Simple Type Definition of pDecimal is present in every schema. It has the following properties:
Simple Type Definition of pDecimal | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
pDecimal has the following ·constraining facets·:
Issue (RQ-1i):RQ-1 (canonical representation of float, double)The description of canonical representations for float and double needs to be cleaned up.
Issue (RQ-140i):RQ-140 (positive and negative zero in float and double)Two zeros will be provided similar to those in precisionDecimal
[Definition:] float is patterned after the IEEE single-precision 32-bit floating point type [IEEE 754-1985]. 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 not-a-number (NaN). The order relation 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 non-NaN values. NaN equals itself but is incomparable with (neither greater than nor less than) any other value in the ·value space·.
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.
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 not-a-number 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.78e-2, 12
, -0, 0
and INF
are all legal literals for float.
NaN has the canonical form 'NaN
'. Infinity and
negative infinity have the canonical forms 'INF
' and
'-INF
' respectively. Besides these special
values, the general form of the canonical form for float
is a mantissa, which is a decimal, followed by 'E
'
followed by an exponent which is an integer. 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 non-zero 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 form of
positive zero is 0.0E0. The canonical form for negative zero
is -0.0E0. Beyond the one required digit after the decimal point
in the mantissa, there must be as many, but only as many, additional
digits as are needed to uniquely distinguish the value from all other
values for the datatype after rounding.
float has the following ·constraining facets·:
[Definition:] The double datatype is patterned after the IEEE double-precision 64-bit floating point type [IEEE 754-1985]. 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 not-a-number (NaN). The order relation 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 non-NaN values. NaN equals itself but is incomparable with (neither greater than nor less than) any other value in the ·value space·.
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 754-1985].
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 not-a-number 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.78e-2, 12
, -0, 0
and INF
are all legal literals for double.
NaN has the canonical form 'NaN
'. Infinity and
negative infinity have the canonical forms 'INF
' and
'-INF
' respectively. Besides these special
values, the general form of the canonical form for double
is a mantissa, which is a decimal, followed by 'E
'
followed by an exponent which is an integer. 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 non-zero 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 form of
positive zero is 0.0E0. The canonical form for negative zero
is -0.0E0. Beyond the one required digit after the decimal point
in the mantissa, there must be as many, but only as many, additional
digits as are needed to uniquely distinguish the value from all other
values for the datatype after rounding.
double has the following ·constraining facets·:
[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 and subtraction from dateTime is required for XML Schema processing
and is defined in Adding durations to dateTimes (§G).
Durations can be modeled in at least two ways: as six-property tuples (similar to the seven-property model used for other date/time datatypes) or as two-property tuples (somewhat similar to the alternative one-property timeOnTimeline model especially useful for dateTime order). For durations, it is useful to use the latter: duration values are two-property tuples. (Note, however, that the six-property model was implicitly used in Schema 1.0. The only effective difference to the user caused by this change is in the canonical representations.) See The Seven-property Model (§D.2.1) for more information on the seven-property model.
duration is partially ordered. Equality and order are defined in terms of that of dateTime, and are determined by adding each duration value pair in turn to 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.
It turns out that 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 (§3.3).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:
T
' ((duHourFrag duMinuteFrag? duSecondFrag?) |
(duMinuteFrag duSecondFrag?) |
duSecondFrag)
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 durationLexicalRep is equivalent to this regular expression
-?P(((([0-9]+Y([0-9]+M)?)|
( ([0-9]+M) ) )(([0-9]+D(T(([0-9]+H([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)|
( ([0-9]+M) ([0-9]+(\.[0-9]+)?S)?)|
( ([0-9]+(\.[0-9]+)?S) ) ))?)|
( (T(([0-9]+H([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)|
( ([0-9]+M) ([0-9]+(\.[0-9]+)?S)?)|
( ([0-9]+(\.[0-9]+)?S) ) )) ) )?)|
( (([0-9]+D(T(([0-9]+H([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)|
( ([0-9]+M) ([0-9]+(\.[0-9]+)?S)?)|
( ([0-9]+(\.[0-9]+)?S) ) ))?)|
( (T(([0-9]+H([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)|
( ([0-9]+M) ([0-9]+(\.[0-9]+)?S)?)|
( ([0-9]+(\.[0-9]+)?S) ) )) ) ) ) )
once you delete the whitespace. Redundant parentheses are shown as "ghosts"; some find them helpful in reading the expression.)
duration has the following ·constraining facets·:
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.
dateTime uses the date/timeSevenPropertyModel, with no properties except ·timezone· permitted to be absent. The ·timezone· property remains ·optional·.
Equality and order are as prescribed in The Seven-property Model (§D.2.1). dateTime values are ordered by their ·timeOnTimeline· value.
The lexical representations for dateTime are as follows:
-
' monthFrag '-
' dayFrag 'T
' ((hourFrag ':
' minuteFrag ':
' secondFrag) |
endOfDayFrag) timezoneFrag? Constraint: Day-of-month Representations Constraint: Leap-second Representations
3
' or be '29
'
unless the value to
which it would map would satisfy the value constraint on
·day· values
("Constraint: Day-of-month Values") given above.
6
' unless the value to
which it would map, in conjunction with the rest of the values,
would satisfy the value constraint on leap-second values
("Constraint: Leap-second Values") given
above. Should a negative leap-second be declared, the
secondFrag is further limited to those which would
satisfy the even-tighter value constraint on ·second·.The dateTimeLexicalRep production is equivalent to this regular expression once whitespace is removed.
\-?([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9])\-(0[1-9])|(1[0-2])\-(0[1-9])([12][0-9])|(3[01])
T(([01][0-9])|(2[0-3]):[0-5][0-9]:(([0-5][0-9])|(60))(.[0-9]+)?)|(24:00:00(.[0-9]+)?)
([+\-](0[0-9])|(1[0-4]):[0-5][0-9])?
Note that neither the dateTimeLexicalRep production nor this regular expression alone enforce the constraints on dateTimeLexicalRep given above.
The lexical mapping and canonical mapping for dateTime are the following functions:
dateTime has the following ·constraining facets·:
time represents instants of time that recur at the same point in each calendar day, or that occur in some arbitrary calendar day.
time uses the date/timeSevenPropertyModel, with ·year·, ·month·, and ·day· required to be absent. ·timezone· remains ·optional·.
Issue (RQ-13i-time-copy):RQ-13 (time zone crosses date line)The "seven property model" rewrite of date/time datatype descriptions includes a carefully crafted definition of order that insures that for repeating datatypes (time, gDay, etc.), timezoned values will be compared as though they are on the same "calendar day" ("local" property values) so that in any given timezone, the days start at "local" 00:00:00 and end immediately before "local" 24:00:00. Days in timezones other than Z do not run from 00:00:00Z to 24:00:00Z.
Equality and order are as prescribed in The Seven-property 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 52-hour interval, from the beginning of the day in the +14:00 timezone to the end of that day in the –14:00 timezone.
The lexical representations for time are "projections" of those of dateTime, as follows:
:
' minuteFrag ':
' secondFrag) |
endOfDayFrag) timezoneFrag? Constraint: Leap-second Representations
6
' unless the value to
which it would map would satisfy the value
constraint on leap-second values given above.The timeLexicalRep production is equivalent to this regular expression, once whitespace is removed:
(([01][0-9])|(2[0-3]):[0-5][0-9]:[0-6][0-9])|(24:00:00)
(([01][0-9])|(2[0-3]):[0-5][0-9]:(([0-5][0-9])|(60))(.[0-9]+)?)|(24:00:00(.[0-9]+)?)
([+\-](0[0-9])|(1[0-4]):[0-5][0-9])?
Note that neither the timeLexicalRep production nor this regular expression alone enforce the constraint on timeLexicalRep given above.
The lexical mapping and canonical mapping for time are the following functions:
time has the following ·constraining facets·:
[Definition:] date represents top-open 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 top-open intervals disjointly cover the nontimezoned timeline, one per day. For timezoned values, the intervals begin at every minute and therefore overlap.
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 Seven-property Model (§D.2.1).
The lexical representations for date are "projections" of those of dateTime, as follows:
-
' monthFrag '-
' dayFrag timezoneFrag? Constraint: Day-of-month Representations
3
' or be '29
'
unless the value to
which it would map would satisfy the value constraint on
·day· values
("Constraint: Day-of-month Values") given above.The dateLexicalRep production is equivalent to this regular expression:
\-?([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9])\-(0[1-9])|(1[0-2])\-([0-2][0-9])|(3[01])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?
Note that neither the dateLexicalRep production nor this regular expression alone enforce the constraint on dateLexicalRep given above.
The lexical mapping and canonical mapping for date are the following functions:
gYearMonth represents specific whole Gregorian months in specific Gregorian years.
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 Seven-property Model (§D.2.1).
The lexical representations for gYearMonth are "projections" of those of dateTime, as follows:
The gYearMonthLexicalRep is equivalent to this regular expression:
\-?([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9])\-(0[1-9])|(1[0-2])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?
The lexical mapping and canonical mapping for gYearMonth are the following functions:
gYearMonth has the following ·constraining facets·:
gYear represents Gregorian calendar years.
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 Seven-property Model (§D.2.1).
The lexical representations for gYear are "projections" of those of dateTime, as follows:
The gYearLexicalRep is equivalent to this regular expression:
\-?([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?
The lexical mapping and canonical mapping for gYear are the following functions:
gYear has the following ·constraining facets·:
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.
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 Seven-property Model (§D.2.1).
The lexical representations for gMonthDay are "projections" of those of dateTime, as follows:
--
' monthFrag '-
' dayFrag timezoneFrag? Constraint: Day-of-month Representations
3
' or be '29
'
unless the value to
which it would map would satisfy the value constraint on
·day· values
("Constraint: Day-of-month Values") given above.The gMonthDayLexicalRep is equivalent to this regular expression:
\-\-(0[1-9])|(1[0-2])\-([0-2][0-9])|(3[01])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?
Note that neither the gMonthDayLexicalRep production nor this regular expression alone enforce the constraint on gMonthDayLexicalRep given above.
The lexical mapping and canonical mapping for gMonthDay are the following functions:
gMonthDay has the following ·constraining facets·:
[Definition:] gDay represents whole days within an arbitrary month—days that recur at the same point in each (Gregorian) month. This datatype is used to represent a specific day of the month. To 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.)
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 Seven-property 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.2.14.2) for the notations):
The lexical representations for gDay are "projections" of those of dateTime, as follows:
The gDayLexicalRep is equivalent to this regular expression:
\-\-\-([0-2][0-9]|3[01])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?
The lexical mapping and canonical mapping for gDay are defined as follows:
gDay has the following ·constraining facets·:
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).
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 Seven-property Model (§D.2.1).
The lexical representations for gMonth are "projections" of those of dateTime, as follows:
The gMonthLexicalRep is equivalent to this regular expression:
\-\-(0[1-9])|(1[0-2])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?
The lexical mapping and canonical mapping for gMonth are defined as follows:
gMonth has the following ·constraining facets·:
[Definition:] hexBinary represents arbitrary hex-encoded binary data. The ·value space· of hexBinary is the set of finite-length sequences of binary octets.
hexBinary has a lexical representation where each binary octet is encoded as a character tuple, consisting of two hexadecimal digits ([0-9a-fA-F]) representing the octet code. For example, "0FB7" is a hex encoding for the 16-bit integer 4023 (whose binary representation is 111110110111).
The canonical representation for hexBinary is defined by prohibiting certain options from the Lexical Representation (§3.2.16.1). Specifically, the lower case hexadecimal digits ([a-f]) are not allowed.
hexBinary has the following ·constraining facets·:
[Definition:] base64Binary represents Base64-encoded arbitrary binary data. The ·value space· of base64Binary is the set of finite-length sequences of binary octets. For base64Binary data the entire binary stream is encoded using the Base64 Alphabet in [RFC 2045].
The lexical forms of base64Binary values are limited to the 65 characters
of the Base64 Alphabet defined in [RFC 2045], i.e., a-z
,
A-Z
, 0-9
, the plus sign (+), the forward slash (/) and the
equal sign (=), together with the characters defined in [XML] as white space.
No other characters are allowed.
For compatibility with older mail gateways, [RFC 2045] suggests that base64 data should have lines limited to at most 76 characters in length. This line-length limitation is not mandated in the lexical forms of base64Binary data and 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 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 ::= [A-Za-z0-9+/]
Note that this grammar requires the number of non-whitespace characters in the lexical form to be a multiple of four, and for equals signs to appear only at the end of the lexical form; strings which do not meet these constraints are not legal lexical forms of base64Binary because they cannot successfully be decoded by base64 decoders.
The canonical lexical form of a base64Binary data value is the base64 encoding of the value which matches the Canonical-base64Binary production in the following grammar:
Canonical-base64Binary ::= (B64
B64 B64 B64)*
((B64 B64 B16 '=') | (B64 B04 '=='))?
The length of a base64Binary value is the number of octets it contains. This may be calculated from the lexical form by removing whitespace and padding characters and performing the calculation shown in the pseudo-code 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] explicitly references US-ASCII 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·:
[Definition:] anyURI represents a Uniform Resource Identifier Reference (URI). An anyURI value can be absolute or relative, and may have an optional fragment identifier (i.e., it may be a URI Reference). This type should be used to specify the intention that the value fulfills the role of a URI as defined by [RFC 2396], as amended by [RFC 2732].
The mapping from anyURI values to URIs is as defined by the URI reference escaping procedure defined in Section 5.4 Locator Attribute of [XML Linking Language] (see also Section 7 Character Encoding in URI References of [Character Model]). This means that a wide range of internationalized resource identifiers can be specified when an anyURI is called for, and still be understood as URIs per [RFC 2396], as amended by [RFC 2732], where appropriate to identify resources.
The ·lexical space· of anyURI is finite-length 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].
anyURI has the following ·constraining 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].
QName has the following ·constraining facets·:
The use of ·length·, ·minLength· and ·maxLength· on 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.5)) NOTATION should be used only on attributes and should only be used in schemas with no target namespace.
NOTATION has the following ·constraining facets·:
The use of ·length·, ·minLength· and ·maxLength· on 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 ·built-in· ·derived· datatypes defined by this specification. The XML representation used to define ·derived· datatypes (whether ·built-in· or ·user-derived·) is given in section XML Representation of Simple Type Definition Schema Components (§4.1.2) and the complete definitions of the ·built-in· ·derived· datatypes are provided in Appendix A Schema for 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·:
The following ·built-in· 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·:
The following ·built-in· datatypes are ·derived· from token:
[Definition:]
language
represents natural language identifiers as defined by
by [RFC 3066]
.
The ·value space· of language is the
set of all strings that are valid language identifiers as defined
[RFC 3066]
.
The ·lexical space· of
language is the set of all strings that
conform to the pattern [a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*
.
The ·base type· of language is token.
language has the following ·constraining 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.
For compatibility (see Terminology (§1.5)) NMTOKEN should be used only on attributes.
NMTOKEN has the following ·constraining facets·:
[Definition:] NMTOKENS represents the NMTOKENS attribute type from [XML]. The ·value space· of NMTOKENS is the set of finite, non-zero-length sequences of ·NMTOKEN·s. The ·lexical space· of NMTOKENS is the set of space-separated lists of tokens, of which each token is in the ·lexical space· of NMTOKEN. The ·itemType· of NMTOKENS is NMTOKEN.
For compatibility (see Terminology (§1.5)) NMTOKENS should be used only on attributes.
NMTOKENS has the following ·constraining 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.
Name has the following ·constraining facets·:
[Definition:] NCName represents XML "non-colonized" 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.
NCName has the following ·constraining facets·:
The following ·built-in· 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.5)) ID should be used only on attributes.
ID has the following ·constraining 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.5)) this datatype should be used only on attributes.
IDREF has the following ·constraining facets·:
[Definition:] IDREFS represents the IDREFS attribute type from [XML]. The ·value space· of IDREFS is the set of finite, non-zero-length sequences of IDREFs. The ·lexical space· of IDREFS is the set of space-separated lists of tokens, of which each token is in the ·lexical space· of IDREF. The ·itemType· of IDREFS is IDREF.
For compatibility (see Terminology (§1.5)) IDREFS should be used only on attributes.
IDREFS has the following ·constraining 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.5)) ENTITY should be used only on attributes.
ENTITY has the following ·constraining facets·:
[Definition:] ENTITIES represents the ENTITIES attribute type from [XML]. The ·value space· of ENTITIES is the set of finite, non-zero-length 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 space-separated lists of tokens, of which each token is in the ·lexical space· of ENTITY. The ·itemType· of ENTITIES is ENTITY.
For compatibility (see Terminology (§1.5)) ENTITIES should be used only on attributes.
ENTITIES has the following ·constraining 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.
integer has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39) with an optional leading sign. If the sign is omitted, "+" is assumed. For example: -1, 0, 12678967543233, +100000.
The canonical representation for integer is defined by prohibiting certain options from the Lexical representation (§3.3.13.1). Specifically, the preceding optional "+" sign is prohibited and leading zeroes are prohibited.
integer has the following ·constraining facets·:
The following ·built-in· 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 non-positive integers. The ·value space· of nonPositiveInteger is the infinite set {...,-2,-1,0}. The ·base type· of nonPositiveInteger is integer.
nonPositiveInteger has a lexical representation consisting of an optional preceding sign followed by a finite-length sequence of decimal digits (#x30-#x39). The sign may be "+" or may be omitted only for lexical forms denoting zero; in all other lexical forms, the negative sign ("-") must be present. For example: -1, 0, -12678967543233, -100000.
The canonical representation for nonPositiveInteger is defined by prohibiting certain options from the Lexical representation (§3.3.14.1). In the canonical form for zero, the sign must be omitted. Leading zeroes are prohibited.
nonPositiveInteger has the following ·constraining facets·:
The following ·built-in· 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.
negativeInteger has a lexical representation consisting of a negative sign ("-") followed by a finite-length sequence of decimal digits (#x30-#x39). For example: -1, -12678967543233, -100000.
The canonical representation for negativeInteger is defined by prohibiting certain options from the Lexical representation (§3.3.15.1). Specifically, leading zeroes are prohibited.
negativeInteger has the following ·constraining 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.
long has a lexical representation consisting of an optional sign followed by a finite-length sequence of decimal digits (#x30-#x39). If the sign is omitted, "+" is assumed. For example: -1, 0, 12678967543233, +100000.
The canonical representation for long is defined by prohibiting certain options from the Lexical representation (§3.3.16.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
long has the following ·constraining 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.
int has a lexical representation consisting of an optional sign followed by a finite-length sequence of decimal digits (#x30-#x39). If the sign is omitted, "+" is assumed. For example: -1, 0, 126789675, +100000.
The canonical representation for int is defined by prohibiting certain options from the Lexical representation (§3.3.17.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
int has the following ·constraining 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.
short has a lexical representation consisting of an optional sign followed by a finite-length sequence of decimal digits (#x30-#x39). If the sign is omitted, "+" is assumed. For example: -1, 0, 12678, +10000.
The canonical representation for short is defined by prohibiting certain options from the Lexical representation (§3.3.18.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
short has the following ·constraining 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.
byte has a lexical representation consisting of an optional sign followed by a finite-length sequence of decimal digits (#x30-#x39). If the sign is omitted, "+" is assumed. For example: -1, 0, 126, +100.
The canonical representation for byte is defined by prohibiting certain options from the Lexical representation (§3.3.19.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
byte has the following ·constraining 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 non-negative integers. The ·value space· of nonNegativeInteger is the infinite set {0,1,2,...}. The ·base type· of nonNegativeInteger is integer.
nonNegativeInteger has a lexical representation consisting of an optional sign followed by a finite-length sequence of decimal digits (#x30-#x39). If the sign is omitted, the positive sign ("+") is assumed. If the sign is present, it must be "+" except for lexical forms denoting zero, which may be preceded by a positive ("+") or a negative ("-") sign. For example: 1, 0, 12678967543233, +100000.
The canonical representation for nonNegativeInteger is defined by prohibiting certain options from the Lexical representation (§3.3.20.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
nonNegativeInteger has the following ·constraining facets·:
The following ·built-in· 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.
unsignedLong has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 12678967543233, 100000.
The canonical representation for unsignedLong is defined by prohibiting certain options from the Lexical representation (§3.3.21.1). Specifically, leading zeroes are prohibited.
unsignedLong has the following ·constraining facets·:
The following ·built-in· 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.
unsignedInt has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 1267896754, 100000.
The canonical representation for unsignedInt is defined by prohibiting certain options from the Lexical representation (§3.3.22.1). Specifically, leading zeroes are prohibited.
unsignedInt has the following ·constraining facets·:
The following ·built-in· 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.
unsignedShort has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 12678, 10000.
The canonical representation for unsignedShort is defined by prohibiting certain options from the Lexical representation (§3.3.23.1). Specifically, the leading zeroes are prohibited.
unsignedShort has the following ·constraining facets·:
The following ·built-in· 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.
unsignedByte has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 126, 100.
The canonical representation for unsignedByte is defined by prohibiting certain options from the Lexical representation (§3.3.24.1). Specifically, leading zeroes are prohibited.
unsignedByte has the following ·constraining 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.
positiveInteger has a lexical representation consisting of an optional positive sign ("+") followed by a finite-length sequence of decimal digits (#x30-#x39). For example: 1, 12678967543233, +100000.
The canonical representation for positiveInteger is defined by prohibiting certain options from the Lexical representation (§3.3.25.1). Specifically, the optional "+" sign is prohibited and leading zeroes are prohibited.
positiveInteger has the following ·constraining 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 ·second· 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 regular expression '-?P([0-9]+Y)?([0-9]+M)?
' has
instances that are not in the lexical space—but they are not in the lexical space of duration
either, so it serves as a relatively simple regular expression
that extracts from the ·lexical space·
of duration those representations that are instances of yearMonthDuration.
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·:
[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 ·month· 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 regular expression '-?P([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+(.[0-9]+)?S)?)?
' has several
instances that are not in the lexical space—but they are not in the lexical space of duration
either, so it serves as a relatively simple regular expression that extracts from
the ·lexical space·
of duration those representations that are instances of dayTimeDurationLexicalRep.
The ·canonical mapping· is that of duration restricted to the ·value space· 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·:
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].
Simple Type definitions provide for:
The Simple Type Definition schema component has the following properties:
Added in version 1.1.
If the datatype has been ·derived· by ·restriction· then the Simple Type Definition component from which it is ·derived·, otherwise the ||definition of anySimpleType||.
Must be a built-in definition.
Must not be empty if {variety} is union, otherwise must be absent.
Datatypes are identified by their {name} and {target namespace}. Except for anonymous datatypes (those with no {name}), datatype definitions ·must· be uniquely identified within a schema.
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 finite-length sequence of values from the ·value space· of {item type definition}. If {variety} is ·union· then the ·value space· of the datatype defined will be the union of the ·value space·s of each datatype in {member type definitions}.
If {variety} is ·atomic· then the {variety} of {base type definition} must be ·atomic·. If {variety} is ·list· then the {variety} of {item type definition} must be either ·atomic· or ·union·. If {variety} is ·union· then {member type definitions} must be a list of datatype definitions.
The value of {facets} consists of the set of ·fundamental facets· and ·constraining facets· 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.
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 by ·restriction·, ·list· and ·union· respectively.
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))
id = ID
name = NCName
{any attributes with non-schema namespace . . .}>
Content: (annotation?, (restriction | list | union))
</simpleType>
Simple Type Definition Schema Component | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
A ·derived· datatype can be ·derived· from a ·primitive· datatype or another ·derived· datatype by one of three means: by restriction, by list or by union.
restriction
Element Information Item<restriction
base = QName
id = ID
{any attributes with non-schema namespace . . .}>
Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | maxScale | minScale | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))
</restriction>
Simple Type Definition Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
<simpleType name='Sku'> <restriction base='string'> <pattern value='\d{3}-[A-Z]{2}'/> </restriction> </simpleType>
list
Element Information Item<list
id = ID
itemType = QName
{any attributes with non-schema namespace . . .}>
Content: (annotation?, simpleType?)
</list>
Simple Type Definition Schema Component | ||||||
---|---|---|---|---|---|---|
|
A ·list· datatype must be ·derived· from an ·atomic· or a ·union· datatype, known as the ·itemType· of the ·list· datatype. This yields a datatype whose ·value space· is composed of finite-length sequences of values from the ·value space· of the ·itemType· and whose ·lexical space· is composed of space-separated lists of literals of the ·itemType·.
<simpleType name='listOfFloat'> <list itemType='float'/> </simpleType>
As mentioned in List datatypes (§2.4.1.2), when a datatype is ·derived· from a ·list· datatype, the following ·constraining facet·s can be used:
regardless of the ·constraining facet·s that are applicable to the ·atomic· datatype that serves as the ·itemType· 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.
union
Element Information Item<union
id = ID
memberTypes = List of QName
{any attributes with non-schema namespace . . .}>
Content: (annotation?, simpleType*)
</union>
Simple Type Definition Schema Component | ||||||
---|---|---|---|---|---|---|
|
A ·union· datatype can be ·derived· from one or more ordinary ·atomic·, ·list· or other ·union· datatypes, known as the ·memberTypes· 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.4.1.3), when a datatype is ·derived· from a ·union· datatype, the only following ·constraining facet·s can be used:
regardless of the ·constraining facet·s 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 non-empty or
there must be at least one simpleType
[child].
The definition of anySimpleType is present in every schema. It has the following properties:
Simple Type Definition of anySimpleType | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
The definition of anySimpleType is the root of the Simple Type Definition hierarchy, and as such mediates between the other simple type definitions, which all eventually trace back to it via their {base type definition} properties, and thus to the definition of anyType, which is its {base type definition}.
Simple Type Definition of anyAtomicType | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Simple type definitions for all the built-in primitive datatypes, namely string, boolean, float, double, decimal, pDecimal, dateTime, duration, time, date, gMonth, gMonthDay, gDay, gYear, gYearMonth, hexBinary, base64Binary, anyURI are present by definition in every schema. All are in the XML Schema namespace (http://www.w3.org/2001/XMLSchema), have an atomic {variety} with an empty {facets} (unless otherwise specified in this specification) and anyAtomicType as their {base type definition}, and themselves as {primitive type definition}.
Similarly, simple type definitions for all the built-in derived datatypes are present by definition in every schema, with properties as specified in Derived datatypes (§3.3) and as represented in XML in Schema for Datatype Definitions (normative) (§A).
Issue (RQ-24-1i):RQ-24 (systematic approach to facets)The decision that the four informational facets, each of which have only one property, will be lumped into one facet having four properties has been rescinded by the WG before it made it into the text of this specification.
[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·.
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. [Definition:] A Simple Type Definition in whose {fundamental facets} a ·fundamental facet· component occurs is that component's owner. Each kind of ·fundamental facet· component occurs (once) in each Simple Type Definition's {fundamental facets} set.
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 "near-boolean": one of false, partial, and total, as prescribed in Fundamental Facets (§F.1) for ·primitive· datatypes; all ·derived· 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 non-trivial 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 non-trivial order for that ·value space·.
{value} depends on the ·owner's· {variety}, {facets}, and {member type definitions}.
The appropriate case among the following must be true:
Some ordered datatypes have the property that there is one value greater than or equal to every other value, and another that less than or equal to every other value. (In the case of derived 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}.
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 members of the ·owner's· {facets} set, then {value} is true; otherwise {value} is false.
When the ·owner's· {variety} is list, {value} is false.
When the ·owner's· {variety} is union, if {value} is true for every member of the ·owner's· {member type definitions} set and all of these share a common ancestor, then {value} is true; otherwise {value} is false.
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}.
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 {variety} is list, if length or both minLength and maxLength are members of the ·owner's· {facets} set and the ·owner's· {item type definition}'s cardinality {value} is finite then {value} is finite; otherwise {value} is countably infinite.
When the ·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, otherwise {value} is countably infinite.
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}.
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}.
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, otherwise {value} is false.
[Definition:] Constraining facets are schema components whose values may be set or changed during ·derivation· (subject to facet-specific 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· defining a ·derived· datatype; a few ·constraining facets· have default values that are also provided for ·primitive· datatypes.
Issue (RQ-147bi):RQ-147b (phase out length facet)The WG is considering the ramifications of removing the length constraining facet, letting the schema document elements that currently set that facet set both minLength and maxLength instead.
[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· 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 non-schema namespace . . .}>
Content: (annotation?)
</length>
length Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
The use of ·length· on datatypes ·derived· from QName and NOTATION 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· by ·list·, minLength is measured in number of list items.
·minLength· provides for:
<simpleType name='non-empty-string'> <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 non-schema namespace . . .}>
Content: (annotation?)
</minLength>
minLength Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
The use of ·minLength· on datatypes ·derived· from QName and NOTATION 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· by ·list·, maxLength is measured in number of list items.
·maxLength· provides for:
<simpleType name='form-input'> <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 non-schema namespace . . .}>
Content: (annotation?)
</maxLength>
maxLength Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
The use of ·maxLength· on datatypes ·derived· from QName and NOTATION 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. The value of pattern ·must· be a ·regular expression·.
·pattern· provides for:
<simpleType name='better-us-zipcode'> <restriction base='string'> <pattern value='[0-9]{5}(-[0-9]{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 non-schema namespace . . .}>
Content: (annotation?)
</pattern>
pattern Schema Component | ||||||
---|---|---|---|---|---|---|
|
[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='--01-01'> <annotation> <documentation>New Year's day</documentation> </annotation> </enumeration> <enumeration value='--07-04'> <annotation> <documentation>4th of July</documentation> </annotation> </enumeration> <enumeration value='--12-25'> <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 non-schema namespace . . .}>
Content: (annotation?)
</enumeration>
enumeration Schema Component | ||||||
---|---|---|---|---|---|---|
|
[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· 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· from
string the value of whiteSpace can
be any of the three legal values. For all datatypes
·derived· by ·list· the
value of whiteSpace is collapse
and cannot
be changed by a schema author. For all datatypes
·derived· 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
·memberTypes· against which the ·union·
is successfully validated.
·whiteSpace· provides for:
<simpleType name='token'> <restriction base='normalizedString'> <whiteSpace value='collapse'/> </restriction> </simpleType>
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 non-schema namespace . . .}>
Content: (annotation?)
</whiteSpace>
whiteSpace Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
[Definition:] maxInclusive is the 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='one-hundred-or-less'> <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 non-schema namespace . . .}>
Content: (annotation?)
</maxInclusive>
maxInclusive Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
[Definition:] maxExclusive is the 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='less-than-one-hundred-and-one'> <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 non-schema namespace . . .}>
Content: (annotation?)
</maxExclusive>
maxExclusive Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
[Definition:] minExclusive is the 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='more-than-ninety-nine'> <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 non-schema namespace . . .}>
Content: (annotation?)
</minExclusive>
minExclusive Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
[Definition:] minInclusive is the 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='one-hundred-or-more'> <restriction base='integer'> <minInclusive value='100'/> </restriction> </simpleType>
A value from the ·value space· of the {base type definition}.
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 non-schema namespace . . .}>
Content: (annotation?)
</minInclusive>
minInclusive Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
[Definition:] totalDigits restricts the magnitude and ·arithmetic precision· of values in the ·value spaces· of pDecimal 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 / 10n, for some integers i and n, with | i | < 10t and 0 ≤ n ≤ t. This has as a consequence that the values are expressible using at most t digits in decimal notation.
For pDecimal, values with ·numericalValue· of nV and ·arithmeticPrecision· of aP, if the {value} of totalDigits is t, the effect is to require that (aP + 1 + log10(| 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 non-significant 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} 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 non-schema namespace . . .}>
Content: (annotation?)
</totalDigits>
totalDigits Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
[Definition:] 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 / 10n 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 lexical representation that adds non-significant 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} 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 non-schema namespace . . .}>
Content: (annotation?)
</fractionDigits>
fractionDigits Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
[Definition:] maxScale places an upper limit on the ·arithmetic precision· of pDecimal 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 / 10n 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 non-significant leading or trailing zero digits, or that uses a lower exponent with a non-integer coefficient is still permitted.
<simpleType name='decimal32'> <restriction base='pDecimal'> <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 non-schema namespace . . .}>
Content: (annotation?)
</maxScale>
maxScale Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
[Definition:] minScale places a lower limit on the ·arithmetic precision· of pDecimal 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 / 10n 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='pDecimal'> <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 non-schema namespace . . .}>
Content: (annotation?)
</minScale>
minScale Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
Note that it is not an error for minScale to be greater than totalDigits.
[Definition:] The lexicalMappings facet restricts the ·lexical mapping· of pDecimal datatypes in a controlled way. When the lexical space is constrained using pattern facets, it is possible to produce datatypes for which some values have no canonical lexical representations in the lexical space; when the lexicalMappings facet is used, the ·canonical mapping· is automatically adjusted appropriately.
The ·lexicalMappings· facet does not restrict the ·value space· directly; but if scientific is not among the constants in the value, then the ·value space· may be diminished. For example, some pDecimal values have ·lexical representations· only in scientific notation. If nodecimal is the only constant present then only integer values with a ·arithmeticPrecision· of zero have ·lexical representations· and are hence in the ·value space·.
A pDecimal value v can be serialized successfully for a datatype constrained by lexicalMappings if any of the following are true:
{value} controls the usability of the three partial ·lexical mappings·, ·noDecimalMap· , ·decimalPtMap·, and ·scientificMap·, by restricting the ·lexical space·.
If {fixed} is true, then types for which the current type is the {base type definition} must not specify a value for lexicalMappings other than {value}.
The XML representation for a lexicalMappings schema component is a <lexicalMappings> element information item. The correspondences between the properties of the information item and properties of the component are as follows:
lexicalMappings
Element Information Item<lexicalMappings
fixed = boolean : false
id = ID
value = List of (nodecimal | decimal | scientific)
{any attributes with non-schema namespace . . .}>
Content: (annotation?)
</lexicalMappings>
lexicalMappings Schema Component | ||||||||
---|---|---|---|---|---|---|---|---|
|
If during a ·derivation· a new lexicalMappings is not prescribed, the newSimple Type Definition's lexicalMappings has the same property values as the parent's lexicalMappings. In any case, there is exactly one lexicalMappings facet in the {facets} set of each Simple Type Definition ·derived· from pDecimal.
This specification describes two levels of conformance for datatype processors. The first is required of all processors. Support for the other will depend on the application environments for which the processor is intended.
[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.
<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" [ <!-- keep this schema XML1.0 DTD valid --> <!ENTITY % schemaAttrs 'xmlns:hfp CDATA #IMPLIED'> <!ELEMENT hfp:hasFacet EMPTY> <!ATTLIST hfp:hasFacet name NMTOKENS #REQUIRED> <!ELEMENT hfp:hasProperty EMPTY> <!ATTLIST hfp:hasProperty name NMTOKEN #REQUIRED value CDATA #REQUIRED> <!-- Make sure that processors that do not read the external subset will know about the various IDs we declare --> <!ATTLIST xs:simpleType id ID #IMPLIED> <!ATTLIST xs:maxExclusive id ID #IMPLIED> <!ATTLIST xs:minExclusive id ID #IMPLIED> <!ATTLIST xs:maxInclusive id ID #IMPLIED> <!ATTLIST xs:minInclusive id ID #IMPLIED> <!ATTLIST xs:totalDigits id ID #IMPLIED> <!ATTLIST xs:fractionDigits id ID #IMPLIED> <!ATTLIST xs:maxScale id ID #IMPLIED> <!ATTLIST xs:minScale id ID #IMPLIED> <!--* <!ATTLIST xs:minFractionDigits id ID #IMPLIED> *--> <!ATTLIST xs:length id ID #IMPLIED> <!ATTLIST xs:minLength id ID #IMPLIED> <!ATTLIST xs:maxLength id ID #IMPLIED> <!ATTLIST xs:enumeration id ID #IMPLIED> <!ATTLIST xs:pattern id ID #IMPLIED> <!ATTLIST xs:lexicalMappings id ID #IMPLIED> <!--* <!ATTLIST xs:precision id ID #IMPLIED> <!ATTLIST xs:specials id ID #IMPLIED> *--> <!ATTLIST xs:appinfo id ID #IMPLIED> <!ATTLIST xs:documentation id ID #IMPLIED> <!ATTLIST xs:list id ID #IMPLIED> <!ATTLIST xs:union id ID #IMPLIED> ]> <?xml version='1.0'?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty" blockDefault="#all" elementFormDefault="qualified" xml:lang="en" targetNamespace="http://www.w3.org/2001/XMLSchema" version="Id: datatypes.xsd,v 1.4.2.10 2005/01/31 20:42:46 ht Exp "> <xs:annotation> <xs:documentation source="../datatypes/datatypes.html"> The schema corresponding to this document is normative, with respect to the syntactic constraints it expresses in the XML Schema language. The documentation (within <documentation> elements) below, is not normative, but rather highlights important aspects of the W3C Recommendation of which this is a part </xs:documentation> </xs:annotation> <xs:annotation> <xs:documentation> First the built-in primitive datatypes. These definitions are for information only, the real built-in definitions are magic. </xs:documentation> <xs:documentation> For each built-in datatype in this schema (both primitive and derived) can be uniquely addressed via a URI constructed as follows: 1) the base URI is the URI of the XML Schema namespace 2) the fragment identifier is the name of the datatype 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: 1) the base URI is the URI of the XML Schema namespace 2) the fragment identifier is the name of the facet For example, to address the maxInclusive facet, the URI is: http://www.w3.org/2001/XMLSchema#maxInclusive Additionally, each facet usage in a built-in datatype definition can be uniquely addressed via a URI constructed as follows: 1) the base URI is the URI of the XML Schema namespace 2) the fragment identifier is the name of the datatype, followed by a period (".") 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 </xs:documentation> </xs:annotation> <xs:simpleType name="string" id="string"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasProperty name="ordered" value="false"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#string"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace value="preserve" id="string.preserve"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="boolean" id="boolean"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasProperty name="ordered" value="false"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="finite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#boolean"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="boolean.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="float" id="float"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="true"/> <hfp:hasProperty name="cardinality" value="finite"/> <hfp:hasProperty name="numeric" value="true"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#float"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="float.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="double" id="double"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="true"/> <hfp:hasProperty name="cardinality" value="finite"/> <hfp:hasProperty name="numeric" value="true"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#double"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="double.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="decimal" id="decimal"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="totalDigits"/> <hfp:hasFacet name="fractionDigits"/> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="total"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="true"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#decimal"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="decimal.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="pDecimal" id="pDecimal"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="totalDigits"/> <hfp:hasFacet name="maxScale"/> <hfp:hasFacet name="minScale"/> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasFacet name="lexicalMappings"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="true"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#pDecimal"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="pDecimal.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="duration" id="duration"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#duration"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="duration.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="dateTime" id="dateTime"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#dateTime"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="dateTime.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="time" id="time"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#time"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="time.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="date" id="date"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#date"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="date.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="gYearMonth" id="gYearMonth"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="gYearMonth.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="gYear" id="gYear"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#gYear"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="gYear.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="gMonthDay" id="gMonthDay"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="gMonthDay.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="gDay" id="gDay"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#gDay"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="gDay.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="gMonth" id="gMonth"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="partial"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#gMonth"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="gMonth.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="hexBinary" id="hexBinary"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasProperty name="ordered" value="false"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#binary"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="hexBinary.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="base64Binary" id="base64Binary"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasProperty name="ordered" value="false"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="base64Binary.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="anyURI" id="anyURI"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasProperty name="ordered" value="false"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#anyURI"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="anyURI.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="QName" id="QName"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasProperty name="ordered" value="false"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#QName"/> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="QName.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="NOTATION" id="NOTATION"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <hfp:hasFacet name="pattern"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasProperty name="ordered" value="false"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/> <xs:documentation> NOTATION cannot be used directly in a schema; rather a type must be derived from it by specifying at least one enumeration facet whose value is the name of a NOTATION declared in the schema. </xs:documentation> </xs:annotation> <xs:restriction base="xs:anyAtomicType"> <xs:whiteSpace fixed="true" value="collapse" id="NOTATION.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:annotation> <xs:documentation> Now the derived primitive types </xs:documentation> </xs:annotation> <xs:simpleType name="normalizedString" id="normalizedString"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/> </xs:annotation> <xs:restriction base="xs:string"> <xs:whiteSpace value="replace" id="normalizedString.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="token" id="token"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#token"/> </xs:annotation> <xs:restriction base="xs:normalizedString"> <xs:whiteSpace value="collapse" id="token.whiteSpace"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="language" id="language"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#language"/> </xs:annotation> <xs:restriction base="xs:token"> <xs:pattern value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*" id="language.pattern"> <xs:annotation> <xs:documentation source="http://www.ietf.org/rfc/rfc3066.txt"> pattern specifies the content of section 2.12 of XML 1.0e2 and RFC 3066 (Revised version of RFC 1766). </xs:documentation> </xs:annotation> </xs:pattern> </xs:restriction> </xs:simpleType> <xs:simpleType name="IDREFS" id="IDREFS"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="pattern"/> <hfp:hasProperty name="ordered" value="false"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/> </xs:annotation> <xs:restriction> <xs:simpleType> <xs:list itemType="xs:IDREF"/> </xs:simpleType> <xs:minLength value="1" id="IDREFS.minLength"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="ENTITIES" id="ENTITIES"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="pattern"/> <hfp:hasProperty name="ordered" value="false"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/> </xs:annotation> <xs:restriction> <xs:simpleType> <xs:list itemType="xs:ENTITY"/> </xs:simpleType> <xs:minLength value="1" id="ENTITIES.minLength"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="NMTOKEN" id="NMTOKEN"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/> </xs:annotation> <xs:restriction base="xs:token"> <xs:pattern value="\c+" id="NMTOKEN.pattern"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/REC-xml#NT-Nmtoken"> pattern matches production 7 from the XML spec </xs:documentation> </xs:annotation> </xs:pattern> </xs:restriction> </xs:simpleType> <xs:simpleType name="NMTOKENS" id="NMTOKENS"> <xs:annotation> <xs:appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <hfp:hasFacet name="enumeration"/> <hfp:hasFacet name="whiteSpace"/> <hfp:hasFacet name="pattern"/> <hfp:hasProperty name="ordered" value="false"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/> </xs:annotation> <xs:restriction> <xs:simpleType> <xs:list itemType="xs:NMTOKEN"/> </xs:simpleType> <xs:minLength value="1" id="NMTOKENS.minLength"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="Name" id="Name"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#Name"/> </xs:annotation> <xs:restriction base="xs:token"> <xs:pattern value="\i\c*" id="Name.pattern"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/REC-xml#NT-Name"> pattern matches production 5 from the XML spec </xs:documentation> </xs:annotation> </xs:pattern> </xs:restriction> </xs:simpleType> <xs:simpleType name="NCName" id="NCName"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#NCName"/> </xs:annotation> <xs:restriction base="xs:Name"> <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/REC-xml-names/#NT-NCName"> pattern matches production 4 from the Namespaces in XML spec </xs:documentation> </xs:annotation> </xs:pattern> </xs:restriction> </xs:simpleType> <xs:simpleType name="ID" id="ID"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#ID"/> </xs:annotation> <xs:restriction base="xs:NCName"/> </xs:simpleType> <xs:simpleType name="IDREF" id="IDREF"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#IDREF"/> </xs:annotation> <xs:restriction base="xs:NCName"/> </xs:simpleType> <xs:simpleType name="ENTITY" id="ENTITY"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/> </xs:annotation> <xs:restriction base="xs:NCName"/> </xs:simpleType> <xs:simpleType name="integer" id="integer"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#integer"/> </xs:annotation> <xs:restriction base="xs:decimal"> <xs:lexicalMappings value="nodecimal" id="integer.lexicalMappings"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/> </xs:annotation> <xs:restriction base="xs:integer"> <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="negativeInteger" id="negativeInteger"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/> </xs:annotation> <xs:restriction base="xs:nonPositiveInteger"> <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="long" id="long"> <xs:annotation> <xs:appinfo> <hfp:hasProperty name="bounded" value="true"/> <hfp:hasProperty name="cardinality" value="finite"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#long"/> </xs:annotation> <xs:restriction base="xs:integer"> <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/> <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="int" id="int"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#int"/> </xs:annotation> <xs:restriction base="xs:long"> <xs:minInclusive value="-2147483648" id="int.minInclusive"/> <xs:maxInclusive value="2147483647" id="int.maxInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="short" id="short"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#short"/> </xs:annotation> <xs:restriction base="xs:int"> <xs:minInclusive value="-32768" id="short.minInclusive"/> <xs:maxInclusive value="32767" id="short.maxInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="byte" id="byte"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#byte"/> </xs:annotation> <xs:restriction base="xs:short"> <xs:minInclusive value="-128" id="byte.minInclusive"/> <xs:maxInclusive value="127" id="byte.maxInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/> </xs:annotation> <xs:restriction base="xs:integer"> <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="unsignedLong" id="unsignedLong"> <xs:annotation> <xs:appinfo> <hfp:hasProperty name="bounded" value="true"/> <hfp:hasProperty name="cardinality" value="finite"/> </xs:appinfo> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/> </xs:annotation> <xs:restriction base="xs:nonNegativeInteger"> <xs:maxInclusive value="18446744073709551615" id="unsignedLong.maxInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="unsignedInt" id="unsignedInt"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/> </xs:annotation> <xs:restriction base="xs:unsignedLong"> <xs:maxInclusive value="4294967295" id="unsignedInt.maxInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="unsignedShort" id="unsignedShort"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/> </xs:annotation> <xs:restriction base="xs:unsignedInt"> <xs:maxInclusive value="65535" id="unsignedShort.maxInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="unsignedByte" id="unsignedByte"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/> </xs:annotation> <xs:restriction base="xs:unsignedShort"> <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="positiveInteger" id="positiveInteger"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/> </xs:annotation> <xs:restriction base="xs:nonNegativeInteger"> <xs:minInclusive value="1" id="positiveInteger.minInclusive"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="derivationControl"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> </xs:annotation> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="substitution"/> <xs:enumeration value="extension"/> <xs:enumeration value="restriction"/> <xs:enumeration value="list"/> <xs:enumeration value="union"/> </xs:restriction> </xs:simpleType> <xs:group name="simpleDerivation"> <xs:choice> <xs:element ref="xs:restriction"/> <xs:element ref="xs:list"/> <xs:element ref="xs:union"/> </xs:choice> </xs:group> <xs:simpleType name="simpleDerivationSet"> <xs:annotation> <xs:documentation> #all or (possibly empty) subset of {restriction, union, list} </xs:documentation> <xs:documentation> A utility type, not for public use</xs:documentation> </xs:annotation> <xs:union> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="#all"/> </xs:restriction> </xs:simpleType> <xs:simpleType> <xs:list> <xs:simpleType> <xs:restriction base="xs:derivationControl"> <xs:enumeration value="list"/> <xs:enumeration value="union"/> <xs:enumeration value="restriction"/> </xs:restriction> </xs:simpleType> </xs:list> </xs:simpleType> </xs:union> </xs:simpleType> <xs:complexType name="simpleType" abstract="true"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:group ref="xs:simpleDerivation"/> <xs:attribute name="final" type="xs:simpleDerivationSet"/> <xs:attribute name="name" type="xs:NCName"> <xs:annotation> <xs:documentation> Can be restricted to required or forbidden </xs:documentation> </xs:annotation> </xs:attribute> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="topLevelSimpleType"> <xs:complexContent> <xs:restriction base="xs:simpleType"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:group ref="xs:simpleDerivation"/> </xs:sequence> <xs:attribute name="name" type="xs:NCName" use="required"> <xs:annotation> <xs:documentation> Required at the top level </xs:documentation> </xs:annotation> </xs:attribute> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="localSimpleType"> <xs:complexContent> <xs:restriction base="xs:simpleType"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:group ref="xs:simpleDerivation"/> </xs:sequence> <xs:attribute name="name" use="prohibited"> <xs:annotation> <xs:documentation> Forbidden when nested </xs:documentation> </xs:annotation> </xs:attribute> <xs:attribute name="final" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/> </xs:annotation> </xs:element> <xs:group name="facets"> <xs:annotation> <xs:documentation> We should use a substitution group for facets, but that's ruled out because it would allow users to add their own, which we're not ready for yet. </xs:documentation> </xs:annotation> <xs:choice> <xs:element ref="xs:minExclusive"/> <xs:element ref="xs:minInclusive"/> <xs:element ref="xs:maxExclusive"/> <xs:element ref="xs:maxInclusive"/> <xs:element ref="xs:totalDigits"/> <xs:element ref="xs:fractionDigits"/> <xs:element ref="xs:maxScale"/> <xs:element ref="xs:minScale"/> <xs:element ref="xs:length"/> <xs:element ref="xs:minLength"/> <xs:element ref="xs:maxLength"/> <xs:element ref="xs:enumeration"/> <xs:element ref="xs:whiteSpace"/> <xs:element ref="xs:pattern"/> </xs:choice> </xs:group> <xs:group name="simpleRestrictionModel"> <xs:sequence> <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/> <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:group> <xs:element name="restriction" id="restriction"> <xs:complexType> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-restriction"> base attribute and simpleType child are mutually exclusive, but one or other is required </xs:documentation> </xs:annotation> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:group ref="xs:simpleRestrictionModel"/> <xs:attribute name="base" type="xs:QName" use="optional"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="list" id="list"> <xs:complexType> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-list"> itemType attribute and simpleType child are mutually exclusive, but one or other is required </xs:documentation> </xs:annotation> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:sequence> <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/> </xs:sequence> <xs:attribute name="itemType" type="xs:QName" use="optional"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="union" id="union"> <xs:complexType> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-union"> memberTypes attribute must be non-empty or there must be at least one simpleType child </xs:documentation> </xs:annotation> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:sequence> <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="memberTypes" use="optional"> <xs:simpleType> <xs:list itemType="xs:QName"/> </xs:simpleType> </xs:attribute> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:complexType name="facet"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:attribute name="value" use="required"/> <xs:attribute name="fixed" type="xs:boolean" default="false" use="optional"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="noFixedFacet"> <xs:complexContent> <xs:restriction base="xs:facet"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="fixed" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:element name="minExclusive" type="xs:facet" id="minExclusive"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/> </xs:annotation> </xs:element> <xs:element name="minInclusive" type="xs:facet" id="minInclusive"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/> </xs:annotation> </xs:element> <xs:element name="maxExclusive" type="xs:facet" id="maxExclusive"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/> </xs:annotation> </xs:element> <xs:element name="maxInclusive" type="xs:facet" id="maxInclusive"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/> </xs:annotation> </xs:element> <xs:complexType name="numFacet"> <xs:complexContent> <xs:restriction base="xs:facet"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="nNNumFacet"> <xs:complexContent> <xs:restriction base="xs:facet"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="intFacet"> <xs:complexContent> <xs:restriction base="xs:facet"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="value" type="xs:integer" use="required"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="boolFacet"> <xs:complexContent> <xs:restriction base="xs:facet"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="value" type="xs:boolean" use="required"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:element name="totalDigits" id="totalDigits"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:nNNumFacet"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="value" type="xs:positiveInteger" use="required"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="fractionDigits" type="xs:numFacet" id="fractionDigits"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/> </xs:annotation> </xs:element> <xs:element name="maxScale" type="xs:intFacet" id="maxScale"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-maxScale"/> </xs:annotation> </xs:element> <xs:element name="minScale" type="xs:intFacet" id="minScale"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-minScale"/> </xs:annotation> </xs:element> <xs:element name="length" type="xs:nNNumFacet" id="length"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-length"/> </xs:annotation> </xs:element> <xs:element name="minLength" type="xs:nNNumFacet" id="minLength"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/> </xs:annotation> </xs:element> <xs:element name="maxLength" type="xs:nNNumFacet" id="maxLength"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/> </xs:annotation> </xs:element> <xs:element name="enumeration" type="xs:noFixedFacet" id="enumeration"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/> </xs:annotation> </xs:element> <xs:element name="whiteSpace" id="whiteSpace"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:facet"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="value" use="required"> <xs:simpleType> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="preserve"/> <xs:enumeration value="replace"/> <xs:enumeration value="collapse"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="lexicalMappings" id="lexicalMappings"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-lexicalMappings"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:facet"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="value" type="xs:lexMapVal" use="required"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element> <xs:simpleType name="lexMapVal"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> </xs:annotation> <xs:list> <xs:simpleType> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="nodecimal"/> <xs:enumeration value="decimal"/> <xs:enumeration value="scientific"/> </xs:restriction> </xs:simpleType> </xs:list> </xs:simpleType> <xs:element name="pattern" id="pattern"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:noFixedFacet"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="value" type="xs:string" use="required"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element> </xs:schema>
<!-- DTD for XML Schemas: Part 2: Datatypes Id: datatypes.dtd,v 1.1.2.4 2005/01/31 18:40:42 cmsmcq Exp Note this DTD is NOT normative, or even definitive. --> <!-- This DTD cannot be used on its own, it is intended only for incorporation in XMLSchema.dtd, q.v. --> <!-- Define all the element names, with optional prefix --> <!ENTITY % simpleType "%p;simpleType"> <!ENTITY % restriction "%p;restriction"> <!ENTITY % list "%p;list"> <!ENTITY % union "%p;union"> <!ENTITY % maxExclusive "%p;maxExclusive"> <!ENTITY % minExclusive "%p;minExclusive"> <!ENTITY % maxInclusive "%p;maxInclusive"> <!ENTITY % minInclusive "%p;minInclusive"> <!ENTITY % totalDigits "%p;totalDigits"> <!ENTITY % fractionDigits "%p;fractionDigits"> <!ENTITY % maxScale "%p;maxScale"> <!ENTITY % minScale "%p;minScale"> <!ENTITY % length "%p;length"> <!ENTITY % minLength "%p;minLength"> <!ENTITY % maxLength "%p;maxLength"> <!ENTITY % lexicalMappings "%p;lexicalMappings"> <!ENTITY % enumeration "%p;enumeration"> <!ENTITY % whiteSpace "%p;whiteSpace"> <!ENTITY % pattern "%p;pattern"> <!-- Customisation entities for the ATTLIST of each element type. Define one of these if your schema takes advantage of the anyAttribute='##other' in the schema for schemas --> <!ENTITY % simpleTypeAttrs ""> <!ENTITY % restrictionAttrs ""> <!ENTITY % listAttrs ""> <!ENTITY % unionAttrs ""> <!ENTITY % maxExclusiveAttrs ""> <!ENTITY % minExclusiveAttrs ""> <!ENTITY % maxInclusiveAttrs ""> <!ENTITY % minInclusiveAttrs ""> <!ENTITY % totalDigitsAttrs ""> <!ENTITY % fractionDigitsAttrs ""> <!ENTITY % lengthAttrs ""> <!ENTITY % minLengthAttrs ""> <!ENTITY % maxLengthAttrs ""> <!ENTITY % lexicalMappingsAttrs ""> <!ENTITY % maxScaleAttrs ""> <!ENTITY % minScaleAttrs ""> <!ENTITY % enumerationAttrs ""> <!ENTITY % whiteSpaceAttrs ""> <!ENTITY % patternAttrs ""> <!-- Define some entities for informative use as attribute types --> <!ENTITY % URIref "CDATA"> <!ENTITY % XPathExpr "CDATA"> <!ENTITY % QName "NMTOKEN"> <!ENTITY % QNames "NMTOKENS"> <!ENTITY % NCName "NMTOKEN"> <!ENTITY % nonNegativeInteger "NMTOKEN"> <!ENTITY % boolean "(true|false)"> <!ENTITY % simpleDerivationSet "CDATA"> <!-- #all or space-separated list drawn from derivationChoice --> <!-- Note that the use of 'facet' below is less restrictive than is really intended: There should in fact be no more than one of each of minInclusive, minExclusive, maxInclusive, maxExclusive, totalDigits, fractionDigits, length, maxLength, minLength within datatype, and the min- and max- variants of Inclusive and Exclusive are mutually exclusive. On the other hand, pattern and enumeration may repeat. --> <!ENTITY % minBound "(%minInclusive; | %minExclusive;)"> <!ENTITY % maxBound "(%maxInclusive; | %maxExclusive;)"> <!ENTITY % bounds "%minBound; | %maxBound;"> <!ENTITY % numeric "%totalDigits; | %fractionDigits; | %minScale; | %maxScale; | %lexicalMappings; "> <!ENTITY % ordered "%bounds; | %numeric;"> <!ENTITY % unordered "%pattern; | %enumeration; | %whiteSpace; | %length; | %maxLength; | %minLength;"> <!ENTITY % facet "%ordered; | %unordered;"> <!ENTITY % facetAttr "value CDATA #REQUIRED id ID #IMPLIED"> <!ENTITY % fixedAttr "fixed %boolean; #IMPLIED"> <!ENTITY % facetModel "(%annotation;)?"> <!ELEMENT %simpleType; ((%annotation;)?, (%restriction; | %list; | %union;))> <!ATTLIST %simpleType; name %NCName; #IMPLIED final %simpleDerivationSet; #IMPLIED id ID #IMPLIED %simpleTypeAttrs;> <!-- name is required at top level --> <!ELEMENT %restriction; ((%annotation;)?, (%restriction1; | ((%simpleType;)?,(%facet;)*)), (%attrDecls;))> <!ATTLIST %restriction; base %QName; #IMPLIED id ID #IMPLIED %restrictionAttrs;> <!-- base and simpleType child are mutually exclusive, one is required. restriction is shared between simpleType and simpleContent and complexContent (in XMLSchema.xsd). restriction1 is for the latter cases, when this is restricting a complex type, as is attrDecls. --> <!ELEMENT %list; ((%annotation;)?,(%simpleType;)?)> <!ATTLIST %list; itemType %QName; #IMPLIED id ID #IMPLIED %listAttrs;> <!-- itemType and simpleType child are mutually exclusive, one is required --> <!ELEMENT %union; ((%annotation;)?,(%simpleType;)*)> <!ATTLIST %union; id ID #IMPLIED memberTypes %QNames; #IMPLIED %unionAttrs;> <!-- At least one item in memberTypes or one simpleType child is required --> <!ELEMENT %maxExclusive; %facetModel;> <!ATTLIST %maxExclusive; %facetAttr; %fixedAttr; %maxExclusiveAttrs;> <!ELEMENT %minExclusive; %facetModel;> <!ATTLIST %minExclusive; %facetAttr; %fixedAttr; %minExclusiveAttrs;> <!ELEMENT %maxInclusive; %facetModel;> <!ATTLIST %maxInclusive; %facetAttr; %fixedAttr; %maxInclusiveAttrs;> <!ELEMENT %minInclusive; %facetModel;> <!ATTLIST %minInclusive; %facetAttr; %fixedAttr; %minInclusiveAttrs;> <!ELEMENT %totalDigits; %facetModel;> <!ATTLIST %totalDigits; %facetAttr; %fixedAttr; %totalDigitsAttrs;> <!ELEMENT %fractionDigits; %facetModel;> <!ATTLIST %fractionDigits; %facetAttr; %fixedAttr; %fractionDigitsAttrs;> <!ELEMENT %maxScale; %facetModel;> <!ATTLIST %maxScale; %facetAttr; %fixedAttr; %maxScaleAttrs;> <!ELEMENT %minScale; %facetModel;> <!ATTLIST %minScale; %facetAttr; %fixedAttr; %minScaleAttrs;> <!ELEMENT %lexicalMappings; %facetModel;> <!ATTLIST %lexicalMappings; %facetAttr; %fixedAttr; %lexicalMappingsAttrs;> <!ELEMENT %length; %facetModel;> <!ATTLIST %length; %facetAttr; %fixedAttr; %lengthAttrs;> <!ELEMENT %minLength; %facetModel;> <!ATTLIST %minLength; %facetAttr; %fixedAttr; %minLengthAttrs;> <!ELEMENT %maxLength; %facetModel;> <!ATTLIST %maxLength; %facetAttr; %fixedAttr; %maxLengthAttrs;> <!-- This one can be repeated --> <!ELEMENT %enumeration; %facetModel;> <!ATTLIST %enumeration; %facetAttr; %enumerationAttrs;> <!ELEMENT %whiteSpace; %facetModel;> <!ATTLIST %whiteSpace; %facetAttr; %fixedAttr; %whiteSpaceAttrs;> <!-- This one can be repeated --> <!ELEMENT %pattern; %facetModel;> <!ATTLIST %pattern; %facetAttr; %patternAttrs;>
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 application-defined limit on the maximum number
of digits they are prepared to support in these two cases, in which
case that application-defined maximum number ·must·
be clearly documented.
[Definition:] Derived datatypes are ·constructed· and ·atomic·.
Some datatypes, such as integer, describe well-known mathematically abstract systems. Others, such as the date/time datatypes, describe "real-life", "applied" systems. Certain of the systems described by datatypes, both abstract and applied, have values in their value spaces most easily described as things having several properties, which in turn have values which are in some sense "primitive" or are from the value spaces of simpler datatypes.
In this document, the arguments to functions are assumed to be "call by value" unless explicitly noted to the contrary, meaning that if the argument is modified during the processing of the algorithm, that modification is not reflected in the "outside world". On the other hand, the arguments to procedures are assumed to be "call by location", meaning that modifications are so reflected, since that is the only way the processing of the algorithm can have any effect.
Properties always have values. [Definition:] An optional property is permitted but not required to have the special value absent.
Those values that are more primitive, and are used (among other things) herein to construct object value spaces but which we do not explicitly define are described here:
The following standard operators are defined here in case the reader is unsure of their definition:
e
' | 'E
') noDecimalPtNumeral
Some numerical datatypes include some or all of three constant non-numerical values: positiveInfinity, negativeInfinity, and notANumber. Their lexical spaces include non-numeral lexical representations for these non-numeric values:
There are several different primitive but related datatypes defined in the specification which pertain to various combinations of dates and times, and parts thereof. They all use related value-space models, which are described in detail in this section. It is not difficult for a casual reader of the descriptions of the individual datatypes elsewhere in this specification to misunderstand some of the details of just what the datatypes are intended to represent, so more detail is presented here in this section.
All of the value spaces for dates and times described here represent moments or periods of time in Universal Coordinated Time (UTC). [Definition:] Universal Coordinated Time (UTC) is an adaptation of TAI which closely approximates UT1 by adding ·leap-seconds· to selected ·UTC· days.
[Definition:] A leap-second is an additional second added to the last day of December, June, October, or March, when such an adjustment is deemed necessary by the International Earth Rotation and Reference Systems Service in order to keep ·UTC· within 0.9 seconds of observed astronomical time. When leap seconds are introduced, the last minute in the day has more than sixty seconds. In theory leap seconds can also be removed from a day, but this has not yet occurred.
There are two distinct ways to model moments in time: either by tracking their year, month, day, hour, minute and second (with fractional seconds as needed), or by tracking their time (measured generally in seconds or days) from some starting moment. Each has its advantages. The two are isomorphic; the Gregorian calendar algorithm, modified for ·leap-seconds·, is the isomorphism from the first to the second and is one-to-one. For definiteness, we choose to model the first using five integer and one decimal number properties. We superimpose the second by providing one decimal number-valued function which gives the corresponding count of seconds from zero (the "time on the time line").
There is also a seventh integer property which specifies the timezone. Values for the six primary properties are always stored in their "local" values (the values shown in the lexical representations), rather than converted to ·UTC·.
The model just described is called herein the "seven-property" model for date/time datatypes. It is used "as is" for dateTime; all other date/time datatypes except duration use the same model except that some of the six primary properties are required to have the value absent, instead of being required to have a numerical value. (An ·optional· property, like ·timezone·, is always permitted to have the value absent.)
·timezone· values are limited to 14 hours, which is 840 (= 60 × 14) minutes.
As of the time this specification was published, leap-seconds (always one leap-second) have been introduced by the responsible authorities at the end (in ·UTC·) of the following days:
While calculating, property values from the dateTime 1972-12-31T00:00:00 are used to fill in for those that are absent, except that if ·day· is absent but ·month· is not, the largest permitted day for that month is used. 1972-12-31T00:00:00 happens to permit both the maximum number of days and the maximum number of seconds.
Values from any one date/time datatype using the seven-component model (all except duration) are ordered the same as their ·timeOnTimeline· values, except that if one value's ·timezone· is absent and the other's is not, and using maximum and minimum ·timezone· values for the one whose ·timezone· is actually absent changes the resulting (strict) inequality, the original two values are incomparable.
[Definition:] Each lexical representation is made up of certain date/time fragments, each of which corresponds to a particular property of the datatype value. They are defined by the following productions.
Each fragment other than timezoneFrag defines a subset of the ·lexical space· of pDecimal; the corresponding ·lexical mapping· is the pDecimal ·lexical mapping· restricted to that subset. These fragment ·lexical mappings· are combined separately for each date/time datatype (other than duration) to make up ·the complete lexical mapping· for that datatype. The ·yearFragValue· mapping is used to obtain the value of the ·year· property, the ·monthFragValue· mapping is used to obtain the value of the ·month· property, etc. Each datatype which specifies some properties to be mandatorily absent also does not permit the corresponding lexical fragments in its lexical representations.
(The redundancy between 'Z
', '+00:00
',
and '-00:00
',
and the possibility of trailing fractional '0
'
digits for secondFrag, are the only
redundancies preventing these mappings from being one-to-one.)
The following fragment ·canonical mappings· for each value-object property are combined as appropriate to make the ·canonical mapping· for each date/time datatype (other than duration):
The more important functions and procedures defined here are summarized in the text When there is a text summary, the name of the function in each is a "hot-link" to the same name in the other. All other links to these functions link to the complete definition in this section.
The following functions are used with various numeric and date/time datatypes.
d | : | matches digit |
0
' ,1
' ,2
' ,S | : | a finite sequence of character strings, each term matching digit. |
S | : | a finite sequence of character strings, each term matching digit. |
N | : | matches fracFrag |
N | : | matches unsignedNoDecimalPtNumeral |
N | : | matches noDecimalPtNumeral |
+
' or '-
') and then
a character string U that matches unsignedNoDecimalPtNumeral.-
' is present, andD | : | matches unsignedDecimalPtNumeral |
N | : | matches decimalPtNumeral |
+
' or '-
') and then
an instance U of unsignedDecimalPtNumeral.-
' is present, andN | : | matches scientificNotationNumeral |
e
' or an 'E
', and then an instance
E of noDecimalPtNumeral..
' is present in N, andi | : | between 0 and 9 inclusive |
0
' when i = 0 ,1
' when i = 1 ,2
' when i = 2 ,i | : | a nonnegative integer |
i | : | a nonnegative integer |
s | : | a sequence of nonnegative integers |
f | : | nonnegative and less than 1 |
f | : | nonnegative and less than 1 |
f | : | nonnegative and less than 1 |
i | : | a nonnegative integer |
i | : | an integer |
-
' & ·unsignedNoDecimalPtCanonicalMap·(–i)
when i is negative,n | : | a nonnegative decimal number |
.
' & ·fractionDigitsCanonicalFragmentMap·(n·mod·1) .n | : | a decimal number |
-
' & ·unsignedDecimalPtCanonicalMap·(–i)
when i is negative,n | : | a nonnegative decimal number |
E
' &
·noDecimalPtCanonicalMap·(log(n) ·div· 1)
n | : | a decimal number |
-
' & ·unsignedScientificCanonicalMap·(–n)
when n is negative,For example:
123
'4567
'123.4567
'S | : | matches numericalSpecialRep |
INF
' or '+INF
',-INF
', andNaN
'
c | : | one of positiveInfinity, negativeInfinity, and notANumber |
INF
' when c is positiveInfinity-INF
' when c is negativeInfinityNaN
' when c is notANumberLEX | : | matches decimalPtNumeral |
.
') and may
optionally contain a following fracFrag F consisting of some number
n of digits.LEX | : | matches scientificNotationNumeral |
E
' or 'e
',
and a following noDecimalPtNumeral E.LEX | : | matches pDecimalRep |
Let | pD be a complete pDecimal value. |
NaN
'-
', andLEX | : | matches decimalLexicalRep |
Let | d be a decimal value. |
d | : | a decimal value |
pD | : | a pDecimal value |
0
'.0
',
preceded by a decimal point if and only if
m contains no decimal point and
aP + p – f is
greater than zero.E
' & n.
When adding and subtracting numbers from date/time properties, the immediate results may not conform to the limits specified. Accordingly, the following procedures are used to "normalize" potential property values to corresponding values that do conform to the appropriate limits. Normalization is required when dealing with timezone changes (as when converting to ·UTC· from "local" values) and when adding duration values to or subtracting them from dateTime values.
yr | : | an integer |
mo | : | an integer |
yr | : | an integer |
mo | : | an integer |
da | : | an integer |
yr | : | an integer |
mo | : | an integer |
da | : | an integer |
hr | : | an integer |
mi | : | an integer |
yr | : | an integer |
yr | : | an integer |
da | : | an integer |
hr | : | an integer |
mi | : | an integer |
se | : | a decimal number |
yr | : | an integer |
mo | : | an integer |
da | : | an integer |
hr | : | an integer |
mi | : | an integer |
se | : | a decimal number |
y | : | an ·optional· integer |
m | : | an integer between 1 and 12 |
dt | : | a date/timeSevenPropertyModel value |
rawYr | : | an ·optional· integer |
rawMo | : | an ·optional· integer |
rawDa | : | an ·optional· integer |
rawHr | : | an ·optional· integer |
rawMi | : | an ·optional· integer |
rawSe | : | an ·optional· decimal number |
Let |
|
dt | : | a date/timeSevenPropertyModel value |
Let |
YR | : | matches yearFrag |
MO | : | matches monthFrag |
DA | : | matches dayFrag |
HR | : | matches hourFrag |
MI | : | matches minuteFrag |
SE | : | matches secondFrag |
TZ | : | matches timezoneFrag |
Z
', or
a sign ('+
' or '-
') followed by an instance H of
hourFrag, a colon, and an instance M of minuteFrag
Z
',-
', andLEX | : | matches dateTimeLexicalRep |
Let | dt be a date/timeSevenPropertyModel value with all property values absent. |
LEX | : | matches timeLexicalRep |
Let | ti be a date/timeSevenPropertyModel value with all property values absent. |
LEX | : | matches dateLexicalRep |
Let | da be a date/timeSevenPropertyModel value with all property values absent. |
LEX | : | matches gYearMonthLexicalRep |
Let | gYM be a date/timeSevenPropertyModel value with all property values absent. |
LEX | : | matches gYearLexicalRep |
Let | gY be a date/timeSevenPropertyModel value with all property values absent. |
LEX | : | matches gMonthDayLexicalRep |
Let | gMD be a date/timeSevenPropertyModel value with all property values absent. |
LEX | : | matches gDayLexicalRep |
Let | gD be a date/timeSevenPropertyModel value with all property values absent. |
LEX | : | matches gMonthLexicalRep |
Let | gM be a date/timeSevenPropertyModel value with all property values absent. |
i | : | a nonnegative integer less than 100 |
i | : | an integer whose absolute value is less than 10000 |
-
' & ·unsTwoDigitCanonicalFragmentMap·(–i ·div· 100) &
·unsTwoDigitCanonicalFragmentMap·(–i ·mod· 100) when
i is negative,y | : | an integer |
m | : | an integer between 1 and 12 inclusive |
d | : | an integer between 1 and 31 inclusive (may be limited further depending on associated ·year· and ·month·) |
h | : | an integer between 0 and 23 inclusive. |
m | : | an integer between 0 and 59 inclusive. |
s | : | a nonnegative decimal number less than 70 |
.
' & ·fractionDigitsCanonicalFragmentMap·(s·mod·1)
otherwise.t | : | an integer between –840 and 840 inclusive |
Z
' when t is zero,-
' & ·unsTwoDigitCanonicalFragmentMap·(–t ·div· 60) &
':
' &
·unsTwoDigitCanonicalFragmentMap·(–t ·mod· 60) when
t is negative, and+
' & ·unsTwoDigitCanonicalFragmentMap·(t ·div· 60) &
':
' &
·unsTwoDigitCanonicalFragmentMap·(t ·mod· 60) otherwise.dt | : | a complete dateTime value |
Let |
DT be
·yearCanonicalFragmentMap·(dt's ·year·) &
'- ' &
·monthCanonicalFragmentMap·(dt's ·month·) &
'- ' &
·dayCanonicalFragmentMap·(dt's ·day·) &
'T ' &
·hourCanonicalFragmentMap·(dt's ·hour·) &
': ' &
·minuteCanonicalFragmentMap·(dt's ·minute·) &
': ' &
·secondCanonicalFragmentMap·(dt's ·second·) .
|
ti | : | a complete time value |
Let |
T be
·hourCanonicalFragmentMap·(ti's ·hour·) &
': ' &
·minuteCanonicalFragmentMap·(ti's ·minute·) &
': ' &
·secondCanonicalFragmentMap·(ti's ·second·) .
|
da | : | a complete date value |
Let |
D be
·yearCanonicalFragmentMap·(da's ·year·) &
'- ' &
·monthCanonicalFragmentMap·(da's ·month·) &
'- ' &
·dayCanonicalFragmentMap·(da's ·day·) .
|
ym | : | a complete gYearMonth value |
Let |
YM be
·yearCanonicalFragmentMap·(ym's ·year·) &
'- ' &
·monthCanonicalFragmentMap·(ym's ·month·) .
|
gY | : | a complete gYear value |
md | : | a complete gMonthDay value |
Let |
MD be '-- ' &
·monthCanonicalFragmentMap·(md's ·month·) &
'- ' &
·dayCanonicalFragmentMap·(md's ·day·) .
|
gD | : | a complete gDay value |
---
' &
·dayCanonicalFragmentMap·(gD's ·day·)
when
gD's ·timezone·
is absent, and---
' &
·dayCanonicalFragmentMap·(gD's ·day·) &
·timezoneCanonicalFragmentMap·(gD's ·timezone·)
otherwise.gM | : | a complete gMonth value |
--
' &
·monthCanonicalFragmentMap·(gM's ·day·)
when
gM's ·timezone·
is absent, and--
' &
·monthCanonicalFragmentMap·(gM's ·day·) &
·timezoneCanonicalFragmentMap·(gM's ·timezone·)
otherwise.The following table shows the values of the fundamental facets for each ·built-in· datatype.
Datatype | ordered | bounded | cardinality | numeric | ||
---|---|---|---|---|---|---|
derived | string | false | false | countably infinite | false | |
boolean | false | false | finite | false | ||
float | partial | true | finite | true | ||
double | partial | true | finite | true | ||
decimal | total | false | countably infinite | true | ||
pDecimal | partial | false | countably infinite | true | ||
duration | partial | false | countably infinite | false | ||
dateTime | partial | false | countably infinite | false | ||
time | partial | false | countably infinite | false | ||
date | partial | false | countably infinite | false | ||
gYearMonth | partial | false | countably infinite | false | ||
gYear | partial | false | countably infinite | false | ||
gMonthDay | partial | false | countably infinite | false | ||
gDay | partial | false | countably infinite | false | ||
gMonth | partial | false | countably infinite | false | ||
hexBinary | false | false | countably infinite | false | ||
base64Binary | false | false | countably infinite | false | ||
anyURI | false | false | countably infinite | false | ||
QName | false | false | countably infinite | false | ||
NOTATION | false | false | countably infinite | false | ||
normalizedString | false | false | countably infinite | false | ||
token | false | false | countably infinite | false | ||
language | false | false | countably infinite | false | ||
IDREFS | false | false | countably infinite | false | ||
ENTITIES | false | false | countably infinite | false | ||
NMTOKEN | false | false | countably infinite | false | ||
NMTOKENS | false | false | countably infinite | false | ||
Name | false | false | countably infinite | false | ||
NCName | false | false | countably infinite | false | ||
ID | false | false | countably infinite | false | ||
IDREF | false | false | countably infinite | false | ||
ENTITY | false | false | countably infinite | false | ||
integer | total | false | countably infinite | true | ||
nonPositiveInteger | total | false | countably infinite | true | ||
negativeInteger | total | false | countably infinite | true | ||
long | total | true | finite | true | ||
int | total | true | finite | true | ||
short | total | true | finite | true | ||
byte | total | true | finite | true | ||
nonNegativeInteger | total | false | countably infinite | true | ||
unsignedLong | total | true | finite | true | ||
unsignedInt | total | true | finite | true | ||
unsignedShort | total | true | finite | true | ||
unsignedByte | total | true | finite | true | ||
positiveInteger | total | false | countably infinite | true |
Given a dateTime S and a duration D, this appendix specifies how to compute a dateTime E where E is the end of the time period with start S and duration D i.e. E = S + D. Such computations are used, for example, to determine whether a dateTime is within a specific time period. This appendix also addresses the addition of durations to the datatypes date, gYearMonth, gYear, gDay and gMonth, which can be viewed as a set of dateTimes. In such cases, the addition is made to the first or starting dateTime in the set.
This is a logical explanation of the process. Actual implementations are free to optimize as long as they produce the same results. The calculation uses the notation S[year] to represent the year field of S, S[month] to represent the month field, and so on. It also depends on the following functions:
31 | M = January, March, May, July, August, October, or December | |
30 | M = April, June, September, or November | |
29 | M = February AND (modulo(Y, 400) = 0 OR (modulo(Y, 100) != 0) AND modulo(Y, 4) = 0) | |
28 | Otherwise |
Essentially, this calculation is equivalent to separating D into <year,month> and <day,hour,minute,second> fields. The <year,month> is added to S. If the day is out of range, it is pinned to be within range. Thus April 31 turns into April 30. Then the <day,hour,minute,second> is added. This latter addition can cause the year and month to change.
Leap seconds are handled by the computation by treating them as overflows. Essentially, a value of 60 seconds in S is treated as if it were a duration of 60 seconds added to S (with a zero seconds field). All calculations thereafter use 60 seconds per minute.
Thus the addition of either PT1M or PT60S to any dateTime will always produce the same result. This is a special definition of addition which is designed to match common practice, and -- most importantly -- be stable over time.
A definition that attempted to take leap-seconds into account would need to be constantly updated, and could not predict the results of future implementation's additions. The decision to introduce a leap second in ·UTC· is the responsibility of the [International Earth Rotation Service (IERS)]. They make periodic announcements as to when leap seconds are to be added, but this is not known more than a year in advance. For more information on leap seconds, see [U.S. Naval Observatory Time Service Department].
The following is the precise specification. These steps must be followed in the same order. If a field in D is not specified, it is treated as if it were zero. If a field in S is not specified, it is treated in the calculation as if it were the minimum allowed value in that field, however, after the calculation is concluded, the corresponding field in E is removed (set to unspecified).
Examples:
dateTime | duration | result |
---|---|---|
2000-01-12T12:13:14Z | P1Y3M5DT7H10M3.3S | 2001-04-17T19:23:17.3Z |
2000-01 | -P3M | 1999-10 |
2000-01-12 | PT33H | 2000-01-13 |
Time durations are added by simply adding each of their fields, respectively, without overflow.
The order of addition of durations to instants is significant. For example, there are cases where:
((dateTime + duration1) + duration2) != ((dateTime + duration2) + duration1)
Example:
(2000-03-30 + P1D) + P1M = 2000-03-31 + P1M = 2000-04-30
(2000-03-30 + P1M) + P1D = 2000-04-30 + P1D = 2000-05-01
A ·regular expression· R is a sequence of characters that denote a set of strings L(R). When used to constrain a ·lexical space·, a regular expression R asserts that only strings in L(R) are valid literals for values of that type.
A
(#x41) and end with the character
Z
(#x5a) would be defined as follows:
<simpleType name='myString'> <restriction base='string'> <pattern value='A.*Z'/> </restriction> </simpleType>In regular expression languages that are not implicitly anchored at the head and tail, it is customary to write the equivalent regular expression as:
^A.*Z$
where "^" anchors the pattern at the head and "$" anchors at the tail.
In those rare cases where an unanchored match is desired, including
.*
at the beginning and ending of the regular expression will
achieve the desired results. For example, a datatype ·derived· from string such that all values must contain at least 3 consecutive A
(#x41
) characters somewhere within the value could be defined as follows:<simpleType name='myString'> <restriction base='string'> <pattern value='.*AAA.*'/> </restriction> </simpleType>
[Definition:] A
regular expression is composed from zero or more
·branch·es, separated by |
characters.
Regular Expression | ||||
|
For all ·branch·es S, and for all ·regular expression·s T, valid ·regular expression·s R are: | Denoting the set of strings L(R) containing: |
---|---|
(empty string) | the set containing just the empty string |
S | all strings in L(S) |
S|T | all strings in L(S) and all strings in L(T) |
[Definition:] A branch consists of zero or more ·piece·s, concatenated together.
Branch | ||||
|
For all ·piece·s S, and for all ·branch·es T, valid ·branch·es R are: | Denoting the set of strings L(R) containing: |
---|---|
S | all strings in L(S) |
ST | all strings st with s in L(S) and t in L(T) |
[Definition:] A piece is an ·atom·, possibly followed by a ·quantifier·.
Piece | ||||
|
For all ·atom·s S and non-negative integers n, m such that n <= m, valid ·piece·s R are: | Denoting the set of strings L(R) containing: |
---|---|
S | all strings in L(S) |
S? | the empty string, and all strings in L(S). |
S* | All strings in L(S?) and all strings st with s in L(S*) and t in L(S). ( all concatenations of zero or more strings from L(S) ) |
S+ | All strings st with s in L(S) and t in L(S*). ( all concatenations of one or more strings from L(S) ) |
S{n,m} | All strings st with s in L(S) and t in L(S{n-1,m-1}). ( All sequences of at least n, and at most m, strings from L(S) ) |
S{n} | All strings in L(S{n,n}). ( All sequences of exactly n strings from L(S) ) |
S{n,} | All strings in L(S{n}S*) ( All sequences of at least n, strings from L(S) ) |
S{0,m} | All strings st with s in L(S?) and t in L(S{0,m-1}). ( All sequences of at most m, strings from L(S) ) |
S{0,0} | The set containing only the empty string |
S{,m}
, since it is logically equivalent to S{0,m}
.
We have, therefore, left this logical possibility out of the regular
expression language defined by this specification.
[Definition:]
A quantifier
is one of ?
, *
, +
,
{n,m}
or {n,}
, which have the meanings
defined in the table above.
Quanitifer | ||||||||||||||||||||
|
[Definition:] An atom is either a ·normal character·, a ·character class·, or a parenthesized ·regular expression·.
Atom | ||||
|
For all ·normal character·s c, ·character class·es C, and ·regular expression·s S, valid ·atom·s R are: | Denoting the set of strings L(R) containing: |
---|---|
c | the single string consisting only of c |
C | all strings in L(C) |
(S) | all strings in L(S) |
[Definition:]
A metacharacter
is either .
, \
, ?
,
*
, +
, {
, }
(
, )
, [
or ]
.
These characters have special meanings in ·regular expression·s,
but can be escaped to form ·atom·s that denote the
sets of strings containing only themselves, i.e., an escaped
·metacharacter· behaves like a ·normal character·.
[Definition:] A normal character is any XML character that is not a metacharacter. In ·regular expression·s, a normal character is an atom that denotes the singleton set of strings containing only itself.
Normal Character | ||||
|
Note that a ·normal character· can be represented either as itself, or with a character reference.
[Definition:] A character class is an ·atom· R that identifies a set of characters C(R). The set of strings L(R) denoted by a character class R contains one single-character string "c" for each character c in C(R).
Character Class | ||||
|
A character class is either a ·character class escape· or a ·character class expression·.
[Definition:]
A
character class expression is a ·character group· surrounded
by [
and ]
characters. For all character
groups G, [G] is a valid character class
expression, identifying the set of characters
C([G]) = C(G).
Character Class Expression | ||||
|
[Definition:] A character group is either a ·positive character group·, a ·negative character group·, or a ·character class subtraction·.
Character Group | ||||
|
[Definition:] A positive character group consists of one or more ·character range·s or ·character class escape·s, concatenated together. A positive character group identifies the set of characters containing all of the characters in all of the sets identified by its constituent ranges or escapes.
Positive Character Group | ||||
|
For all ·character range·s R, all ·character class escape·s E, and all ·positive character group·s P, valid ·positive character group·s G are: | Identifying the set of characters C(G) containing: |
---|---|
R | all characters in C(R). |
E | all characters in C(E). |
RP | all characters in C(R) and all characters in C(P). |
EP | all characters in C(E) and all characters in C(P). |
[Definition:]
A negative character group is a
·positive character group· preceded by the ^
character.
For all ·positive character group·s P, ^P
is a valid negative character group, and C(^P)
contains all XML characters that are not in C(P).
Negative Character Group | ||||
|
[Definition:]
A
character class subtraction is a ·character class expression·
subtracted from a ·positive character group· or
·negative character group·, using the -
character.
Character Class Subtraction | ||||
|
For any ·positive character group· or ·negative character group· G, and any ·character class expression· C, G-C is a valid ·character class subtraction·, identifying the set of all characters in C(G) that are not also in C(C).
[Definition:] A character range R identifies a set of characters C(R) containing all XML characters with UCS code points in a specified range.
Character Range | ||||||||||||||||||||
|
A single XML character is a ·character range· that identifies the set of characters containing only itself. All XML characters are valid character ranges, except as follows:
[
, ]
, -
and \
characters are not
valid character ranges;
^
character is only valid at the beginning of a
·positive character group· if it is part of a
·negative character group·
A ·character range· ·may· also be written in the form s-e, identifying the set that contains all XML characters with UCS code points greater than or equal to the code point of s, but not greater than the code point of e.
s-e is a valid character range iff:
\
^
\
or [
; and
[Definition:] A character class escape is a short sequence of characters that identifies predefined character class. The valid character class escapes are the ·single character escape·s, the ·multi-character escape·s, and the ·category escape·s (including the ·block escape·s).
Character Class Escape | ||||
|
[Definition:] A single character escape identifies a set containing a only one character -- usually because that character is difficult or impossible to write directly into a ·regular expression·.
Single Character Escape | ||||
|
The valid ·single character escape·s are: | Identifying the set of characters C(R) containing: |
---|---|
\n | the newline character (#xA) |
\r | the return character (#xD) |
\t | the tab character (#x9) |
\\ | \ |
\| | | |
\. | . |
\- | - |
\^ | ^ |
\? | ? |
\* | * |
\+ | + |
\{ | { |
\} | } |
\( | ( |
\) | ) |
\[ | [ |
\] | ] |
[Definition:]
[Unicode Database] specifies a number of possible
values for the "General Category" property
and provides mappings from code points to specific character properties.
The set containing all characters that have property X
,
can be identified with a category escape \p{X}
.
The complement of this set is specified with the
category escape \P{X}
.
([\P{X}]
= [^\p{X}]
).
Category Escape | ||||||||||||
|
The following table specifies the recognized values of the "General Category" property.
Category | Property | Meaning |
---|---|---|
Letters | L | All Letters |
Lu | uppercase | |
Ll | lowercase | |
Lt | titlecase | |
Lm | modifier | |
Lo | other | |
Marks | M | All Marks |
Mn | nonspacing | |
Mc | spacing combining | |
Me | enclosing | |
Numbers | N | All Numbers |
Nd | decimal digit | |
Nl | letter | |
No | other | |
Punctuation | P | All Punctuation |
Pc | connector | |
Pd | dash | |
Ps | open | |
Pe | close | |
Pi | initial quote (may behave like Ps or Pe depending on usage) | |
Pf | final quote (may behave like Ps or Pe depending on usage) | |
Po | other | |
Separators | Z | All Separators |
Zs | space | |
Zl | line | |
Zp | paragraph | |
Symbols | S | All Symbols |
Sm | math | |
Sc | currency | |
Sk | modifier | |
So | other | |
Other | C | All Others |
Cc | control | |
Cf | format | |
Co | private use | |
Cn | not assigned |
Categories | ||||||||||||||||||||||||||||||||
|
Cs
property.
The Cs
property identifies "surrogate" characters, which do not
occur at the level of the "character abstraction" that XML instance documents
operate on.
[Definition:]
[Unicode Database] groups code points into a number of blocks
such as Basic Latin (i.e., ASCII), Latin-1 Supplement, Hangul Jamo,
CJK Compatibility, etc.
The set containing all characters that have block name X
(with all white space stripped out),
can be identified with a block escape \p{IsX}
.
The complement of this set is specified with the
block escape \P{IsX}
.
([\P{IsX}]
= [^\p{IsX}]
).
Block Escape | ||||
|
The following table specifies the recognized block names (for more information, see the "Blocks.txt" file in [Unicode Database]).
Start Code | End Code | Block Name | Start Code | End Code | Block Name | |
---|---|---|---|---|---|---|
#x0000 | #x007F | BasicLatin | #x0080 | #x00FF | Latin-1Supplement | |
#x0100 | #x017F | LatinExtended-A | #x0180 | #x024F | LatinExtended-B | |
#x0250 | #x02AF | IPAExtensions | #x02B0 | #x02FF | SpacingModifierLetters | |
#x0300 | #x036F | CombiningDiacriticalMarks | #x0370 | #x03FF | Greek | |
#x0400 | #x04FF | Cyrillic | #x0530 | #x058F | Armenian | |
#x0590 | #x05FF | Hebrew | #x0600 | #x06FF | Arabic | |
#x0700 | #x074F | Syriac | #x0780 | #x07BF | Thaana | |
#x0900 | #x097F | Devanagari | #x0980 | #x09FF | Bengali | |
#x0A00 | #x0A7F | Gurmukhi | #x0A80 | #x0AFF | Gujarati | |
#x0B00 | #x0B7F | Oriya | #x0B80 | #x0BFF | Tamil | |
#x0C00 | #x0C7F | Telugu | #x0C80 | #x0CFF | Kannada | |
#x0D00 | #x0D7F | Malayalam | #x0D80 | #x0DFF | Sinhala | |
#x0E00 | #x0E7F | Thai | #x0E80 | #x0EFF | Lao | |
#x0F00 | #x0FFF | Tibetan | #x1000 | #x109F | Myanmar | |
#x10A0 | #x10FF | Georgian | #x1100 | #x11FF | HangulJamo | |
#x1200 | #x137F | Ethiopic | #x13A0 | #x13FF | Cherokee | |
#x1400 | #x167F | UnifiedCanadianAboriginalSyllabics | #x1680 | #x169F | Ogham | |
#x16A0 | #x16FF | Runic | #x1780 | #x17FF | Khmer | |
#x1800 | #x18AF | Mongolian | #x1E00 | #x1EFF | LatinExtendedAdditional | |
#x1F00 | #x1FFF | GreekExtended | #x2000 | #x206F | GeneralPunctuation | |
#x2070 | #x209F | SuperscriptsandSubscripts | #x20A0 | #x20CF | CurrencySymbols | |
#x20D0 | #x20FF | CombiningMarksforSymbols | #x2100 | #x214F | LetterlikeSymbols | |
#x2150 | #x218F | NumberForms | #x2190 | #x21FF | Arrows | |
#x2200 | #x22FF | MathematicalOperators | #x2300 | #x23FF | MiscellaneousTechnical | |
#x2400 | #x243F | ControlPictures | #x2440 | #x245F | OpticalCharacterRecognition | |
#x2460 | #x24FF | EnclosedAlphanumerics | #x2500 | #x257F | BoxDrawing | |
#x2580 | #x259F | BlockElements | #x25A0 | #x25FF | GeometricShapes | |
#x2600 | #x26FF | MiscellaneousSymbols | #x2700 | #x27BF | Dingbats | |
#x2800 | #x28FF | BraillePatterns | #x2E80 | #x2EFF | CJKRadicalsSupplement | |
#x2F00 | #x2FDF | KangxiRadicals | #x2FF0 | #x2FFF | IdeographicDescriptionCharacters | |
#x3000 | #x303F | CJKSymbolsandPunctuation | #x3040 | #x309F | Hiragana | |
#x30A0 | #x30FF | Katakana | #x3100 | #x312F | Bopomofo | |
#x3130 | #x318F | HangulCompatibilityJamo | #x3190 | #x319F | Kanbun | |
#x31A0 | #x31BF | BopomofoExtended | #x3200 | #x32FF | EnclosedCJKLettersandMonths | |
#x3300 | #x33FF | CJKCompatibility | #x3400 | #x4DB5 | CJKUnifiedIdeographsExtensionA | |
#x4E00 | #x9FFF | CJKUnifiedIdeographs | #xA000 | #xA48F | YiSyllables | |
#xA490 | #xA4CF | YiRadicals | #xAC00 | #xD7A3 | HangulSyllables | |
#xE000 | #xF8FF | PrivateUse | ||||
#xF900 | #xFAFF | CJKCompatibilityIdeographs | #xFB00 | #xFB4F | AlphabeticPresentationForms | |
#xFB50 | #xFDFF | ArabicPresentationForms-A | #xFE20 | #xFE2F | CombiningHalfMarks | |
#xFE30 | #xFE4F | CJKCompatibilityForms | #xFE50 | #xFE6F | SmallFormVariants | |
#xFE70 | #xFEFE | ArabicPresentationForms-B | #xFEFF | #xFEFF | Specials | |
#xFF00 | #xFFEF | HalfwidthandFullwidthForms | #xFFF0 | #xFFFD | Specials |
HighSurrogates
,
LowSurrogates
and HighPrivateUseSurrogates
blocks.
These blocks identify "surrogate" characters, which do not
occur at the level of the "character abstraction" that XML instance documents
operate on.
For example, the ·block escape· for identifying the
ASCII characters is \p{IsBasicLatin}
.
[Definition:] A multi-character escape provides a simple way to identify a commonly used set of characters:
Multi-Character Escape | ||||||||
|
Character sequence | Equivalent ·character class· |
---|---|
. | [^\n\r] |
\s | [#x20\t\n\r] |
\S | [^\s] |
\i | the set of initial name characters, those ·match·ed by Letter | '_' | ':' |
\I | [^\i] |
\c | the set of name characters, those ·match·ed by NameChar |
\C | [^\c] |
\d | \p{Nd} |
\D | [^\d] |
\w | [#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}] (all characters except the set of "punctuation", "separator" and "other" characters) |
\W | [^\w] |
The revision of duration (including the new derived datatypes yearMonthDuration and dayTimeDuration), in duration (§3.2.7), yearMonthDuration (§3.3.26) and dayTimeDuration (§3.3.27), has been approved.
The model of an abstract datatype has been made more precise and explicit. Datatype System (§2) has mostly been rewritten and been "formally blessed" by the WG. Driving this new text is not only a desire on the part of the WG to make it "more precise and explicit" but also a specific formal requirement to redo the handling of facets (RQ-24 (systematic facets)). The primary intent of this requirement was to move the description of equality, identity, and order to Value space (§2.2).
RQ-24 (systematic facets: separate identity and equality) directed that we provide for equality that in some cases was different from identity. Most datatypes still use identity as their equality, but the new precisionDecimal and the redesigned date/time datatypes will not. It is also intended that float and double will use this capability to separate minus zero from plus zero; they will be non-identical but equal (see RQ-140).
The {value} of the bounded component for list datatypes is now always false, reflecting the fact that ·list· datatypes are not ordered (except by the trivial order), and hence cannot reasonably be bounded.
Units of length have been selected for all datatypes that are permitted the length constraining facet (RQ-6 (length for [almost] all primitive types)).
The pDecimal datatype has been added. It is intended to support the floating-point decimal datatypes defined in the forthcoming version of IEEE 754. The pDecimal datatype differs from decimal in that values carry not only a numeric value but also an (arithmetic) precision.
RQ-2 (canonical rep of duration) resulted in the adoption of a new two-property model for duration and the rewriting of duration (§3.2.7). A few additional changes have been proposed, and in versions of this specification that show adds and dels these changes are so marked. In addition, two new derived datatypes (yearMonthDuration and dayTimeDuration) have been added in satisfaction of RQ-20 (ordered duration types).
RQ-122 (define dateTime value space) has resulted in a revision of the value space for all date/time datatypes (except duration, which was changed as a result of another requirement). The most visible effect of this change was to cause the values to retain knowledge of their timezone, which is explained in the new material. The new version specifies a seven-property model used uniformly for values in all of these datatypes, described in The Seven-property Model (§D.2.1). Only gDay (§3.2.14) has been rewritten to match this new generic approach; the other date/time datatype descriptions will be rewritten in a future draft. These rewrites and the new Date/time Values (§D.2) have not yet been approved by the WG; in versions of this specification that show adds and dels, this material shows as a proposed change.
The seven property model rewrite of date/time datatype descriptions includes a carefully crafted definition of order
that insures that for repeating datatypes (time, gDay, etc.), timezoned values will be compared as though they are on
the same "calendar day" ("local" property values) so that in any given timezone, the days start at "local" 00:00:00 and
end not quite including "local" 24:00:00. Days are not 00:00:00Z to 24:00:00Z in timezones other than Z. This covers
the requirements of RQ-13 (time zone crosses date line). In addition,
in satisfaction of RQ-123 (year 0000 in date/time datatypes), the lexical
representation '0000
' for years is made legal and the mapping of values with negative years onto the timeline
has been changed to match. E.g., the year 0000 is 1 B.C.E., the year –0001 is 2 B.C.E., etc. (This is a
change from version 1.0 of this specification.)
In addition to the changes already made, the Working Group has decided on a number of further changes which have not yet been reflected in this draft. These are indicated throughout the text as issues, including more or less detail on the intended resolution. The ones remaining in this draft are summarized below, linked to their occurrence in the text above, where more detail can be found, including links to the original requirement or other point of origin.
The listing below is for the benefit of readers of a printed version of this document: it collects together all the definitions which appear in the document above.
Along with the editors thereof, the following contributed material to the first version of this specification:
Asir S. Vedamuthu, webMethods, Inc
Mark Davis, IBM
Co-editor Ashok Malhotra's work on this specification from March 1999 until February 2001 was supported by IBM, and from then until May 2004 by Microsoft. Since July 2004 his work on this specification has been supported by Oracle Corporation.
The XML Schema Working Group acknowledges with thanks the members of other W3C Working Groups and industry experts in other forums who have contributed directly or indirectly to the creation of this document and its predecessor.
At the time this Working Draft is published, the members in good standing of the XML Schema Working Group are:
The XML Schema Working Group has benefited in its work from the participation and contributions of a number of people who are no longer members of the Working Group in good standing at the time of publication of this Working Draft. Their names are given below. In particular we note with sadness the accidental death of Mario Jeckle shortly before publication of the first Working Draft of XML Schema 1.1. Affiliations given are those current at the time of their first work with the WG.