W3C

XML Schema 1.1 Part 2: Datatypes

W3C Working Draft 16 July 2004

This version:
http://www.w3.org/TR/2004/WD-xmlschema11-2-20040716/
Latest version:
http://www.w3.org/TR/xmlschema11-2/
Editors:
David Peterson, invited expert (SGMLWorks!) <davep@iit.edu>
Paul V. Biron, Kaiser Permanente, for Health Level Seven <Paul.V.Biron@kp.org>
Ashok Malhotra, invited expert (formerly of Microsoft) <ashokmalhotra@alum.mit.edu>

XML XHTML with visible change markup 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


Abstract

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.

Status of this Document

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 the First 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. It attempts to be complete in indicating what will change from version 1.0, but is not complete in terms of fully specifying how things will change.

For those primarily interested in the changes since version 1.0, the Changes since version 1.0 (§J) appendix, which summarizes both changes already made and also those in prospect, with links to the relevant sections of this draft, is the recommended starting point.

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.

Per section 4 of the W3C Patent Policy, Working Group participants have 150 days from the title page date of this document to exclude essential claims from the W3C RF licensing requirements with respect to this document series. Exclusions are with respect to the exclusion reference document, defined by the W3C Patent Policy to be the latest version of a document in this series that is published no later than 90 days after the title page date of this document.

The English version of this specification is the only normative version. Information about translations of this document is available at http://www.w3.org/2001/05/xmlschema-translations.

Table of Contents

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 Facets
    2.5 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 Information Facets
    4.3 Constraining Facets
5 Conformance

Appendices

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 -related Definitions
    E.3 Date/time-related Definitions
F Datatypes and Facets
    F.1 Fundamental Facets
G ISO 8601 Date and Time Formats
    G.1 ISO 8601 Conventions
    G.2 Truncated and Reduced Formats
    G.3 Deviations from ISO 8601 Formats
H Adding durations to dateTimes
    H.1 Algorithm
    H.2 Commutativity and Associativity
I Regular Expressions
    I.1 Character Classes
J Changes since version 1.0
    J.1 Changes Already Made
    J.2 Specific Outstanding Issues
K Glossary (non-normative)
L References
    L.1 Normative
    L.2 Non-normative
M Acknowledgements (non-normative)


1 Introduction

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".

next sub-section1.1 Introduction to Version 1.1

The Working Group has two main goals for this version of W3C XML Schema:

  • Significant improvements in simplicity of design and clarity of exposition without loss of backward or forward compatibility;
  • Provision of support for versioning of XML languages defined using the XML Schema specification, including the XML transfer syntax for schemas itself.

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:

  1. Add support for versioning (acknowledging that this may be slightly disruptive to the XML transfer syntax at the margins)
  2. Allow bug fixes (unless in specific cases we decide that the fix is too disruptive for a point release)
  3. Allow editorial changes
  4. Allow design cleanup to change behavior in edge cases
  5. Allow relatively non-disruptive changes to type hierarchy (to better support current and forthcoming international standards and W3C recommendations)
  6. Allow design cleanup to change component structure (changes to functionality restricted to edge cases)
  7. Do not allow any significant changes in functionality
  8. Do not allow any changes to XML transfer syntax except those required by version control hooks and bug fixes

The overall aim as regards compatibility is that

  • All schema documents conformant to version 1.0 of this specification should also conform to version 1.1, and should have the same validation behaviour across 1.0 and 1.1 implementations (except possibly in edge cases and in the details of the resulting PSVI);
  • The vast majority of schema documents conformant to version 1.1 of this specification should also conform to version 1.0, leaving aside any incompatibilities arising from support for versioning, and when they are conformant to version 1.0 (or are made conformant by the removal of versioning information), should have the same validation behaviour across 1.0 and 1.1 implementations (again except possibly in edge cases and in the details of the resulting PSVI);

previous sub-section next sub-section1.2 Purpose

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 orientedDocument 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.

previous sub-section next sub-section1.3 Requirements

The [XML Schema Requirements] document spells out concrete requirements to be fulfilled by this specification, which state that the XML Schema Language must:

  1. provide for primitive data typing, including byte, date, integer, sequence, SQL and Java primitive datatypes, etc.;
  2. define a type system that is adequate for import/export from database systems (e.g., relational, object, OLAP);
  3. distinguish requirements relating to lexical data representation vs. those governing an underlying information set;
  4. allow creation of user-defined datatypes, such as datatypes that are derived from existing datatypes and which may constrain certain of its properties (e.g., range, precision, length, format).

previous sub-section next sub-section1.4 Scope

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].

previous sub-section next sub-section1.5 Terminology

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:

[Definition:]   for compatibility
A feature of this specification included solely to ensure that schemas which use this feature remain compatible with [XML]
[Definition:]  may
Conforming documents and processors are permitted to but need not behave as described.
[Definition:]  match
(Of strings or names:) Two strings or names being compared must be identical. Characters with multiple possible representations in ISO/IEC 10646 (e.g. characters with both precomposed and base+diacritic forms) match only if they have the same representation in both strings. No case folding is performed. (Of strings and rules in the grammar:) A string matches a grammatical production if it belongs to the language generated by that production.
[Definition:]  must
Conforming documents and processors are required to behave as described; otherwise they are in ·error·.
[Definition:]  error
A violation of the rules of this specification; results are undefined. Conforming software ·may· detect and report an error and ·may· recover from it.

previous sub-section 1.6 Constraints and Contributions

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:

[Definition:]   Constraint on Schemas
Constraints on the schema components themselves, i.e. conditions components ·must· satisfy to be components at all. Largely to be found in Datatype components (§4).
[Definition:]   Schema Representation Constraint
Constraints on the representation of schema components in XML.  Some but not all of these are expressed in Schema for Datatype Definitions (normative) (§A) and DTD for Datatype Definitions (non-normative) (§B).
[Definition:]   Validation Rule
Constraints expressed by schema components which information items ·must· satisfy to be schema-valid.  Largely to be found in Datatype components (§4).

2 Datatype System

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.

Note: Only those operations and relations needed for schema processing are defined in this specification. Applications using these datatypes are generally expected to implement appropriate additional functions and/or relations to make the datatype generally useful.  For example, the description herein of the float datatype does not define addition or multiplication, much less all of the operations defined for that datatype in [IEEE 754-1985] on which it is based.

next sub-section2.1 Datatype

[Definition:]  In this specification, a datatype is a thing with four properties:

  • A ·value space·, which is simply a set. What the members of this set are called (beyond being generically called "values") is influenced by the set of value-space operations and relations used therewith.
  • A ·lexical space·, which is the domain of the ·lexical mapping·Some ·lexical mappings· are context sensitive, so that the ·lexical space· depends on the context in which the lexical representation occurs.
  • A small collection of functions, relations, and procedures associated with the datatype.  Included are equality and order relations on the ·value space·, and a ·lexical mapping·, which is a function on the ·lexical space· onto the ·value space·.
    Note: This specification only defines the operations and relations needed for schema processing.  The choice of terminology for describing/naming the datatypes is selected to guide users and implementers in how to expand the datatype to be generally useful—i.e., how to recognize the "real world" datatypes and their variants for which the datatypes defined herein are meant to be used for data interchange.
  • A Simple Type Definition, which serves to define and/or identify the datatype.

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.

previous sub-section next sub-section2.2 Value space

        2.2.1 Identity
        2.2.2 Equality
        2.2.3 Order

[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.

Note: The value spaces and the values therein are abstractions.  This specification does not prescribe any particular internal representations that must be used when implementing these datatypes.  In some cases, there are references to other specifications which do prescribe specific internal representations; these specific internal representations must be used to comply with those other specifications, but need not be used to comply with this specification.

In addition, other applications are expected to define additional appropriate operations and/or relations on these value spaces (e.g., addition and multiplication on the various numerical datatypes' value spaces), and are permitted where appropriate to even redefine the operations and relations defined within this specification, provided that for schema processing the relations and operations used are those defined herein.

The ·value space· of a datatype can be defined in one of the following ways:

  • defined elsewhere axiomatically from fundamental notions (intensional definition) [see ·primitive·]
  • enumerated outright from values of an already defined datatype (extensional definition) [see ·enumeration·]
  • defined by restricting the ·value space· of an already defined datatype to a particular subset with a given set of properties [see ·derived·]
  • defined as a combination of values from one or more already defined ·value space·(s) by a specific construction procedure [see ·list· and ·union·]

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.

2.2.1 Identity

The identity relation is always defined. Every value space inherently has an identity relation. Two things are identical 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.

Note: This does not preclude implementing datatypes by using more than one internal representation for a given value, provided no mechanism inherent in the datatype implementation (i.e., other than bit-string-preserving "casting" of the datum to a different datatype) will distinguish between the two representations.

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.)

2.2.2 Equality

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.

Note: In the prior version of this specification (1.0), equality was always identity.  This has been changed to permit the datatypes defined herein to more closely match the "real world" datatypes for which they are intended to be used as transmission formats.

For example, the float datatype has an equality which is not the identity ( –0 = +0 , but they are not identical—although they were identical in the 1.0 version of this specification), and whose domain excludes one value, NaN, so that  NaN ≠ NaN .

For another example, the dateTime datatype previously lost any timezone information in the ·lexical representation· as the value was converted to timezone Z; now the timezone is retained and two values representing the same "moment in time" but with different remembered timezones are now equal but not identical.

In the equality relation defined herein, values from different primitive data spaces are made artificially unequal even if they might otherwise be considered equal.  For example, there is a number two in the decimal datatype and a number two in the float datatype.  In the equality relation defined herein, these two values are considered unequal.  Other applications making use of these datatypes may choose to consider values such as these equal (and must do so if they choose to consider them identical); nonetheless, in the equality relation defined herein, they are unequal.

For the purposes of this specification, there is one equality relation for all values of all datatypes (the union of the various datatype's individual equalities, if one consider relations to be sets of ordered pairs).  The equality relation is denoted by '=' and its negation by '≠', each used as an binary infix predicate:  x = y  and  x ≠ y .  On the other hand, identity relationships are always described in words.

2.2.3 Order

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.  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 an binary infix predicate:  x < y ,  x ≤ y ,  x > y ,  x ≥ y , and  x <> y .

Note: The weak order "less-than-or-equal" means "less-than" or "equal" and one can tell which.  For example, the duration P1M (one month) is not less-than-or-equal P31D (thirty-one days) because P1M is not less than P31D, nor is P1M equal to P31D.  Instead, P1M is incomparable with P31D.)  The formal definition of order for duration (duration (§3.2.7)) insures that this is true.

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 decimal 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 ).

previous sub-section next sub-section2.3 The Lexical Space and Lexical Mapping

Editorial Note: Some things in this section and elsewhere will need to be rewritten once we decide just how to deal with context-dependent lexical mappings and lexical spaces.

[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·.

Note: This could happen by means of a pattern facet.

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.

Note: There are currently no facets with such an impact.  There may be in the future.

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.

2.3.1 Canonical Mapping

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)

Note: ·Canonical representations· are provided where feasible for the use of other appilications; they are not required for schema processing itself.  A conforming schema processor implementation is not required to implement ·canonical mappings·.

previous sub-section next sub-section2.4 Facets

Issue (RQ-24-1i):RQ-24 (systematic approach to facets)

This decision is not yet written up herein:  The four informational facets, each of which have only one property, will be lumped into one facet having four properties.  This will represent a further technical change to the facet structure, but will not result in any additional or lost information in a schema.

[Definition:]  Facets are designated and named values that either provide information about an aspect of the datatype (·information facets·) or control some aspect of the datatype (·constraining facets·).  For example, each datatype has a cardinality facet whose value generally tells something about the finiteness of the datatype, and each datatype has a whiteSpace facet whose value controls the "normalization" of the raw data-character string in the XML document undergoes prior to being treated as a potential member of the ·lexical space·.

Facets are of two kinds:  [Definition:]  information facets provide the application with some information about the datatype, and [Definition:]  constraining facet values may be set or changed during derivation (subject to facet-specific controls) and which control various aspects of the derived datatype.  For example, cardinality is an information facet and whiteSpace is a constraining facet.  The various information facets are described in Information Facets (§4.3) and constraining facets in Constraining Facets (§4.4).

Note:  In the 1.0 version of this specification, information facets were called "fundamental facets".  Information facets are not required for schema processing, but some applications use them.

previous sub-section 2.5 Datatype dichotomies

        2.5.1 Atomic vs. list vs. union datatypes
        2.5.2 Primitive vs. derived datatypes
        2.5.3 Built-in vs. user-derived datatypes

It is useful to categorize the datatypes defined in this specification along various dimensions, forming a set of characterization dichotomies.

2.5.1 Atomic vs. list vs. union datatypes

The first distinction to be made is that between ·atomic·, ·list· and ·union· datatypes.

For example, a single token which ·match·es 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).

2.6.1.1 Atomic datatypes

·atomic· datatypes can be either ·primitive· or ·derived·.  The ·value space· of an ·atomic· datatype is a set of "atomic" values, which for the purposes of this specification, are not further decomposable.  The ·lexical space· of an ·atomic· datatype is a set of literals whose internal structure is specific to the datatype in question.

2.6.1.2 List datatypes

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.

Example
<simpleType name='sizes'>
  <list itemType='decimal'/>
</simpleType>
<cerealSizes xsi:type='sizes'> 8 10.5 12 </cerealSizes>

A ·list· datatype can be ·derived· from an ·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.

Example
<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>
In the above example, the value of the someElement element is not a ·list· of ·length· 3; rather, it is a ·list· of ·length· 18.

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·.

Example
<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·.

2.6.1.3 Union datatypes

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.

Example
A prototypical example of a ·union· type is the maxOccurs attribute on the element element in XML Schema itself: it is a union of nonNegativeInteger and an enumeration with the single member, the string "unbounded", as shown below.
  <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 ·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.

Example
For example, given the definition below, the first instance of the <size> element validates correctly as an integer (§3.3.13), the second and third as string (§3.2.1).
  <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·.

Note:  A datatype which is ·atomic· in this specification need not be an "atomic" datatype in any programming language used to implement this specification.  Likewise, a datatype which is a ·list· in this specification need not be a "list" datatype in any programming language used to implement this specification. Furthermore, a datatype which is a ·union· in this specification need not be a "union" datatype in any programming language used to implement this specification.

2.5.2 Primitive vs. derived datatypes

Next, we distinguish between ·primitive· and ·derived· datatypes.

  • [Definition:]  Primitive datatypes are those that are not defined in terms of other datatypes; they exist ab initio.
  • [Definition:]  Derived datatypes are those that are defined in terms of other 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.

Issue (RQ-141i):RQ-141 (add abstract anyAtomicType) RQ-24 (systematic facets: status and value space of anySimpleType)

A new "magic" datatype will be introduced as a child of anySimpleType and the parent of all primitive atomic datatypes.

[Definition:]   The simple ur-type definition is a special restriction of the ur-type definition whose name is anySimpleType in the XML Schema namespace. anySimpleType can be considered as the ·base type· of all ·primitive· datatypes. anySimpleType is considered to have an unconstrained lexical space and a ·value space· consisting of the union of the ·value 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.

Note:  A datatype which is ·primitive· in this specification need not be a "primitive" datatype in any programming language used to implement this specification.  Likewise, a datatype which is ·derived· in this specification need not be a "derived" datatype in any programming language used to implement this specification.

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·.

2.6.2.1 Derived by restriction

[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·.

2.6.2.2 Derived by list

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·.

2.6.2.3 Derived by union

One datatype can be ·derived· from one or more datatypes by ·union·ing their ·value space·s and, consequently, their ·lexical space·s.

2.5.3 Built-in vs. user-derived datatypes

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.

Note:  A datatype which is ·built-in· in this specification need not be a "built-in" datatype in any programming language used to implement this specification.  Likewise, a datatype which is ·user-derived· in this specification need not be a "user-derived" datatype in any programming language used to implement this specification.

3 Built-in datatypes

Diagram of built-in type hierarchyanyTypeanySimpleTypedurationdateTimetimedategYearMonthgYeargMonthDaygDaygMonthbooleanbase64BinaryhexBinaryfloatdoubleanyURIQNameNOTATIONstringdecimalnormalizedStringintegertokennonPositiveIntegerlongnonNegativeIntegerlanguageNameNMTOKENnegativeIntegerintunsignedLongpositiveIntegerNCNameNMTOKENSshortunsignedIntIDIDREFENTITYbyteunsignedShortIDREFSENTITIESunsignedByteBuilt-in Datatypes

Each built-in datatype in this specification (both ·primitive· and ·derived·) can be uniquely addressed via a URI Reference 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:

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:

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:

next sub-section3.1 Namespace considerations

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:

  • http://www.w3.org/2001/XMLSchema

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:

  • http://www.w3.org/2001/XMLSchema-datatypes

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]).

previous sub-section next sub-section3.2 Primitive datatypes

        3.2.1 string
        3.2.2 boolean
        3.2.3 decimal
        3.2.4 float
        3.2.5 double
        3.2.6 precisionDecimal
        3.2.7 duration
        3.2.8 dateTime
        3.2.9 time
        3.2.10 date
        3.2.11 gYearMonth
        3.2.12 gYear
        3.2.13 gMonthDay
        3.2.14 gDay
        3.2.15 gMonth
        3.2.16 hexBinary
        3.2.17 base64Binary
        3.2.18 anyURI
        3.2.19 QName
        3.2.20 NOTATION

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.

3.2.1 string

[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.

Note:  Many human languages have writing systems that require child elements for control of aspects such as bidirectional formating or ruby annotation (see [Ruby] and Section 8.2.4 Overriding the bidirectional algorithm: the BDO element of [HTML 4.01]). Thus, string, as a simple type that can contain only characters but not child elements, is often not suitable for representing text. In such situations, a complex type that allows mixed content should be considered. For more information, see Section 5.5 Any Element, Any Attribute of [XML Schema Language: Part 0 Primer].
Note:  As noted in ordered, the fact that this specification does not specify an ·order-relation· for ·string· does not preclude other applications from treating strings as being ordered.
3.2.1.1 Constraining facets

string has the following ·constraining facets·:

3.2.1.2 Derived datatypes

The following ·built-in· datatypes are ·derived· from string:

3.2.2 boolean

[Definition:]  boolean has the ·value space· required to support the mathematical concept of binary-valued logic: {true, false}.

3.2.2.1 Lexical representation

An instance of a datatype that is defined as ·boolean· can have the following legal literals {true, false, 1, 0}.

3.2.2.2 Canonical representation

The canonical representation for boolean is the set of literals {true, false}.

3.2.2.3 Constraining facets

boolean has the following ·constraining facets·:

3.2.3 decimal

Issue (RQ-150i):RQ-150 (minimum nbr of digits for decimal)

The minimum will be lowered to 16 digits; a health warning will be added to indicate that optimized implementations of derived datatypes may exceed the limits of the base, but are not required to.

[Definition:]  decimal represents a subset of the real numbers, which can be represented by decimal numerals. The ·value space· of decimal is the set of numbers that can be obtained by multiplying an integer by a non-positive power of ten, i.e., expressible as i × 10^-n 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 ·order-relation· on decimal is the order relation on real numbers, restricted to this subset.

Note:  All ·minimally conforming· processors ·must· support decimal numbers with a minimum of 18 decimal digits (i.e., with a ·totalDigits· of 18).  However, ·minimally conforming· processors ·may· set an application-defined limit on the maximum number of decimal digits they are prepared to support, in which case that application-defined maximum number ·must· be clearly documented.
3.2.3.1 Lexical representation

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.

3.2.3.2 Canonical representation

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.

3.2.3.4 Derived datatypes

The following ·built-in· datatypes are ·derived· from decimal:

3.2.4 float

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·.

Note:  "Equality" in this Recommendation is defined to be "identity" (i.e., values that are identical in the ·value space· are equal and vice versa). Identity must be used for the few operations that are defined in this Recommendation. Applications using any of the datatypes defined in this Recommendation may use different definitions of equality for computational purposes; [IEEE 754-1985]-based computation systems are examples. Nothing in this Recommendation should be construed as requiring that such applications use identity as their equality relationship when computing.

Any value incomparable with the value used for the four bounding facets (·minInclusive·, ·maxInclusive·, ·minExclusive·, and ·maxExclusive·) will be excluded from the resulting restricted ·value space·. In particular, when "NaN" is used as a facet value for a bounding facet, since no other float values are ·comparable· with it, the result is a ·value space· either having NaN as its only member (the inclusive cases) or that is empty (the exclusive cases). If any other value is used for a bounding facet, NaN will be excluded from the resulting restricted ·value space·; to add NaN back in requires union with the NaN-only space.

This datatype differs from that of [IEEE 754-1985] in that there is only one NaN and only one zero. This makes the equality and ordering of values in the data space differ from that of [IEEE 754-1985] only in that for schema purposes NaN = NaN.

A literal in the ·lexical space· representing a decimal number d maps to the normalized value in the ·value space· of float that is closest to d in the sense defined by [Clinger, WD (1990)]; if d is exactly halfway between two such values then the even value is chosen.

3.2.4.1 Lexical representation

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.

3.2.4.2 Canonical representation

The canonical representation for float is defined by prohibiting certain options from the Lexical representation (§3.2.4.1).  Specifically, the exponent must be indicated by "E".  Leading zeroes and the preceding optional "+" sign are prohibited in the exponent. If the exponent is zero, it must be indicated by "E0". For the mantissa, the preceding optional "+" sign is prohibited and the decimal point is required. Leading and trailing zeroes are prohibited subject to the following: number representations must be normalized such that there is a single digit which is 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 representation for zero is 0.0E0.

3.2.5 double

[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·.

Note:  "Equality" in this Recommendation is defined to be "identity" (i.e., values that are identical in the ·value space· are equal and vice versa). Identity must be used for the few operations that are defined in this Recommendation. Applications using any of the datatypes defined in this Recommendation may use different definitions of equality for computational purposes; [IEEE 754-1985]-based computation systems are examples. Nothing in this Recommendation should be construed as requiring that such applications use identity as their equality relationship when computing.

Any value incomparable with the value used for the four bounding facets (·minInclusive·, ·maxInclusive·, ·minExclusive·, and ·maxExclusive·) will be excluded from the resulting restricted ·value space·. In particular, when "NaN" is used as a facet value for a bounding facet, since no other double values are ·comparable· with it, the result is a ·value space· either having NaN as its only member (the inclusive cases) or that is empty (the exclusive cases). If any other value is used for a bounding facet, NaN will be excluded from the resulting restricted ·value space·; to add NaN back in requires union with the NaN-only space.

This datatype differs from that of [IEEE 754-1985] in that there is only one NaN and only one zero. This makes the equality and ordering of values in the data space differ from that of [IEEE 754-1985] only in that for schema purposes NaN = NaN.

A literal in the ·lexical space· representing a decimal number d maps to the normalized value in the ·value space· of double that is closest to d; if d is exactly halfway between two such values then the even value is chosen. This is the best approximation of d ([Clinger, WD (1990)], [Gay, DM (1990)]), which is more accurate than the mapping required by [IEEE 754-1985].

3.2.5.1 Lexical representation

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.

3.2.5.2 Canonical representation

The canonical representation for double is defined by prohibiting certain options from the Lexical representation (§3.2.5.1).  Specifically, the exponent must be indicated by "E".  Leading zeroes and the preceding optional "+" sign are prohibited in the exponent. If the exponent is zero, it must be indicated by "E0". For the mantissa, the preceding optional "+" sign is prohibited and the decimal point is required. Leading and trailing zeroes are prohibited subject to the following: number representations must be normalized such that there is a single digit which is 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 representation for zero is 0.0E0.

3.2.6 precisionDecimal

Issue (RQ-31i):RQ-31 (precisionDecimal)

precisionDecimal has been added.  It is possible that precisionDecimal will replace decimal.
Issue (RQ-30i):RQ-30 (negative fractionDigits for decimal)

The WG feels that having this capability for precisionDecimal will be adequate.
Issue (RQ-28i):RQ-28 (scientific notation for decimal)

The WG feels that having this capability for precisionDecimal will be adequate.

[Definition:]  The precisionDecimal datatype is similar to decimal, except that each value carries with it a precision as well as a numeric value; it also includes special values for positive and negative infinity and "not a number", and differentiates between "positive zero" and "negative zero". "Precision" is explained in Precision (§D.1.1).  The special values are introduced to make the datatype correspond closely to decimal datatypes whose definition is planned for the next revision of IEEE/ANSI 754.

3.2.6.1 Value Space
Properties of precisionDecimal Values
a decimal number, positiveInfinity, negativeInfinity or notANumber
an integer or absent; absent if and only if ·numericalValue· is a constant.
positive, negative, or absent; must be positive if ·numericalValue· is positive or positiveInfinity, must be negative if ·numericalValue· is negative or negativeInfinity, must be absent if and only if ·numericalValue· is notANumber
Note: The ·sign· property is redundant except when ·numericalValue· is zero; in other cases, the ·sign· value is fully determined by the ·numericalValue· value.  Code optimization may well make it desirable to separate out the ·sign· and the absolute value of the ·numericalValue·, which will make implementation easier, but the verbal descriptions of such things as equality and order somewhat more complicated.
Note: As explained below, the lexical representation of the precisionDecimal value object whose ·numericalValue· is notANumber is '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".

Equality and order for precisionDecimal are defined as follows:

  • Two numerical precisionDecimal values are ordered (or equal) as their ·numericalValue· values are ordered (or equal).  (This means the two zeros with a given ·arthmeticPrecision· but different ·sign· are equal; negative zeros are not ordered less than positive zeros.)
  • INF is equal only to itself, and is greater than –INF and all numerical precisionDecimal values.
  • –INF is equal only to itself, and is less than INF and all numerical precisionDecimal values.
  • NaN is incomparable with all values, including itself.

3.2.6.2 Lexical Mapping

Editorial Note: The notation constraining facet has not yet been written up.  Its effect will be to remove some portions of the lexical mapping.

precisionDecimal's lexical space is the set of all no-decimal-point, decimal, and scientific numerals, plus the character strings 'INF', '+INF', '-INF', and 'NaN'.  (Lexical representations of numbers are traditionally called "numerals".)  The notation constraining 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.

Lexical Mapping
Maps a precisionDecimalRep onto a complete precisionDecimal value.

Note: Canonical mappings are not used during schema processing.  They are provided in this specification for the benefit of other users of these datatype definitions who may find them useful, and for other specifications which might find it useful to reference them normatively.

3.2.6.3 Constraining Facets

Editorial Note: The notation constraining facet has not yet been written up.  It's effect will be to remove some portions of the lexical mapping.

precisionDecimal has the following ·constraining facets·:

  • fractionDigits
  • minFractionDigits
  • totalDigits
  • specials
  • notation constraining
  • maxInclusive
  • maxExclusive
  • minInclusive
  • minExclusive
  • pattern
  • whitespace
  • eunmeration

3.2.7 duration

[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 (§H)

3.2.7.1 Value Space

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.2) for more information on the seven-property model.

Properties of duration Values
·Must· not be negative if ·month· is positive, and ·must· not be positive if ·month· is negative.

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:

  • 1696-09-01T00:00:00Z
  • 1697-02-01T00:00:00Z
  • 1903-03-01T00:00:00Z
  • 1903-07-01T00:00:00Z

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.

Note: These four values are chosen so as to maximize the possible differences in results that could occur, such as the difference when adding P1M and P30D:  1697-02-01T00:00:00Z + P1M < 1697-02-01T00:00:00Z + P30D , but  1903-03-01T00:00:00Z + P1M > 1903-03-01T00:00:00Z + P30D , so that  P1M <> P30D .  If two duration values are ordered the same way when added to each of these four dateTime values, they will retain the same order when added to any other dateTime values, unless one is within a leap-second and either the other is also or is the beginning moment of the next second—in which case, the two results will be equal even though the original dateTime values were not.  Therefore, two duration values are incomparable if and only if they can ever result in different orders when added to any dateTime value not within a leap-second.

This minor anomaly is the result of having duration unaware of leap-seconds while the other date/time primitive datatypes are leap-second aware.

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).
Note: There are many ways to implement duration, some of which do not base the implementation on the two-component model.  This specification does not prescribe any particular implementation, as long as the visible results are isomorphic to those described herein.
3.2.7.2 Lexical Space

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:

Lexical Representation Fragments
duYearFrag ::= unsignedNoDecimalPtNumeral 'Y'
duMonthFrag ::= unsignedNoDecimalPtNumeral 'M'
duDayFrag ::= unsignedNoDecimalPtNumeral 'D'
duHourFrag ::= unsignedNoDecimalPtNumeral 'H'
duMinuteFrag ::= unsignedNoDecimalPtNumeral 'M'
duYearMonthFrag ::= (duYearFrag duMonthFrag?) | duMonthFrag
duDayTimeFrag ::= (duDayFrag duTimeFrag?) | duTimeFrag

Lexical Representation
durationLexicalRep ::= '-'? 'P' ((duYearMonthFrag duDayTimeFrag?) | duDayTimeFrag)

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 production 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 parehtheses are shown as "ghosts"; some find them helpful in reading the expression.)

The ·lexical mapping· for duration is called "·durationMap·" herein.

The duration Lexical Mapping
Separates the durationLexicalRep into the month part and the seconds part, then maps them into the ·month· and ·second· of the duration value.

Note: Canonical mappings are not used during schema processing.  They are provided in this specification for the benefit of other users of these datatype definitions who may find them useful, and for other specifications which might find it useful to reference them normatively.

·The canonical mapping· for duration is called "·durationCanonicalMap·" herein.

The duration Canonical Mapping
Maps a duration's property values to durationLexicalRep fragments and combines the fragments into a complete durationLexicalRep.

3.2.8 dateTime

[Definition:]   dateTime values may be viewed as objects with integer-valued year, month, day, hour and minute properties, a decimal-valued second property, and a boolean timezoned property. Each such object also has one decimal-valued method or computed property, timeOnTimeline, whose value is always a decimal number; the values are dimensioned in seconds, the integer 0 is 0001-01-01T00:00:00 and the value of timeOnTimeline for other dateTime values is computed using the Gregorian algorithm as modified for leap-seconds. The timeOnTimeline values form two related "timelines", one for timezoned values and one for non-timezoned values. Each timeline is a copy of the ·value space· of decimal, with integers given units of seconds.

The ·value space· of dateTime is closely related to the dates and times described in ISO 8601. For clarity, the text above specifies a particular origin point for the timeline. It should be noted, however, that schema processors need not expose the timeOnTimeline value to schema users, and there is no requirement that a timeline-based implementation use the particular origin described here in its internal representation. Other interpretations of the ·value space· which lead to the same results (i.e., are isomorphic) are of course acceptable.

All timezoned times are Coordinated Universal Time (·UTC·, sometimes called "Greenwich Mean Time"). Other timezones indicated in lexical representations are converted to ·UTC· during conversion of literals to values. "Local" or untimezoned times are presumed to be the time in the timezone of some unspecified locality as prescribed by the appropriate legal authority; currently there are no legally prescribed timezones which are durations whose magnitude is greater than 14 hours. The value of each numeric-valued property (other than timeOnTimeline) is limited to the maximum value within the interval determined by the next-higher property. For example, the day value can never be 32, and cannot even be 29 for month 02 and year 2002 (February 2002).

Note:

The date and time datatypes described in this recommendation were inspired by [ISO 8601].  '0001' is the lexical representation of the year 1 of the Common Era (1 CE, sometimes written "AD 1" or "1 AD").  There is no year 0, and '0000' is not a valid lexical representation. '-0001' is the lexical representation of the year 1 Before Common Era (1 BCE, sometimes written "1 BC").

Those using this (1.0) version of this Recommendation to represent negative years should be aware that the interpretation of lexical representations beginning with a '-' is likely to change in subsequent versions.

[ISO 8601] makes no mention of the year 0; in [ISO 8601:1998 Draft Revision] the form '0000' was disallowed and this recommendation disallows it as well. However, [ISO 8601:2000 Second Edition], which became available just as we were completing version 1.0, allows the form '0000', representing the year 1 BCE.  A number of external commentators have also suggested that '0000' be allowed, as the lexical representation for 1 BCE, which is the normal usage in astronomical contexts.  It is the intention of the XML Schema Working Group to allow '0000' as a lexical representation in the dateTime, date, gYear, and gYearMonth datatypes in a subsequent version of this Recommendation. '0000' will be the lexical representation of 1 BCE (which is a leap year), '-0001' will become the lexical representation of 2 BCE (not 1 BCE as in this (1.0) version), '-0002' of 3 BCE, etc.
Note: See the conformance note in (§C) which applies to this datatype as well.
3.2.8.1 Lexical representation

The ·lexical space· of dateTime consists of finite-length sequences of characters of the form: '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?, where

  • '-'? yyyy is a four-or-more digit optionally negative-signed numeral that represents the year; if more than four digits, leading zeros are prohibited, and '0000' is prohibited (see the Note above (§3.2.8); also note that a plus sign is not permitted);
  • the remaining '-'s are separators between parts of the date portion;
  • the first mm is a two-digit numeral that represents the month;
  • dd is a two-digit numeral that represents the day;
  • 'T' is a separator indicating that time-of-day follows;
  • hh is a two-digit numeral that represents the hour; '24' is permitted if the minutes and seconds represented are zero, and the dateTime value so represented is the first instant of the following day (the hour property of a dateTime object in the ·value space· cannot have a value greater than 23);
  • ':' is a separator between parts of the time-of-day portion;
  • the second mm is a two-digit numeral that represents the minute;
  • ss is a two-integer-digit numeral that represents the whole seconds;
  • '.' s+ (if present) represents the fractional seconds;
  • zzzzzz (if present) represents the timezone (as described below).

For example, 2002-10-10T12:00:00-05:00 (noon on 10 October 2002, Central Daylight Savings Time as well as Eastern Standard Time in the U.S.) is 2002-10-10T17:00:00Z, five hours later than 2002-10-10T12:00:00Z.

For further guidance on arithmetic with dateTimes and durations, see Adding durations to dateTimes (§H).

3.2.8.2 Canonical representation

Except for trailing fractional zero digits in the seconds representation, '24:00:00' time representations, and timezone (for timezoned values), the mapping from literals to values is one-to-one. Where there is more than one possible representation, the canonical representation is as follows:

  • The 2-digit numeral representing the hour must not be '24';
  • The fractional second string, if present, must not end in '0';
  • for timezoned values, the timezone must be represented with 'Z' (All timezoned dateTime values are ·UTC·.).

3.2.8.3 Timezones

Timezones are durations with (integer-valued) hour and minute properties (with the hour magnitude limited to at most 14, and the minute magnitude limited to at most 59, except that if the hour magnitude is 14, the minute value must be 0); they may be both positive or both negative.

The lexical representation of a timezone is a string of the form: (('+' | '-') hh ':' mm) | 'Z', where

  • hh is a two-digit numeral (with leading zeros as required) that represents the hours,
  • mm is a two-digit numeral that represents the minutes,
  • '+' indicates a nonnegative duration,
  • '-' indicates a nonpositive duration.

The mapping so defined is one-to-one, except that '+00:00', '-00:00', and 'Z' all represent the same zero-length duration timezone, ·UTC·; 'Z' is its canonical representation.

When a timezone is added to a ·UTC· dateTime, the result is the date and time "in that timezone".  For example, 2002-10-10T12:00:00+05:00 is 2002-10-10T07:00:00Z and 2002-10-10T00:00:00+05:00 is 2002-10-09T19:00:00Z.

3.2.8.4 Order relation on dateTime

dateTime value objects on either timeline are totally ordered by their timeOnTimeline values; between the two timelines, dateTime value objects are ordered by their timeOnTimeline values when their timeOnTimeline values differ by more than fourteen hours, with those whose difference is a duration of 14 hours or less being incomparable.

In general, the ·order-relation· on dateTime is a partial order since there is no determinate relationship between certain instants. For example, there is no determinate ordering between (a) 2000-01-20T12:00:00 and (b) 2000-01-20T12:00:00Z. Based on timezones currently in use, (c) could vary from 2000-01-20T12:00:00+12:00 to 2000-01-20T12:00:00-13:00. It is, however, possible for this range to expand or contract in the future, based on local laws. Because of this, the following definition uses a somewhat broader range of indeterminate values: +14:00..-14:00.

The following definition uses the notation S[year] to represent the year field of S, S[month] to represent the month field, and so on. The notation (Q & "-14:00") means adding the timezone -14:00 to Q, where Q did not already have a timezone. This is a logical explanation of the process. Actual implementations are free to optimize as long as they produce the same results.

The ordering between two dateTimes P and Q is defined by the following algorithm:

A.Normalize P and Q. That is, if there is a timezone present, but it is not Z, convert it to Z using the addition operation defined in Adding durations to dateTimes (§H)

  • Thus 2000-03-04T23:00:00+03:00 normalizes to 2000-03-04T20:00:00Z

B. If P and Q either both have a time zone or both do not have a time zone, compare P and Q field by field from the year field down to the second field, and return a result as soon as it can be determined. That is:

  1. For each i in {year, month, day, hour, minute, second}
    1. If P[i] and Q[i] are both not specified, continue to the next i
    2. If P[i] is not specified and Q[i] is, or vice versa, stop and return P <> Q
    3. If P[i] < Q[i], stop and return P < Q
    4. If P[i] > Q[i], stop and return P > Q
  2. Stop and return P = Q

C.Otherwise, if P contains a time zone and Q does not, compare as follows:

  1. P < Q if P < (Q with time zone +14:00)
  2. P > Q if P > (Q with time zone -14:00)
  3. P <> Q otherwise, that is, if (Q with time zone +14:00) < P < (Q with time zone -14:00)

D. Otherwise, if P does not contain a time zone and Q does, compare as follows:

  1. P < Q if (P with time zone -14:00) < Q.
  2. P > Q if (P with time zone +14:00) > Q.
  3. P <> Q otherwise, that is, if (P with time zone +14:00) < Q < (P with time zone -14:00)

Examples:

DeterminateIndeterminate
2000-01-15T00:00:00 < 2000-02-15T00:00:002000-01-01T12:00:00 <> 1999-12-31T23:00:00Z
2000-01-15T12:00:00 < 2000-01-16T12:00:00Z2000-01-16T12:00:00 <> 2000-01-16T12:00:00Z
 2000-01-16T00:00:00 <> 2000-01-16T12:00:00Z
3.2.8.5 Totally ordered dateTimes

Certain derived types from dateTime can be guaranteed have a total order. To do so, they must require that a specific set of fields are always specified, and that remaining fields (if any) are always unspecified. For example, the date datatype without time zone is defined to contain exactly year, month, and day. Thus dates without time zone have a total order among themselves.

3.2.9 time

[Definition:]  time represents an instant of time that recurs every day.  The ·value space· of time is the space of time of day values as defined in § 5.3 of [ISO 8601].  Specifically, it is a set of zero-duration daily time instances.

Since the lexical representation allows an optional time zone indicator, time values are partially ordered because it may not be able to determine the order of two values one of which has a time zone and the other does not.  The order relation on time values is the Order relation on dateTime (§3.2.8.4) using an arbitrary date. See also Adding durations to dateTimes (§H).  Pairs of time values with or without time zone indicators are totally ordered.

Note: See the conformance note in (§C) which applies to the seconds part of this datatype as well.
3.2.9.1 Lexical representation

The lexical representation for time is the left truncated lexical representation for dateTime: hh:mm:ss.sss with optional following time zone indicator.  For example, to indicate 1:20 pm for Eastern Standard Time which is 5 hours behind Coordinated Universal Time (·UTC·), one would write: 13:20:00-05:00. See also ISO 8601 Date and Time Formats (§G).

3.2.9.2 Canonical representation

The canonical representation for time is defined by prohibiting certain options from the Lexical representation (§3.2.9.1).  Specifically, either the time zone must be omitted or, if present, the time zone must be Coordinated Universal Time (·UTC·) indicated by a "Z". Additionally, the canonical representation for midnight is 00:00:00.

3.2.10 date

[Definition:]   The ·value space· of date consists of 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), i.e. '00:00:00', up to but not including '24:00:00' (which is identical with '00:00:00' 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.

A "date object" is an object with year, month, and day properties just like those of dateTime objects, plus an optional timezone-valued timezone property. (As with values of dateTime timezones are a special case of durations.) Just as a dateTime object corresponds to a point on one of the timelines, a date object corresponds to an interval on one of the two timelines as just described.

Timezoned date values track the starting moment of their day, as determined by their timezone; said timezone is generally recoverable for canonical representations. [Definition:]   The recoverable timezone is that duration which is the result of subtracting the first moment (or any moment) of the timezoned date from the first moment (or the corresponding moment) ·UTC· on the same date. ·recoverable timezone·s are always durations between '+12:00' and '-11:59'.  This "timezone normalization" (which follows automatically from the definition of the date ·value space·) is explained more in Lexical representation (§3.2.10.1).

For example: the first moment of 2002-10-10+13:00 is 2002-10-10T00:00:00+13, which is 2002-10-09T11:00:00Z, which is also the first moment of 2002-10-09-11:00. Therefore 2002-10-10+13:00 is 2002-10-09-11:00; they are the same interval.

Note:  For most timezones, either the first moment or last moment of the day (a dateTime value, always ·UTC·) will have a date portion different from that of the date itself! However, noon of that date (the midpoint of the interval) in that (normalized) timezone will always have the same date portion as the date itself, even when that noon point in time is normalized to ·UTC·.  For example, 2002-10-10-05:00 begins during 2002-10-09Z and 2002-10-10+05:00 ends during 2002-10-11Z, but noon of both 2002-10-10-05:00 and 2002-10-10+05:00 falls in the interval which is 2002-10-10Z.
Note: See the conformance note in (§C) which applies to the year part of this datatype as well.
3.2.10.1 Lexical representation

For the following discussion, let the "date portion" of a dateTime or date object be an object similar to a dateTime or date object, with similar year, month, and day properties, but no others, having the same value for these properties as the original dateTime or date object.

The ·lexical space· of date consists of finite-length sequences of characters of the form: '-'? yyyy '-' mm '-' dd zzzzzz? where the date and optional timezone are represented exactly the same way as they are for dateTime.  The first moment of the interval is that represented by: '-' yyyy '-' mm '-' dd 'T00:00:00' zzzzzz? and the least upper bound of the interval is the timeline point represented (noncanonically) by: '-' yyyy '-' mm '-' dd 'T24:00:00' zzzzzz?.

Note:  The ·recoverable timezone· of a date will always be a duration between '+12:00' and '11:59'.  Timezone lexical representations, as explained for dateTime, can range from '+14:00' to '-14:00'. The result is that literals of dates with very large or very negative timezones will map to a "normalized" date value with a ·recoverable timezone· different from that represented in the original representation, and a matching difference of +/- 1 day in the date itself.
3.2.10.2 Canonical representation

Given a member of the date ·value space·, the date portion of the canonical representation (the entire representation for nontimezoned values, and all but the timezone representation for timezoned values) is always the date portion of the dateTime canonical representation of the interval midpoint (the dateTime representation, truncated on the right to eliminate 'T' and all following characters). For timezoned values, append the canonical representation of the ·recoverable timezone·.

3.2.11 gYearMonth

[Definition:]   gYearMonth represents a specific gregorian month in a specific gregorian year.  The ·value space· of gYearMonth is the set of Gregorian calendar months as defined in § 5.2.1 of [ISO 8601].  Specifically, it is a set of one-month long, non-periodic instances e.g. 1999-10 to represent the whole month of 1999-10, independent of how many days this month has.

Since the lexical representation allows an optional time zone indicator, gYearMonth values are partially ordered because it may not be possible to unequivocally determine the order of two values one of which has a time zone and the other does not.  If gYearMonth values are considered as periods of time, the order relation on gYearMonth values is the order relation on their starting instants. This is discussed in Order relation on dateTime (§3.2.8.4).  See also Adding durations to dateTimes (§H).  Pairs of gYearMonth values with or without time zone indicators are totally ordered.

Note:  Because month/year combinations in one calendar only rarely correspond to month/year combinations in other calendars, values of this type are not, in general, convertible to simple values corresponding to month/year combinations in other calendars.  This type should therefore be used with caution in contexts where conversion to other calendars is desired.
Note: See the conformance note in (§C) which applies to the year part of this datatype as well.
3.2.11.1 Lexical representation

The lexical representation for gYearMonth is the reduced (right truncated) lexical representation for dateTime: CCYY-MM.  No left truncation is allowed.  An optional following time zone qualifier is allowed.  To accommodate year values outside the range from 0001 to 9999, additional digits can be added to the left of this representation and a preceding "-" sign is allowed.

For example, to indicate the month of May 1999, one would write: 1999-05. See also ISO 8601 Date and Time Formats (§G).

3.2.12 gYear

[Definition:]   gYear represents a gregorian calendar year.  The ·value space· of gYear is the set of Gregorian calendar years as defined in § 5.2.1 of [ISO 8601]. Specifically, it is a set of one-year long, non-periodic instances e.g. lexical 1999 to represent the whole year 1999, independent of how many months and days this year has.

Since the lexical representation allows an optional time zone indicator, gYear values are partially ordered because it may not be possible to unequivocally determine the order of two values one of which has a time zone and the other does not.  If gYear values are considered as periods of time, the order relation on gYear values is the order relation on their starting instants. This is discussed in Order relation on dateTime (§3.2.8.4).  See also Adding durations to dateTimes (§H).  Pairs of gYear values with or without time zone indicators are totally ordered.

Note:  Because years in one calendar only rarely correspond to years in other calendars, values of this type are not, in general, convertible to simple values corresponding to years in other calendars.  This type should therefore be used with caution in contexts where conversion to other calendars is desired.
Note: See the conformance note in (§C) which applies to the year part of this datatype as well.
3.2.12.1 Lexical representation

The lexical representation for gYear is the reduced (right truncated) lexical representation for dateTime: CCYY. No left truncation is allowed.  An optional following time zone qualifier is allowed as for dateTime.  To accommodate year values outside the range from 0001 to 9999, additional digits can be added to the left of this representation and a preceding "-" sign is allowed.

For example, to indicate 1999, one would write: 1999. See also ISO 8601 Date and Time Formats (§G).

3.2.13 gMonthDay

[Definition:]   gMonthDay is a gregorian date that recurs, specifically a day of the year such as the third of May.  Arbitrary recurring dates are not supported by this datatype.  The ·value space· of gMonthDay is the set of calendar dates, as defined in § 3 of [ISO 8601].  Specifically, it is a set of one-day long, annually periodic instances.

Since the lexical representation allows an optional time zone indicator, gMonthDay values are partially ordered because it may not be possible to unequivocally determine the order of two values one of which has a time zone and the other does not.  If gMonthDay values are considered as periods of time, in an arbitrary leap year, the order relation on gMonthDay values is the order relation on their starting instants. This is discussed in Order relation on dateTime (§3.2.8.4).  See also Adding durations to dateTimes (§H).  Pairs of gMonthDay values with or without time zone indicators are totally ordered.

Note:  Because day/month combinations in one calendar only rarely correspond to day/month combinations in other calendars, values of this type do not, in general, have any straightforward or intuitive representation in terms of most other calendars. This type should therefore be used with caution in contexts where conversion to other calendars is desired.
3.2.13.1 Lexical representation

The lexical representation for gMonthDay is the left truncated lexical representation for date: --MM-DD. An optional following time zone qualifier is allowed as for date. No preceding sign is allowed.  No other formats are allowed. See also ISO 8601 Date and Time Formats (§G).

This datatype can be used to represent a specific day in a month. To say, for example, that my birthday occurs on the 14th of September ever year.

3.2.14 gDay

[Definition:]  gDay is a datatype that 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.)

Note:  Because days in one calendar only rarely correspond to days in other calendars, gday values do not, in general, have any straightforward or intuitive representation in terms of most non-Gregorian calendars. gday should therefore be used with caution in contexts where conversion to other calendars is desired.
3.2.14.1 Value Space

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.

Issue (RQ-13i):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" ("raw" property values) so that in any given timezone, the days start at "raw" 00:00:00 and end not quite including "raw" 24:00:00. Days are not 00:00:00Z to 24:00:00Z in timezones other than Z.

Equality and order are as prescribed in The Seven-property Model (§D.2.2).  Since gDay values (days) are ordered by their first moments, it is possible for apparent anomalies to appear in the order when ·timezone· values are 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.3) for the notations):

  • ---15 < ---16 , but  ---15–13:00 > ---16+13:00
  • ---15–11:00 = ---16+13:00
  • ---15–13:00 <> ---16 , because  ---15–13:00 > ---16+14:00  and ---15–13:00 < 16–14:00

Note: Timezones do not cause wrap-around at the end of the month: ---31–13:00 in one month may start after ---01+13:00 in the next month, but nonetheless  ---01+13:00 < ---31–13:00 .
3.2.14.3 Lexical Mappings

The lexical representations for gDay are "restrictions" of those of dateTime, as follows:

Lexical Space
gDayLexicalRep ::= '---dayFrag timezoneFrag?

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:

Lexical Mapping
Maps a gDayLexicalRep to a gDay value.

Canonical Mapping
Maps a gDay value to a gDayLexicalRep.

3.2.15 gMonth

[Definition:]   gMonth is a gregorian month that recurs every year. The ·value space· of gMonth is the space of a set of calendar months as defined in § 3 of [ISO 8601].  Specifically, it is a set of one-month long, yearly periodic instances.

This datatype can be used to represent a specific month. To say, for example, that Thanksgiving falls in the month of November.

Since the lexical representation allows an optional time zone indicator, gMonth values are partially ordered because it may not be possible to unequivocally determine the order of two values one of which has a time zone and the other does not.  If gMonth values are considered as periods of time, the order relation on gMonth is the order relation on their starting instants. This is discussed in Order relation on dateTime (§3.2.8.4).  See also Adding durations to dateTimes (§H).  Pairs of gMonth values with or without time zone indicators are totally ordered.

Note:  Because months in one calendar only rarely correspond to months in other calendars, values of this type do not, in general, have any straightforward or intuitive representation in terms of most other calendars. This type should therefore be used with caution in contexts where conversion to other calendars is desired.
3.2.15.1 Lexical representation

The lexical representation for gMonth is the left and right truncated lexical representation for date: --MM. An optional following time zone qualifier is allowed as for date.  No preceding sign is allowed. No other formats are allowed.  See also ISO 8601 Date and Time Formats (§G).

3.2.16 hexBinary

[Definition:]   hexBinary represents arbitrary hex-encoded binary data.  The ·value space· of hexBinary is the set of finite-length sequences of binary octets.

3.2.16.1 Lexical Representation

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).

3.2.16.2 Canonical Representation

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.

3.2.16.3 Constraining facets

hexBinary has the following ·constraining facets·:

3.2.17 base64Binary

[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.

Note: The above definition of the lexical space is more restrictive than that given in [RFC 2045] as regards whitespace -- this is not an issue in practice.  Any string compatible with the RFC can occur in an element or attribute validated by this type, because the ·whiteSpace· facet of this type is fixed to collapse, which means that all leading and trailing whitespace will be stripped, and all internal whitespace collapsed to single space characters, before the above grammar is enforced.

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 '=='))?

Note: For some values the canonical form defined above does not conform to [RFC 2045], which requires breaking with linefeeds at appropriate intervals.

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]

3.2.17.1 Constraining facets

base64Binary has the following ·constraining facets·:

3.2.18 anyURI

[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.

Note:  Section 5.4 Locator Attribute of [XML Linking Language] requires that relative URI references be absolutized as defined in [XML Base] before use.  This is an XLink-specific requirement and is not appropriate for XML Schema, since neither the ·lexical space· nor the ·value space· of the anyURI type are restricted to absolute URIs.  Accordingly absolutization must not be performed by schema processors as part of schema validation.
Note:  Each URI scheme imposes specialized syntax rules for URIs in that scheme, including restrictions on the syntax of allowed fragment identifiers. Because it is impractical for processors to check that a value is a context-appropriate URI reference, this specification follows the lead of [RFC 2396] (as amended by [RFC 2732]) in this matter: such rules and restrictions are not part of type validity and are not checked by ·minimally conforming· processors. Thus in practice the above definition imposes only very modest obligations on ·minimally conforming· processors.
3.2.18.1 Lexical representation

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].

Note:  Spaces are, in principle, allowed in the ·lexical space· of anyURI, however, their use is highly discouraged (unless they are encoded by %20).
3.2.18.2 Constraining facets

anyURI has the following ·constraining facets·:

3.2.19 QName

[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].

Note:  The mapping between literals in the ·lexical space· and values in the ·value space· of QName requires a namespace declaration to be in scope for the context in which QName is used.
3.2.19.1 Constraining facets

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.

3.2.20 NOTATION

[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).

Schema Component Constraint: enumeration facet value required for NOTATION
It is an ·error· for NOTATION to be used directly in a schema.  Only datatypes that are ·derived· from NOTATION by specifying a value for ·enumeration· can be used in a schema.

For compatibility (see Terminology (§1.5)) NOTATION should be used only on attributes and should only be used in schemas with no target namespace.

3.2.20.1 Constraining facets

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.

previous sub-section 3.3 Derived datatypes

        3.3.1 normalizedString
        3.3.2 token
        3.3.3 language
        3.3.4 NMTOKEN
        3.3.5 NMTOKENS
        3.3.6 Name
        3.3.7 NCName
        3.3.8 ID
        3.3.9 IDREF
        3.3.10 IDREFS
        3.3.11 ENTITY
        3.3.12 ENTITIES
        3.3.13 integer
        3.3.14 nonPositiveInteger
        3.3.15 negativeInteger
        3.3.16 long
        3.3.17 int
        3.3.18 short
        3.3.19 byte
        3.3.20 nonNegativeInteger
        3.3.21 unsignedLong
        3.3.22 unsignedInt
        3.3.23 unsignedShort
        3.3.24 unsignedByte
        3.3.25 positiveInteger
        3.3.26 yearMonthDuration
        3.3.27 dayTimeDuration

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).

3.3.1 normalizedString

[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.

3.3.1.1 Constraining facets

normalizedString has the following ·constraining facets·:

3.3.1.2 Derived datatypes

The following ·built-in· datatypes are ·derived· from normalizedString:

3.3.2 token

[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.

3.3.2.1 Constraining facets

token has the following ·constraining facets·:

3.3.2.2 Derived datatypes

The following ·built-in· datatypes are ·derived· from token:

3.3.3 language

[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.

3.3.3.1 Constraining facets

language has the following ·constraining facets·:

3.3.4 NMTOKEN

[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.

3.3.4.1 Constraining facets

NMTOKEN has the following ·constraining facets·:

3.3.4.2 Derived datatypes

The following ·built-in· datatypes are ·derived· from NMTOKEN:

3.3.5 NMTOKENS

[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.

3.3.5.1 Constraining facets

NMTOKENS has the following ·constraining facets·:

3.3.6 Name

[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.

3.3.6.1 Constraining facets

Name has the following ·constraining facets·:

3.3.6.2 Derived datatypes

The following ·built-in· datatypes are ·derived· from Name:

3.3.7 NCName

[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.

3.3.7.1 Constraining facets

NCName has the following ·constraining facets·:

3.3.7.2 Derived datatypes

The following ·built-in· datatypes are ·derived· from NCName:

3.3.8 ID

[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.

3.3.8.1 Constraining facets

ID has the following ·constraining facets·:

3.3.9 IDREF

[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.

3.3.9.1 Constraining facets

IDREF has the following ·constraining facets·:

3.3.9.2 Derived datatypes

The following ·built-in· datatypes are ·derived· from IDREF:

3.3.10 IDREFS

[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.

3.3.10.1 Constraining facets

IDREFS has the following ·constraining facets·:

3.3.11 ENTITY

[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.

Note:  The ·value space· of ENTITY is scoped to a specific instance document.

For compatibility (see Terminology (§1.5)) ENTITY should be used only on attributes.

3.3.11.1 Constraining facets

ENTITY has the following ·constraining facets·:

3.3.11.2 Derived datatypes

The following ·built-in· datatypes are ·derived· from ENTITY:

3.3.12 ENTITIES

[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.

Note:  The ·value space· of ENTITIES is scoped to a specific instance document.

For compatibility (see Terminology (§1.5)) ENTITIES should be used only on attributes.

3.3.12.1 Constraining facets

ENTITIES has the following ·constraining facets·:

3.3.13 integer

[Definition:]   integer is ·derived· from decimal by fixing the value of ·fractionDigits· to be 0and 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.

3.3.13.1 Lexical representation

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.

3.3.13.2 Canonical representation

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.

3.3.13.4 Derived datatypes

The following ·built-in· datatypes are ·derived· from integer:

3.3.14 nonPositiveInteger

[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.

3.3.14.1 Lexical representation

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.

3.3.14.2 Canonical representation

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.

3.3.14.4 Derived datatypes

The following ·built-in· datatypes are ·derived· from nonPositiveInteger:

3.3.15 negativeInteger

[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.

3.3.15.1 Lexical representation

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.

3.3.15.2 Canonical representation

The canonical representation for negativeInteger is defined by prohibiting certain options from the Lexical representation (§3.3.15.1).  Specifically, leading zeroes are prohibited.

3.3.16 long

[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.

3.3.16.1 Lexical representation

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.

3.3.16.2 Canonical representation

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.

3.3.16.4 Derived datatypes

The following ·built-in· datatypes are ·derived· from long:

3.3.17 int

[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.

3.3.17.1 Lexical representation

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.

3.3.17.2 Canonical representation

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.

3.3.17.4 Derived datatypes

The following ·built-in· datatypes are ·derived· from int:

3.3.18 short

[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.

3.3.18.1 Lexical representation

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.

3.3.18.2 Canonical representation

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.

3.3.18.4 Derived datatypes

The following ·built-in· datatypes are ·derived· from short:

3.3.19 byte

[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.

3.3.19.1 Lexical representation

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.

3.3.19.2 Canonical representation

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.

3.3.20 nonNegativeInteger

[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.

3.3.20.1 Lexical representation

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.

3.3.20.2 Canonical representation

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.

3.3.20.4 Derived datatypes

The following ·built-in· datatypes are ·derived· from nonNegativeInteger:

3.3.21 unsignedLong

[Definition:]   unsignedLong is ·derived· from nonNegativeInteger by setting the value of ·maxInclusive· to be 18446744073709551615. The ·base type· of unsignedLong is nonNegativeInteger.

3.3.21.1 Lexical representation

unsignedLong has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 12678967543233, 100000.

3.3.21.2 Canonical representation

The canonical representation for unsignedLong is defined by prohibiting certain options from the Lexical representation (§3.3.21.1).  Specifically, leading zeroes are prohibited.

3.3.21.4 Derived datatypes

The following ·built-in· datatypes are ·derived· from unsignedLong:

3.3.22 unsignedInt

[Definition:]   unsignedInt is ·derived· from unsignedLong by setting the value of ·maxInclusive· to be 4294967295.  The ·base type· of unsignedInt is unsignedLong.

3.3.22.1 Lexical representation

unsignedInt has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39).  For example: 0, 1267896754, 100000.

3.3.22.2 Canonical representation

The canonical representation for unsignedInt is defined by prohibiting certain options from the Lexical representation (§3.3.22.1).  Specifically, leading zeroes are prohibited.

3.3.22.4 Derived datatypes

The following ·built-in· datatypes are ·derived· from unsignedInt:

3.3.23 unsignedShort

[Definition:]   unsignedShort is ·derived· from unsignedInt by setting the value of ·maxInclusive· to be 65535.  The ·base type· of unsignedShort is unsignedInt.

3.3.23.1 Lexical representation

unsignedShort has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 12678, 10000.

3.3.23.2 Canonical representation

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.

3.3.23.4 Derived datatypes

The following ·built-in· datatypes are ·derived· from unsignedShort:

3.3.24 unsignedByte

[Definition:]   unsignedByte is ·derived· from unsignedShort by setting the value of ·maxInclusive· to be 255. The ·base type· of unsignedByte is unsignedShort.

3.3.24.1 Lexical representation

unsignedByte has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 126, 100.

3.3.24.2 Canonical representation

The canonical representation for unsignedByte is defined by prohibiting certain options from the Lexical representation (§3.3.24.1).  Specifically, leading zeroes are prohibited.

3.3.25 positiveInteger

[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.

3.3.25.1 Lexical representation

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.

3.3.25.2 Canonical representation

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.

3.3.26 yearMonthDuration

[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.

Note: The always-zero ·second· is formally retained in order that yearMonthDuration's (abstract) value space truly be a subset of that of duration  An obvious implementation optimization is to ignore the zero and implement yearMonthDuration values simply as integer values.
3.3.26.1 The yearMonthDuration Lexical Mapping

The lexical space is reduced from that of duration by disallowing duDayFrag and duTimeFrag fragments in the ·lexical representations·. The ·lexical mapping·, called "·yearMonthDurationMap·" herein, is that of duration restricted to the yearMonthDuration lexical space.

The yearMonthDuration Lexical Representation
yearMonthDurationLexicalRep ::= '-'? 'PduYearMonthFrag

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 yearMonthDuration Lexical Mapping
Maps the lexical representation into the ·month· of a yearMonthDuration value.  (A yearMonthDuration's ·second· is always zero.)  ·yearMonthDurationMap· is a restriction of ·durationMap·.

Note: Canonical mappings are not used during schema processing.  They are provided in this specification for the benefit of other users of these datatype definitions who may find them useful, and for other specifications which might find it useful to reference them normatively.

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).

The yearMonthDuration Canonical Mapping
Maps a yearMonthDuration's ·month· value to a yearMonthDurationLexicalRep.  (The ·second· value is necessarily zero and is ignored.)  ·yearMonthDurationCanonicalMap· is a restriction of ·durationCanonicalMap·.

Note: The yearMonthDuration value whose ·month· and ·second· are both zero has no ·canonical representation· in this datatype since its ·canonical representation· in duration ('PT0S') is not in the ·lexical space· of yearMonthDuration.
3.3.26.2 Constraining Facets

yearMonthDuration has the following ·constraining facets·:

  • pattern
  • eunmeration
  • whitespace
  • minInclusive
  • minExclusive
  • maxInclusive
  • maxExclusive

3.3.27 dayTimeDuration

[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.

3.3.27.1 The dayTimeDuration Lexical Space

The lexical space is reduced from that of duration by disallowing duYearFrag and duMonthFrag fragments in the ·lexical representations·. The ·lexical mapping·, called "·dayTimeDurationMap·" herein, is that of duration restricted to the dayTimeDuration lexical space.

The dayTimeDuration Lexical Representation
dayTimeDurationLexicalRep ::= '-'? 'PduDayTimeFrag

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 dayTimeDuration Lexical Mapping
Maps the lexical representation into the ·second· of a dayTimeDuration value.  (A dayTimeDuration's ·month· is always zero.)  ·dayTimeDurationMap· is a restriction of ·durationMap·.

Note: Canonical mappings are not used during schema processing.  They are provided in this specification for the benefit of other users of these datatype definitions who may find them useful, and for other specifications which might find it useful to reference them normatively.

The ·canonical mapping· is that of duration restricted to the ·value space· The ·canonical mapping· is that of duration restricted to the yearMonthDuration value space.

The dayTimeDuration Canonical Mapping
Maps a dayTimeDuration's ·second· value to a dayTimeDurationLexicalRep.  (The ·month· value is necessarily zero and is ignored.)  ·dayTimeDurationCanonicalMap· is a restriction of ·durationCanonicalMap·.
3.3.27.2 Constraining Facets

dayTimeDuration has the following ·constraining facets·:

  • pattern
  • eunmeration
  • whitespace
  • minInclusive
  • minExclusive
  • maxInclusive
  • maxExclusive

4 Datatype components

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].

next sub-section4.1 Simple Type Definition

Simple Type definitions provide for:

4.1.1 The Simple Type Definition Schema Component

The Simple Type Definition schema component has the following properties:

Schema ComponentSimple Type Definition
{name}
Optional.  An NCName as defined by [Namespaces in XML].
{target namespace}
Either absent or a namespace name, as defined in [Namespaces in XML].
{variety}
One of {atomic, list, union}. Depending on the value of {variety}, further properties are defined as follows:
atomic
{primitive type definition}
A ·built-in· ·primitive· datatype definition).
list
{item type definition}
An ·atomic· or ·union· simple type definition.
union
{member type definitions}
A non-empty sequence of simple type definitions.
{facets}
A possibly empty set of Facets (§2.5).
{information facets}
A set of ·information facets·.
{base type definition}
If the datatype has been ·derived· by ·restriction· then the Simple Type Definition component from which it is ·derived·, otherwise the Simple Type Definition for anySimpleType (§4.1.6).
{final}
A subset of {restriction, list, union}.
{annotation}
Optional.  An annotation.

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 ·facet·s specified directly in the datatype definition unioned with the possibly empty set of {facets} of {base type definition}.

The value of {information facets} consists of the set of ·information 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.

4.1.2 XML Representation of Simple Type Definition Schema Components

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:

XML Representation SummarysimpleType 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>

Datatype Definition Schema Component
PropertyRepresentation
{name} The actual value of the name [attribute], if present, otherwise null
{final} A set corresponding to the actual value of the final [attribute], if present, otherwise the actual value of the finalDefault [attribute] of the ancestor schema element information item, if present, otherwise the empty string, as follows:
the empty string
the empty set;
#all
{restriction, list, union};
otherwise
a set with members drawn from the set above, each being present or absent depending on whether the string contains an equivalently named space-delimited substring.
Note: Although the finalDefault [attribute] of schema may include values other than restriction, list or union, those values are ignored in the determination of {final}
{target namespace} The actual value of the targetNamespace [attribute] of the parent schema element information item.
{annotation} The annotation corresponding to the <annotation> element information item in the [children], if present, otherwise null

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.

4.1.2.1 Derivation by restriction
XML Representation Summaryrestriction Element Information Item

<restriction
  base = QName
  id = ID
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))
</restriction>

Simple Type Definition Schema Component
PropertyRepresentation
{variety} The actual value of {variety} of {base type definition}
{facets} The union of the set of Facets (§2.5) components resolved to by the facet [children] merged with {facets} from {base type definition}, subject to the Facet Restriction Valid constraints specified in Facets (§2.5).
{base type definition} The Simple Type Definition component resolved to by the actual value of the base [attribute] or the <simpleType> [children], whichever is present.
Example
An electronic commerce schema might define a datatype called Sku (the barcode number that appears on products) from the ·built-in· datatype string by supplying a value for the ·pattern· facet.
<simpleType name='Sku'>
    <restriction base='string'>
      <pattern value='\d{3}-[A-Z]{2}'/>
    </restriction>
</simpleType>
In this case, Sku is the name of the new ·user-derived· datatype, string is its ·base type· and ·pattern· is the facet.
4.1.2.2 Derivation by list
XML Representation Summarylist Element Information Item

<list
  id = ID
  itemType = QName
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?, simpleType?)
</list>

Simple Type Definition Schema Component
PropertyRepresentation
{variety} list
{item type definition} The Simple Type Definition component resolved to by the actual value of the itemType [attribute] or the <simpleType> [children], whichever is present.

A ·list· datatype must be ·derived· from an ·atomic· or a ·union· datatype, known as the ·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·.

Example
A system might want to store lists of floating point values.
<simpleType name='listOfFloat'>
  <list itemType='float'/>
</simpleType>
In this case, listOfFloat is the name of the new ·user-derived· datatype, float is its ·itemType· and ·list· is the derivation method.

As mentioned in List datatypes (§2.6.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.

4.1.2.3 Derivation by union
XML Representation Summaryunion 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
PropertyRepresentation
{variety} union
{member type definitions} The sequence of Simple Type Definition components resolved to by the items in the actual value of the memberTypes [attribute], if any, in order, followed by the Simple Type Definition components resolved to by the <simpleType> [children], if any, in order. If {variety} is union for any Simple Type Definition components resolved to above, then the Simple Type Definition is replaced by its {member type definitions}.

A ·union· datatype can be ·derived· from one or more ·atomic·, ·list· or other ·union· datatypes, known as the ·memberTypes· of that ·union· datatype.

Example
As an example, taken from a typical display oriented text markup language, one might want to express font sizes as an integer between 8 and 72, or with one of the tokens "small", "medium" or "large".  The ·union· type definition below would accomplish that.
<xsd:attribute name="size">
  <xsd:simpleType>
    <xsd:union>
      <xsd:simpleType>
        <xsd:restriction base="xsd:positiveInteger">
          <xsd:minInclusive value="8"/>
          <xsd:maxInclusive value="72"/>
        </xsd:restriction>
      </xsd:simpleType>
      <xsd:simpleType>
        <xsd:restriction base="xsd:NMTOKEN">
          <xsd:enumeration value="small"/>
          <xsd:enumeration value="medium"/>
          <xsd:enumeration value="large"/>
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:union>
  </xsd:simpleType>
</xsd:attribute>
<p>
<font size='large'>A header</font>
</p>
<p>
<font size='12'>this is a test</font>
</p>

As mentioned in Union datatypes (§2.6.1.3), when a datatype is ·derived· from a ·union· datatype, the only following ·constraining facet·s can be used:

regardless of the ·constraining facet·s that are applicable to the datatypes that participate in the ·union·

4.1.3 Constraints on XML Representation of Simple Type Definition

Schema Representation Constraint: Single Facet Value
Unless otherwise specifically allowed by this specification (Multiple patterns (§4.4.4.3) and Multiple enumerations (§4.4.5.3)) any given ·constraining facet· can only be specifed once within a single derivation step.
Schema Representation Constraint: itemType attribute or simpleType child
Either the itemType [attribute] or the <simpleType> [child] of the <list> element must be present, but not both.
Schema Representation Constraint: base attribute or simpleType child
Either the base [attribute] or the simpleType [child] of the <restriction> element must be present, but not both.
Schema Representation Constraint: memberTypes attribute or simpleType children
Either the memberTypes [attribute] of the <union> element must be non-empty or there must be at least one simpleType [child].

4.1.4 Simple Type Definition Validation Rules

Validation Rule: Facet Valid
A value in a ·value space· is facet-valid with respect to a ·constraining facet· component if:
1 the value is facet-valid with respect to the particular ·constraining facet· as specified below.
Validation Rule: Datatype Valid
A string is datatype-valid with respect to a datatype definition if:
1 it ·match·es a literal in the ·lexical space· of the datatype, determined as follows:
1.1 if ·pattern· is a member of {facets}, then the string must be pattern valid (§4.4.4.4);
1.2 if ·pattern· is not a member of {facets}, then
1.2.1 if {variety} is ·atomic· then the string must ·match· a literal in the ·lexical space· of {base type definition}
1.2.2 if {variety} is ·list· then the string must be a sequence of space-separated tokens, each of which ·match·es a literal in the ·lexical space· of {item type definition}
1.2.3 if {variety} is ·union· then the string must ·match· a literal in the ·lexical space· of at least one member of {member type definitions}
2 the value denoted by the literal ·match·ed in the previous step is a member of the ·value space· of the datatype, as determined by it being Facet Valid (§4.1.4) with respect to each member of {facets} (except for ·pattern·).

4.1.5 Constraints on Simple Type Definition Schema Components

Schema Component Constraint: applicable facets
The ·constraining facet·s which are allowed to be members of {facets} are dependent on {base type definition} as specified in the following table:
{base type definition}applicable {facets}
If {variety} is list, then
[all datatypes]length, minLength, maxLength, pattern, enumeration, whiteSpace
If {variety} is union, then
[all datatypes]pattern, enumeration
else if {variety} is atomic, then
stringlength, minLength, maxLength, pattern, enumeration, whiteSpace
booleanpattern, whiteSpace
floatpattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
doublepattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
decimaltotalDigits, fractionDigits, pattern, whiteSpace, enumeration, maxInclusive, maxExclusive, minInclusive, minExclusive
durationpattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
dateTimepattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
timepattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
datepattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
gYearMonthpattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
gYearpattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
gMonthDaypattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
gDaypattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
gMonthpattern, enumeration, whiteSpace, maxInclusive, maxExclusive, minInclusive, minExclusive
hexBinarylength, minLength, maxLength, pattern, enumeration, whiteSpace
base64Binarylength, minLength, maxLength, pattern, enumeration, whiteSpace
anyURIlength, minLength, maxLength, pattern, enumeration, whiteSpace
QNamelength, minLength, maxLength, pattern, enumeration, whiteSpace
NOTATIONlength, minLength, maxLength, pattern, enumeration, whiteSpace
Schema Component Constraint: list of atomic
Schema Component Constraint: no circular unions

4.1.6 Simple Type Definition for anySimpleType

There is a simple type definition nearly equivalent to the simple version of the ur-type definition present in every schema by definition.  It has the following properties:

Schema ComponentanySimpleType
{name}
anySimpleType
{target namespace}
http://www.w3.org/2001/XMLSchema
{basetype definition}
the ur-type definition
{final}
the empty set
{variety}
absent

previous sub-section next sub-section4.2 ·Information Facets·

        4.2.1 ordered
        4.2.2 bounded
        4.2.3 cardinality
        4.2.4 numeric

(·Information facets· were called "fundamental facets" in the 1.0 version of this specification.)  The purpose of an ·information facet· is to provide a limited piece of information about some aspect of a datatype.  Most ·information 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·.

Note: Schema components are identified by kind.  "Information" is not a kind of component.  Each kind of ·information facet· ("ordered", "bounded", etc.) is realized as a separate kind of schema component.

An ·information facet· component can occur only in the {information facets} of a Simple Type Definition, and this is the only place where ·information facet· components occur.  [Definition:]  The Simple Type Definition in whose {information facets} an ·information facet· component occurs is that component's parent.  Each kind of ·information facet· component occurs (once) in each Simple Type Definition's {information facets} set.

Note: The value of any ·information facet· component can always be calculated from other properties of its ·parent·.

4.2.1 ordered

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 vale for a and ·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 there is no simple means prescribed to be sure the prescribed order is either tivial or total based on the ·derivation· mechanism.

Note: Some of the "real-world" datatypes which are the basis for those defined herein are ordered in some applications, even though no order is prescribed for schema-processing purposes.  For example, boolean is sometimes ordered, and string and ·list· datatypes ·constructed· from ordered ·atomic· datatypes are sometimes given "lexical" orderings.  They are not ordered for schema-processing purposes.
4.3.1.1 The ordered Schema Component
Schema Componentordered
{value}
One of {false, partial, total}.

Editorial Note: The writeup here has been changed to look more like the way logic is currently presented in Part 1.  Some find it harder to understand.  The editors are trying to harmonize the two.  Until this is sorted out in "editors' committee", the other facet writeups are not going to change.  This will not occur before second working draft.

{value} depends on the ·parent's· {variety}, {facets} and {member type definitions}.

The appropriate case among the following must be true:
1 If the ·parent's· {variety} is atomic, then the appropriate case among the following must be true:
1.1 If the ·parent· is ·primitive·, then {value} is as specified in the table in Fundamental Facets (§F.1).
2 If the ·parent's· {variety} is list, then {value} is false.
3 otherwise the ·parent's· {variety} is union; the appropriate case among the following must be true:
3.1 If every member of the ·parent's· {member type definitions} is derived from a common ancestor other than the simple ur-type, then {value} is the same as the ordered component's {value} in that common ancestor's {information facets}.
3.2 If each member of the ·parent's· {member type definitions} has an ordered component in its {information facets} whose {value} is false, then {value} is false.
3.3 otherwise {value} is partial.

4.2.2 bounded

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 may not be in the value space of the derived datatype, but 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.

4.3.2.1 The bounded Schema Component
Schema Componentbounded

{value} depends on the ·parent's· {variety}, {facets} and {member type definitions}.

When the ·parent· is ·primitive·, {value} is as specified in the table in Fundamental Facets (§F.1).  Otherwise, when the ·parent's· {variety} is atomic, if one of minInclusive or minExclusive and one of maxInclusive or maxExclusive are members of the ·parent's· {facets} set, then {value} is true; otherwise {value} is false.

When the ·parent's· {variety} is list, {value} is false.

When the ·parent's· {variety} is union, if {value} is true for every member of the ·parent's· {member type definitions} set and all of these share a common ancestor, then {value} is true; otherwise {value} is false.

4.2.3 cardinality

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.

4.3.3.1 The cardinality Schema Component
Schema Componentcardinality
{value}
One of {finite, countably infinite}.

{value} depends on the ·parent's· {variety}, {facets}, and {member type definitions}.

When the ·parent· is ·primitive·, {value} is as specified in the table in Fundamental Facets (§F.1).  Otherwise, when the ·parent's· {variety} is atomic, {value} is countably infinite unless any of the following conditions are true, in which case {value} is finite:

  1. the ·parent's· {base type definition}'s cardinality {value} is finite,
  2. at least one of length, maxLength, or totalDigits is a member of the ·parent's· {facets} set,
  3. all of the following are true:
    1. one of minInclusive or minExclusive is a member of the ·parent's· {facets} set
    2. one of maxInclusive or maxExclusive is a member of the ·parent's· {facets} set
    3. either of the following are true:
      1. fractionDigits is a member of the ·parent's· {facets} set
      2. {primitive type definition} is one of date, gYearMonth, gYear, gMonthDay, gDay or gMonth

When the ·parent's· {variety} is list, if length or both minLength and maxLength are members of the ·parent's· {facets} set and the ·parent's· {item type definition}'s cardinality {value} is finite then {value} is finite; otherwise {value} is countably infinite.

When the ·parent's· {variety} is union, if cardinality's {value} is finite for every member of the ·parent's· {member type definitions} set then {value} is finite, otherwise {value} is countably infinite.

4.2.4 numeric

Some value spaces are made up of things that are generally considered numeric, others are not. The numeric facet value indicates which are considered numeric.

4.3.4.1 The numeric Schema Component
Schema Componentnumeric

{value} depends on the ·parent's· {variety}, {facets}, {base type definition} and {member type definitions}.

When the ·parent· is ·primitive·, {value} is as specified in the table in Fundamental Facets (§F.1).  Otherwise, when the ·parent's· {variety} is atomic, {value} is inherited from the ·parent's· {base type definition}'s numeric{value}.

When the ·parent's· {variety} is list, {value} is false.

When the ·parent's· {variety} is union, if numeric's {value} is true for every member of the ·parent's· {member type definitions} set then {value} is true, otherwise {value} is false.

previous sub-section 4.3 Constraining Facets

        4.3.1 length
        4.3.2 minLength
        4.3.3 maxLength
        4.3.4 pattern
        4.3.5 enumeration
        4.3.6 whiteSpace
        4.3.7 maxInclusive
        4.3.8 maxExclusive
        4.3.9 minExclusive
        4.3.10 minInclusive
        4.3.11 totalDigits
        4.3.12 fractionDigits

4.3.1 length

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.

Note:  For string and datatypes ·derived· from string, length will not always coincide with "string length" as perceived by some users or with the number of storage units in some digital representation. Therefore, care should be taken when specifying a value for length and in attempting to infer storage requirements from a given value for length.

·length· provides for:

Example
The following is the definition of a ·user-derived· datatype to represent product codes which must be exactly 8 characters in length.  By fixing the value of the length facet we ensure that types derived from productCode can change or set the values of other facets, such as pattern, but cannot change the length.
<simpleType name='productCode'>
   <restriction base='string'>
     <length value='8' fixed='true'/>
   </restriction>
</simpleType>
4.4.1.1 The length Schema Component
Schema Componentlength

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}.

4.4.1.2 XML Representation of length Schema Components

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:

XML Representation Summarylength Element Information Item

<length
  fixed = boolean : false
  id = ID
  value = nonNegativeInteger
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</length>

length Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{fixed} The actual value of the fixed [attribute], if present, otherwise false
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.1.3 length Validation Rules
Validation Rule: Length Valid
A value in a ·value space· is facet-valid with respect to ·length·, determined as follows:
1 if the {variety} is ·atomic· then
1.1 if {primitive type definition} is string or anyURI, then the length of the value, as measured in characters ·must· be equal to {value};
1.2 if {primitive type definition} is hexBinary or base64Binary, then the length of the value, as measured in octets of the binary data, ·must· be equal to {value};
1.3 if {primitive type definition} is QName or NOTATION, then any {value} is facet-valid.
2 if the {variety} is ·list·, then the length of the value, as measured in list items, ·must· be equal to {value}

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.

4.4.1.4 Constraints on length Schema Components
Schema Component Constraint: length and minLength or maxLength
If length is a member of {facets} then
1 It is an error for minLength to be a member of {facets} unless
1.1 the {value} of minLength <= the {value} of length and
1.2 there is type definition from which this one is derived by one or more restriction steps in which minLength has the same {value} and length is not specified.
2 It is an error for maxLength to be a member of {facets} unless
2.1 the {value} of length <= the {value} of maxLength and
2.2 there is type definition from which this one is derived by one or more restriction steps in which maxLength has the same {value} and length is not specified.
Schema Component Constraint: length valid restriction
It is an ·error· if length is among the members of {facets} of {base type definition} and {value} is not equal to the {value} of the parent length.

4.3.2 minLength

[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.

Note:  For string and datatypes ·derived· from string, minLength will not always coincide with "string length" as perceived by some users or with the number of storage units in some digital representation. Therefore, care should be taken when specifying a value for minLength and in attempting to infer storage requirements from a given value for minLength.

·minLength· provides for:

Example
The following is the definition of a ·user-derived· datatype which requires strings to have at least one character (i.e., the empty string is not in the ·value space· of this datatype).
<simpleType name='non-empty-string'>
  <restriction base='string'>
    <minLength value='1'/>
  </restriction>
</simpleType>
4.4.2.1 The minLength Schema Component
Schema ComponentminLength

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}.

4.4.2.2 XML Representation of minLength Schema Component

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:

XML Representation SummaryminLength Element Information Item

<minLength
  fixed = boolean : false
  id = ID
  value = nonNegativeInteger
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</minLength>

minLength Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{fixed} The actual value of the fixed [attribute], if present, otherwise false
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.2.3 minLength Validation Rules
Validation Rule: minLength Valid
A value in a ·value space· is facet-valid with respect to ·minLength·, determined as follows:
1 if the {variety} is ·atomic· then
1.1 if {primitive type definition} is string or anyURI, then the length of the value, as measured in characters ·must· be greater than or equal to {value};
1.2 if {primitive type definition} is hexBinary or base64Binary, then the length of the value, as measured in octets of the binary data, ·must· be greater than or equal to {value};
1.3 if {primitive type definition} is QName or NOTATION, then any {value} is facet-valid.
2 if the {variety} is ·list·, then the length of the value, as measured in list items, ·must· be greater than or equal to {value}

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.

4.4.2.4 Constraints on minLength Schema Components
Schema Component Constraint: minLength <= maxLength
If both minLength and maxLength are members of {facets}, then the {value} of minLength  ·must· be less than or equal to the {value} of maxLength.
Schema Component Constraint: minLength valid restriction
It is an ·error· if minLength is among the members of {facets} of {base type definition} and {value} is less than the {value} of the parent minLength.

4.3.3 maxLength

[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.

Note:  For string and datatypes ·derived· from string, maxLength will not always coincide with "string length" as perceived by some users or with the number of storage units in some digital representation. Therefore, care should be taken when specifying a value for maxLength and in attempting to infer storage requirements from a given value for maxLength.

·maxLength· provides for:

Example
The following is the definition of a ·user-derived· datatype which might be used to accept form input with an upper limit to the number of characters that are acceptable.
<simpleType name='form-input'>
  <restriction base='string'>
    <maxLength value='50'/>
  </restriction>
</simpleType>
4.4.3.1 The maxLength Schema Component
Schema ComponentmaxLength

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}.

4.4.3.2 XML Representation of maxLength Schema Components

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:

XML Representation SummarymaxLength Element Information Item

<maxLength
  fixed = boolean : false
  id = ID
  value = nonNegativeInteger
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</maxLength>

maxLength Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{fixed} The actual value of the fixed [attribute], if present, otherwise false
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.3.3 maxLength Validation Rules
Validation Rule: maxLength Valid
A value in a ·value space· is facet-valid with respect to ·maxLength·, determined as follows:
1 if the {variety} is ·atomic· then
1.1 if {primitive type definition} is string or anyURI, then the length of the value, as measured in characters ·must· be less than or equal to {value};
1.2 if {primitive type definition} is hexBinary or base64Binary, then the length of the value, as measured in octets of the binary data, ·must· be less than or equal to {value};
1.3 if {primitive type definition} is QName or NOTATION, then any {value} is facet-valid.
2 if the {variety} is ·list·, then the length of the value, as measured in list items, ·must· be less than or equal to {value}

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.

4.4.3.4 Constraints on maxLength Schema Components
Schema Component Constraint: maxLength valid restriction
It is an ·error· if maxLength is among the members of {facets} of {base type definition} and {value} is greater than the {value} of the parent maxLength.

4.3.4 pattern

[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:

Example
The following is the definition of a ·user-derived· datatype which is a better representation of postal codes in the United States, by limiting strings to those which are matched by a specific ·regular expression·.
<simpleType name='better-us-zipcode'>
  <restriction base='string'>
    <pattern value='[0-9]{5}(-[0-9]{4})?'/>
  </restriction>
</simpleType>
4.4.4.1 The pattern Schema Component
Schema Componentpattern
4.4.4.2 XML Representation of pattern Schema Components

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:

XML Representation Summarypattern Element Information Item

<pattern
  id = ID
  value = string
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</pattern>

pattern Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.4.3 Constraints on XML Representation of pattern
Schema Representation Constraint: Multiple patterns
If multiple <pattern> element information items appear as [children] of a <simpleType>, the [value]s should be combined as if they appeared in a single ·regular expression· as separate ·branch·es.
Note:  It is a consequence of the schema representation constraint Multiple patterns (§4.4.4.3) and of the rules for ·restriction· that ·pattern· facets specified on the same step in a type derivation are ORed together, while ·pattern· facets specified on different steps of a type derivation are ANDed together.

Thus, to impose two ·pattern· constraints simultaneously, schema authors may either write a single ·pattern· which expresses the intersection of the two ·pattern·s they wish to impose, or define each ·pattern· on a separate type derivation step.
4.4.4.4 pattern Validation Rules
Validation Rule: pattern valid
A literal in a ·lexical space· is facet-valid with respect to ·pattern· if:
1 the literal is among the set of character sequences denoted by the ·regular expression· specified in {value}.

4.3.5 enumeration

[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:

Example
The following example is a datatype definition for a ·user-derived· datatype which limits the values of dates to the three US holidays enumerated. This datatype definition would appear in a schema authored by an "end-user" and shows how to define a datatype by enumerating the values in its ·value space·.  The enumerated values must be type-valid literals for the ·base type·.
<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>
4.4.5.1 The enumeration Schema Component
Schema Componentenumeration
{value}
A set of values from the ·value space· of the {base type definition}.
{annotation}
Optional.  An annotation.
4.4.5.2 XML Representation of enumeration Schema Components

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:

XML Representation Summaryenumeration Element Information Item

<enumeration
  id = ID
  value = anySimpleType
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</enumeration>

enumeration Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.5.3 Constraints on XML Representation of enumeration
Schema Representation Constraint: Multiple enumerations
If multiple <enumeration> element information items appear as [children] of a <simpleType> the {value} of the enumeration component should be the set of all such [value]s.
4.4.5.4 enumeration Validation Rules
Validation Rule: enumeration valid
A value in a ·value space· is facet-valid with respect to ·enumeration· if the value is one of the values specified in {value}
4.4.5.5 Constraints on enumeration Schema Components
Schema Component Constraint: enumeration valid restriction
It is an ·error· if any member of {value} is not in the ·value space· of {base type definition}.

4.3.6 whiteSpace

[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}.

preserve
No normalization is done, the value is not changed (this is the behavior required by [XML] for element content)
replace
All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return) are replaced with #x20 (space)
collapse
After the processing implied by replace, contiguous sequences of #x20's are collapsed to a single #x20, and leading and trailing #x20's are removed.
Note:  The notation #xA used here (and elsewhere in this specification) represents the Universal Character Set (UCS) code point hexadecimal A (line feed), which is denoted by U+000A.  This notation is to be distinguished from &#xA;, 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.

Note:  For more information on whiteSpace, see the discussion on white space normalization in Schema Component Details in [XML Schema Part 1: Structures].

·whiteSpace· provides for:

  • Constraining a ·value space· according to the white space normalization rules.
Example
The following example is the datatype definition for the token ·built-in·  ·derived· datatype.
<simpleType name='token'>
    <restriction base='normalizedString'>
      <whiteSpace value='collapse'/>
    </restriction>
</simpleType>
4.4.6.1 The whiteSpace Schema Component
Schema ComponentwhiteSpace
{value}
One of {preserve, replace, collapse}.
{fixed}
A boolean.
{annotation}
Optional.  An annotation.

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}.

4.4.6.2 XML Representation of whiteSpace Schema Components

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:

XML Representation SummarywhiteSpace 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
PropertyRepresentation
{value} The actual value of the value [attribute]
{fixed} The actual value of the fixed [attribute], if present, otherwise false
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.6.3 whiteSpace Validation Rules
Note:  There are no ·Validation Rule·s associated ·whiteSpace·. For more information, see the discussion on white space normalization in Schema Component Details in [XML Schema Part 1: Structures].
4.4.6.4 Constraints on whiteSpace Schema Components
Schema Component Constraint: whiteSpace valid restriction
It is an ·error· if whiteSpace is among the members of {facets} of {base type definition} and any of the following conditions is true:
1 {value} is replace or preserve and the {value} of the parent whiteSpace is collapse
2 {value} is preserve and the {value} of the parent whiteSpace is replace

4.3.7 maxInclusive

[Definition:]   maxInclusive is the ·inclusive upper bound· of the ·value space· for a datatype with the ·ordered· property.  The value of maxInclusive ·must· be in the ·value space· of the ·base type·.

·maxInclusive· provides for:

Example
The following is the definition of a ·user-derived· datatype which limits values to integers less than or equal to 100, using ·maxInclusive·.
<simpleType name='one-hundred-or-less'>
  <restriction base='integer'>
    <maxInclusive value='100'/>
  </restriction>
</simpleType>
4.4.7.1 The maxInclusive Schema Component
Schema ComponentmaxInclusive

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}.

4.4.7.2 XML Representation of maxInclusive Schema Components

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:

XML Representation SummarymaxInclusive Element Information Item

<maxInclusive
  fixed = boolean : false
  id = ID
  value = anySimpleType
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</maxInclusive>

maxInclusive Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{fixed} The actual value of the fixed [attribute], if present, otherwise false, if present, otherwise false
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.7.3 maxInclusive Validation Rules
Validation Rule: maxInclusive Valid
A value in an ·ordered· ·value space· is facet-valid with respect to ·maxInclusive·, determined as follows:
1 if the ·numeric· property in {information facets} is true, then the value ·must· be numerically less than or equal to {value};
2 if the ·numeric· property in {information facets} is false (i.e., {base type definition} is one of the date and time related datatypes), then the value ·must· be chronologically less than or equal to {value};
4.4.7.4 Constraints on maxInclusive Schema Components
Schema Component Constraint: minInclusive <= maxInclusive
It is an ·error· for the value specified for ·minInclusive· to be greater than the value specified for ·maxInclusive· for the same datatype.
Schema Component Constraint: maxInclusive valid restriction
It is an ·error· if any of the following conditions is true:
1 maxInclusive is among the members of {facets} of {base type definition} and {value} is greater than the {value} of the parent maxInclusive
2 maxExclusive is among the members of {facets} of {base type definition} and {value} is greater than or equal to the {value} of the parent maxExclusive
3 minInclusive is among the members of {facets} of {base type definition} and {value} is less than the {value} of the parent minInclusive
4 minExclusive is among the members of {facets} of {base type definition} and {value} is less than or equal to the {value} of the parent minExclusive

4.3.8 maxExclusive

[Definition:]   maxExclusive is the ·exclusive upper bound· of the ·value space· for a datatype with the ·ordered· property.  The value of maxExclusive  ·must· be in the ·value space· of the ·base type· or be equal to {value} in {base type definition}.

·maxExclusive· provides for:

Example
The following is the definition of a ·user-derived· datatype which limits values to integers less than or equal to 100, using ·maxExclusive·.
<simpleType name='less-than-one-hundred-and-one'>
  <restriction base='integer'>
    <maxExclusive value='101'/>
  </restriction>
</simpleType>
Note that the ·value space· of this datatype is identical to the previous one (named 'one-hundred-or-less').
4.4.8.1 The maxExclusive Schema Component
Schema ComponentmaxExclusive

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}.

4.4.8.2 XML Representation of maxExclusive Schema Components

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:

XML Representation SummarymaxExclusive Element Information Item

<maxExclusive
  fixed = boolean : false
  id = ID
  value = anySimpleType
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</maxExclusive>

maxExclusive Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{fixed} The actual value of the fixed [attribute], if present, otherwise false
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.8.3 maxExclusive Validation Rules
Validation Rule: maxExclusive Valid
A value in an ·ordered· ·value space· is facet-valid with respect to ·maxExclusive·, determined as follows:
1 if the ·numeric· property in {information facets} is true, then the value ·must· be numerically less than {value};
2 if the ·numeric· property in {information facets} is false (i.e., {base type definition} is one of the date and time related datatypes), then the value ·must· be chronologically less than {value};
4.4.8.4 Constraints on maxExclusive Schema Components
Schema Component Constraint: maxInclusive and maxExclusive
It is an ·error· for both ·maxInclusive· and ·maxExclusive· to be specified in the same derivation step of a datatype definition.
Schema Component Constraint: minExclusive <= maxExclusive
It is an ·error· for the value specified for ·minExclusive· to be greater than the value specified for ·maxExclusive· for the same datatype.
Schema Component Constraint: maxExclusive valid restriction
It is an ·error· if any of the following conditions is true:
1 maxExclusive is among the members of {facets} of {base type definition} and {value} is greater than the {value} of the parent maxExclusive
2 maxInclusive is among the members of {facets} of {base type definition} and {value} is greater than the {value} of the parent maxInclusive
3 minInclusive is among the members of {facets} of {base type definition} and {value} is less than or equal to the {value} of the parent minInclusive
4 minExclusive is among the members of {facets} of {base type definition} and {value} is less than or equal to the {value} of the parent minExclusive

4.3.9 minExclusive

[Definition:]   minExclusive is the ·exclusive lower bound· of the ·value space· for a datatype with the ·ordered· property. The value of minExclusive ·must· be in the ·value space· of the ·base type· or be equal to {value} in {base type definition}.

·minExclusive· provides for:

Example
The following is the definition of a ·user-derived· datatype which limits values to integers greater than or equal to 100, using ·minExclusive·.
<simpleType name='more-than-ninety-nine'>
  <restriction base='integer'>
    <minExclusive value='99'/>
  </restriction>
</simpleType>
Note that the ·value space· of this datatype is identical to the previous one (named 'one-hundred-or-more').
4.4.9.1 The minExclusive Schema Component
Schema ComponentminExclusive

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}.

4.4.9.2 XML Representation of minExclusive Schema Components

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:

XML Representation SummaryminExclusive Element Information Item

<minExclusive
  fixed = boolean : false
  id = ID
  value = anySimpleType
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</minExclusive>

minExclusive Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{fixed} The actual value of the fixed [attribute], if present, otherwise false
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.9.3 minExclusive Validation Rules
Validation Rule: minExclusive Valid
A value in an ·ordered· ·value space· is facet-valid with respect to ·minExclusive· if:
1 if the ·numeric· property in {information facets} is true, then the value ·must· be numerically greater than {value};
2 if the ·numeric· property in {information facets} is false (i.e., {base type definition} is one of the date and time related datatypes), then the value ·must· be chronologically greater than {value};
4.4.9.4 Constraints on minExclusive Schema Components
Schema Component Constraint: minInclusive and minExclusive
It is an ·error· for both ·minInclusive· and ·minExclusive· to be specified for the same datatype.
Schema Component Constraint: minExclusive < maxInclusive
It is an ·error· for the value specified for ·minExclusive· to be greater than or equal to the value specified for ·maxInclusive· for the same datatype.
Schema Component Constraint: minExclusive valid restriction
It is an ·error· if any of the following conditions is true:
1 minExclusive is among the members of {facets} of {base type definition} and {value} is less than the {value} of the parent minExclusive
2 maxInclusive is among the members of {facets} of {base type definition} and {value} is greater the {value} of the parent maxInclusive
3 minInclusive is among the members of {facets} of {base type definition} and {value} is less than the {value} of the parent minInclusive
4 maxExclusive is among the members of {facets} of {base type definition} and {value} is greater than or equal to the {value} of the parent maxExclusive

4.3.10 minInclusive

[Definition:]   minInclusive is the ·inclusive lower bound· of the ·value space· for a datatype with the ·ordered· property.  The value of minInclusive  ·must· be in the ·value space· of the ·base type·.

·minInclusive· provides for:

Example
The following is the definition of a ·user-derived· datatype which limits values to integers greater than or equal to 100, using ·minInclusive·.
<simpleType name='one-hundred-or-more'>
  <restriction base='integer'>
    <minInclusive value='100'/>
  </restriction>
</simpleType>
4.4.10.1 The minInclusive Schema Component
Schema ComponentminInclusive

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}.

4.4.10.2 XML Representation of minInclusive Schema Components

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:

XML Representation SummaryminInclusive Element Information Item

<minInclusive
  fixed = boolean : false
  id = ID
  value = anySimpleType
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</minInclusive>

minInclusive Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{fixed} The actual value of the fixed [attribute], if present, otherwise false
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.10.3 minInclusive Validation Rules
Validation Rule: minInclusive Valid
A value in an ·ordered· ·value space· is facet-valid with respect to ·minInclusive· if:
1 if the ·numeric· property in {information facets} is true, then the value ·must· be numerically greater than or equal to {value};
2 if the ·numeric· property in {information facets} is false (i.e., {base type definition} is one of the date and time related datatypes), then the value ·must· be chronologically greater than or equal to {value};
4.4.10.4 Constraints on minInclusive Schema Components
Schema Component Constraint: minInclusive < maxExclusive
It is an ·error· for the value specified for ·minInclusive· to be greater than or equal to the value specified for ·maxExclusive· for the same datatype.
Schema Component Constraint: minInclusive valid restriction
It is an ·error· if any of the following conditions is true:
1 minInclusive is among the members of {facets} of {base type definition} and {value} is less than the {value} of the parent minInclusive
2 maxInclusive is among the members of {facets} of {base type definition} and {value} is greater the {value} of the parent maxInclusive
3 minExclusive is among the members of {facets} of {base type definition} and {value} is less than or equal to the {value} of the parent minExclusive
4 maxExclusive is among the members of {facets} of {base type definition} and {value} is greater than or equal to the {value} of the parent maxExclusive

4.3.11 totalDigits

[Definition:]   totalDigits controls the maximum number of values in the ·value space· of datatypes ·derived· from decimal, by restricting it to numbers that are expressible as i × 10^-n where i and n are integers such that |i| < 10^totalDigits and 0 <= n <= totalDigits. The value of totalDigits ·must· be a positiveInteger.

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. Note that it does not restrict the ·lexical space· directly; a lexical representation that adds additional leading zero digits or trailing fractional zero digits is still permitted.

4.4.11.1 The totalDigits Schema Component
Schema ComponenttotalDigits

If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for totalDigits other than {value}.

4.4.11.2 XML Representation of totalDigits Schema Components

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:

XML Representation SummarytotalDigits Element Information Item

<totalDigits
  fixed = boolean : false
  id = ID
  value = positiveInteger
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</totalDigits>

totalDigits Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{fixed} The actual value of the fixed [attribute], if present, otherwise false
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.11.3 totalDigits Validation Rules
Validation Rule: totalDigits Valid
A value in a ·value space· is facet-valid with respect to ·totalDigits· if:
1 that value is expressible as i × 10^-n where i and n are integers such that |i| < 10^{value} and 0 <= n <= {value}.
4.4.11.4 Constraints on totalDigits Schema Components
Schema Component Constraint: totalDigits valid restriction
It is an ·error· if totalDigits is among the members of {facets} of {base type definition} and {value} is greater than the {value} of the parent totalDigits

4.3.12 fractionDigits

[Definition:]   fractionDigits controls the size of the minimum difference between values in the ·value space· of datatypes ·derived· from decimal, by restricting the ·value space· to numbers that are expressible as i × 10^-n where i and n are integers and 0 <= n <= fractionDigits. 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 using at most fractionDigits to the right of the decimal point. Note that it does not restrict the ·lexical space· directly; a non-·canonical representation· that adds additional leading zero digits or trailing fractional zero digits is still permitted.

Example
The following is the definition of a ·user-derived· datatype which could be used to represent the magnitude of a person's body temperature on the Celsius scale. This definition would appear in a schema authored by an "end-user" and shows how to define a datatype by specifying facet values which constrain the range of the ·base type·.
<simpleType name='celsiusBodyTemp'>
  <restriction base='decimal'>
    <totalDigits value='4'/>
    <fractionDigits value='1'/>
    <minInclusive value='36.4'/>
    <maxInclusive value='40.5'/>
  </restriction>
</simpleType>
4.4.12.1 The fractionDigits Schema Component

If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for fractionDigits other than {value}.

4.4.12.2 XML Representation of fractionDigits Schema Components

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:

XML Representation SummaryfractionDigits Element Information Item

<fractionDigits
  fixed = boolean : false
  id = ID
  value = nonNegativeInteger
  {any attributes with non-schema namespace . . .}>
  Content: (annotation?)
</fractionDigits>

fractionDigits Schema Component
PropertyRepresentation
{value} The actual value of the value [attribute]
{fixed} The actual value of the fixed [attribute], if present, otherwise false
{annotation} The annotations corresponding to all the <annotation> element information items in the [children], if any.
4.4.12.3 fractionDigits Validation Rules
Validation Rule: fractionDigits Valid
A value in a ·value space· is facet-valid with respect to ·fractionDigits· if:
1 that value is expressible as i × 10^-n where i and n are integers and 0 <= n <= {value}.
4.4.12.4 Constraints on fractionDigits Schema Components
Schema Component Constraint: fractionDigits less than or equal to totalDigits
It is an ·error· for ·fractionDigits· to be greater than ·totalDigits·.
Schema Component Constraint: fractionDigits valid restriction
It is an ·error· if ·fractionDigits· is among the members of {facets} of {base type definition} and {value} is greater than the {value} of the parent ·fractionDigits·.

5 Conformance

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.

Note:  By separating the conformance requirements relating to the concrete syntax of XML schema documents, this specification admits processors which validate using schemas stored in optimized binary representations, dynamically created schemas represented as programming language data structures, or implementations in which particular schemas are compiled into executable code such as C or Java.  Such processors can be said to be ·minimally conforming· but not necessarily in ·conformance to the XML Representation of Schemas·.

A Schema for Datatype Definitions (normative)

<!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 NMTOKEN #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: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:appinfo id ID #IMPLIED>
        <!ATTLIST xs:documentation id ID #IMPLIED>
        <!ATTLIST xs:list id ID #IMPLIED>
        <!ATTLIST xs:union id ID #IMPLIED>
        ]>

<xs:schema xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty"
           xmlns:xs="http://www.w3.org/2001/XMLSchema" blockDefault="#all"
           elementFormDefault="qualified" xml:lang="en"
           targetNamespace="http://www.w3.org/2001/XMLSchema"
           version="Id: datatypes.xsd,v 1.4 2004/05/29 10:26:33 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 &lt;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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <xs:whiteSpace fixed="true" value="collapse" id="decimal.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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:anySimpleType">
      <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:fractionDigits fixed="true" value="0" id="integer.fractionDigits"/>
      <xs:pattern value="[\-+]?[0-9]+"/>
    </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: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: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:numFacet">
          <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="length" type="xs:numFacet" 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:numFacet" 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:numFacet" 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="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>

B DTD for Datatype Definitions (non-normative)

<!--
        DTD for XML Schemas: Part 2: Datatypes
        Id: datatypes.dtd,v 1.1 2003/08/28 13:30:52 ht 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 % length "%p;length">
<!ENTITY % minLength "%p;minLength">
<!ENTITY % maxLength "%p;maxLength">
<!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 % 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;">
<!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 %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;>

C Temporary Stuff (to be added elsewhere)

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:]  Constructed datatypes are those that are defined in terms of other datatypes.

[Definition:]  Derived datatypes are those that are ·constructed· by restiction or extension.

D Built-up Value Spaces

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:

next sub-sectionD.1 Numerical Values

        D.1.1 Precision
        D.1.2 Exact Lexical Mappings
        D.1.3

The following standard operators are defined here in case the reader is unsure of their definition:

Note: n ·div· 1  is a convenient and short way of expressing "the greatest integer in n".

D.1.1 Precision

Numbers are sometimes thought of as including both a numerical value and a "precision".  Precision can be thought of as a band "plus or minus" from the numerical value itself.  For example, "five plus-or-minus two" or "two million to the nearest thousand".

There is a smaller class of "precision numbers" which do not require the "plus-or-minus" in order to indicate their precision.  They indicate their precision by the number of digits to the right of the decimal point.  5.0 has precision plus-or-minus 0.05, but 5.00 has precision plus-or-minus 0.005.

There is also a kind of precision where the plus-or-minus is expressed as a percentage (or other proportion) of the numerical value, rather than an exact value:  "15 plus-or-minus 10 percent" or "15000 plus-or-minus 10 percent", where the same percentage indicates a different absolute precision depending on the size.  This kind of precision is properly called "geometric precision"; the absolute precision first described is properly called "arithmetic precision".

A close approximation to geometric precision also can, for some combinations of numerical value and precision, be indicated without the "plus-or-minus":  The precision is indicated by the total number of digits (not counting leading zero digits).  5.0 has precision plus-or-minus 1 percent but 5.00 has precision plus-or-minus one-tenth percent.

Geometric precision doesn't quite match with the digit count.  5.0 and 50 both have precision plus-or-minus 1 percent but 1.5 and 15 both have precision plus-or-minus 3 percent.  For various reasons we choose to call this digit-count precision "floating-point precision".

The precisionDecimal datatype described in this specification embodies both arithmetic and floating-point precision for numbers whose numerical values are decimal numbers, with arithmetic precision describable simply by the number of fraction digits. It turns out that for these particular precision numbers, there is a relation between the arithmetic precision (expressed as the number of fraction digits) and floating-point precision (expressed as the total number of digits, excluding redundant leading zero digits).  If a is the arithmetic precision of a precisionDecimal number whose numerical value is n, then the floating-point precision is  (log(| n – 10a |) + 1) ·div· 1 .  This formula, of course, doesn't work for numerical value zero.  In that case, we find it convenient (and consonant with established practice) to freeze floating-point precision at 1 and still allow various arithmetic precision values.

One point needs to be made about the notations and the precisions they can indicate.  It's impossible for ordinary decimal notation to indicate a positive arithmetic precision (as in "one million to the nearest thousand"); this needs "scientific notation":  1000E3 (or 1.000E6).

D.1.2 Exact Lexical Mappings

Numerals and Fragments Thereof
digit ::= [0-9]
unsignedNoDecimalPtNumeral ::= digit+
signedDecimalPtNumeral ::= ('+' | '-') unsignedNoDecimalPtNumeral
noDecimalPtNumeral ::= ('+' | '-')? unsignedNoDecimalPtNumeral
fracFrag ::= digit+
unsignedDecimalPtNumeral ::= (unsignedNoDecimalPtNumeral '.fracFrag?) | ('.fracFrag)
unsignedFullDecimalPtNumeral ::= unsignedNoDecimalPtNumeral '.fracFrag
decimalPtNumeral ::= ('+' | '-')? unsignedDecimalPtNumeral
unsignedScientificNotationNumeral ::= (unsignedNoDecimalPtNumeral | unsignedDecimalPtNumeral) ('e' | 'E') noDecimalPtNumeral
scientificNotationNumeral ::= ('+' | '-')? unsignedScientificNotationNumeral

Generic Numeral-to-Number Lexical Mappings
·unsignedNoDecimalMap· (N) —> integer
Maps an unsignedNoDecimalPtNumeral to its numerical value.
·noDecimalMap· (N) —> integer
Maps an noDecimalPtNumeral to its numerical value.
·unsignedDecimalPtMap· (D) —> decimal number
Maps an unsignedDecimalPtNumeral to its numerical value.
·decimalPtMap· (N) —> decimal number
Maps a decimalPtNumeral to its numerical value.
·scientificMap· (N) —> decimal number
Maps a scientificNotationNumeral to its numerical value.

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:

Special Non-numerical Lexical Representations Used With Numerical Datatypes
numericalSpecialRep ::= 'INF' | '+INF' | '-INF' | 'NaN'

Lexical Mapping for Non-numerical constants Used With Numerical Datatypes
Maps the ·lexical representations· of constants used with some numerical datatypes to those constants.

Canonical Mapping for Non-numerical constants Used With Numerical Datatypes
Maps the constants used with some numerical datatypes to their ·canonical representations·.

D.1.3

previous sub-section D.2 Date/time Values

        D.2.1 Dates and Times in the Real World
        D.2.2 The Seven-property Model
        D.2.3 Lexical Mappings
Issue (RQ-122i):RQ-122 (define dateTime value space)

Much of the material defining the various date/time datatypes is found here and is or will be referenced in the sections defining each individual date/time datatype. See e.g. gDay (§3.2.14).

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.

D.2.1 Dates and Times in the Real World

Except for the tables of lengths of months and occurrences of leap-seconds, this section is informative, not normative.

There are various concepts involving dates (counting days) and times (counting moments) that have developed over the millenia.  This section does not pretend to be a complete tutorial on the history; it only discusses the methods which are necessary to understand just which set of the possible reasonable choices has been adopted for Schema date/time datatypes.

D.2.1.1 Seconds, Minutes, and Days

A day is, at least approximately, the time of one rotation of the Earth about its axis with respect to the Sun.  Each day is divided into 24 hours; each hour into 60 minutes, and each minute usually into 60 seconds.  (The hedges in those sentences are deliberate, and their resolution shows why one must be careful to insure that all users of Schema date/time datatypes are in fact correctly using the same datatype.)  For the purposes of this section and the next, a day always begins and ends when the rotation of the Earth about its axis places the Sun exactly (at least for UT1, and approximately for the others) overhead (at its "zenith") at 0 degrees longitude.

Thus a day is (usually) 86400 (= 60 × 60 × 24) seconds.

[Definition:]  Universal Time 1 (UT1) is "real" time: One day is (exactly, or at least as close as can be astronomically measured) one revolution of the Earth about its axis with respect to the Sun.  The day is divided into 86400 equal-length seconds, which may vary in length from day to day. [Definition:]  International Atomic Time (TAI or Temps Atomique International) is time measured in seconds as established by a collection of atomic clocks maintained by various national standards agencies. The time counts that Schema has chosen to represent are based on ·UTC·: [Definition:]  Universal Coordinated Time (UTC) is an adaptation of TAI which closely approximates UT1 by adding ·leap-seconds· to selected ·UTC· days. Relations between them are as follows:

  • TAI seconds are all the same length, and there are exactly 86400 seconds in each day.
  • UT1 seconds vary in length, but there are exactly 86400 seconds each day.  Days always have the sun at zenith at noon in Greenwich, England.  (As a historical note, the TAI second, defined in 1956 in terms of the excitation frequency of Cesium atoms, was chosen to be the average length of a UT1 second during the year 1900.)
  • Noon of TAI days do not necessarily match the Sun at the zenith. In 1958, TAI was promulgated and synchronized with UT1.  Since then, the difference has been slowly increasing, with a given number of seconds from that date measured in UT1 coming later than that same number measured in TAI.
  • ·UTC· seconds are the same as TAI seconds, but [Definition:]  ·UTC· day boundaries are kept approximately in sync with UT1 by adding an extra leap-second or so to a day once in a while; therefore occasionally a ·UTC· day is not exactly 86400 seconds.  In 1972, ·UTC· was synchronized with TAI (and UT1) to lock them all together retroactively to the date when TAI was synchronized with UT1·UTC· is now kept within 0.9 seconds of UT1 by an international standards organization which declares on an ad hoc basis when additional leap-seconds are added (or subtracted, although the physical situations that might require substraction seem unlikely to occur).  As of 2003, the difference between the two is 32 seconds.  New leap-seconds are always added immediately preceding midnight (when the Earth's rotation puts the Sun opposite the noon zenith) at 0 degrees longitude (i.e., midnight in the timezone so determined).

    As of the writing of this specification, leap-seconds have been added to ·UTC· at the end of each of the following days (as identified by the Gregorian calendar, see Counting Days: Years and Months (§D.2.1.2)), and no future leap-seconds have been announced:

    DateNumber of Leap-secondsDateNumber of Leap-seconds
    1960-12-311.4228181975-12-311
    1961-07-310.2247521976-12-311
    1961-01-310.1982881977-12-311
    1963-10-300.85142081978-12-311
    1963-12-310.06851521989-12-311
    1964-03-310.2179361981-06-301
    1964-08-310.2982881982-06-301
    1964-01-310.2581121983-06-301
    1965-02-280.1764641985-06-301
    1965-06-300.2581121987-12-311
    1965-08-310.1803521989-12-311
    1965-12-310.1581121990-12-311
    1968-01-311.8725121992-06-301
    1971-12-313.8143181993-06-301
    1972-06-3011994-06-301
    1972-12-3111995-12-311
    1973-12-3111997-06-301
    1974-12-3111998-12-311

    Leap-seconds added prior to 1972-06-30 (when ·UTC·'s first post-adoption leap-second was added) were inherited from previous "standard" times. (Data in the table was derived from data provided by the US Naval Observatory.)

Note: There are inherently no precise measurements of the difference between UT1 on the one hand and proleptic (i.e., used to measure times prior to their adoption) TAI and ·UTC· on the other before 1958, although they are known (by virtue of early astornomical records) to differ from UT1 by several hours around year 0000.  Users must be aware that they differ, if they deal with extremely accurate measures over widely separated moments, and must be sure they know which system is being used.

Schema date/time datatypes (except duration) are leap-second-aware; that is to say, they use ·UTC· rather than UT1 or TAI.  duration is a special case; it is not leap-second aware, but the algorithm for adding durations to or subtracting them from other date/time datatypes compensates.

D.2.1.2 Counting Days: Years and Months

Once one decides on how many seconds are in each day, one must also count the days—and months and years.  The standard used for Schema date/time datatypes is the so-called "Gregorian calendar".  Since days are (generally) 86400 seconds, and one wants each year to correspond to one complete cycle of the Earth around the Sun (which is not exactly a multiple of 86400 seconds), and traditionally months have various numbers of days, the following algorithm was chosen to determine which days fell in which months in which years: Counting from an agreed-upon arbitrary day, years are numbered consecutively, each year has 12 months (numbered 1 through 12, as well as named) within it, and each day has between 28 and 31 days (also numbered from 1), depending on the month and year according to the following table:

MonthNbr of Days
1 (January)31
2 (February)If the associated year is divisble by 400, or by 4 but not 100, then 29; otherwise 28
3 (March)31
4 (April)30
5 (May)31
6 (June)30
7 (July)31
8 (August)31
9 (September)30
10 (October)31
11 (November)30
12 (December)31

For example, the three numbers (year, month, and day) for 20 January 2003 (2003-01-20) are 2003, 1, and 20 respectively.

Issue (RQ-123i):RQ-123 (year 0000 in date/time datatypes)

The following rewrite includes allowing year 0000 (1 BCE) and redefining all the lexical representations with negative years from that specified in Schema 1.0, as warned in a Note in Schema 1.0 2E.  A formal Note calling attention to this change elsewhere in the "normative" part of this specification will be added.

The count of years, months, and days were made official and locked to "real" time by decree of (the Roman Catholic) Pope Gregory in 1582 (from which comes the name "Gregorian").  Since then, and somewhat even before, days had been counted with reasonable historical accuracy so that the Gregorian calendar algorithm can even be used proleptically, i.e., to establish dates prior to its official adoption.  By relatively recent convention (it began to be adopted by astronomers during the 1800s), there is a year numbered zero; this makes calculating the difference between two dates easier.  The year called "1 of the Common Era" ("1 CE", or "1 AD") is numbered one; the preceding year is numbered zero, not minus one.  (Warning: The date using the proleptic Gregorian calendar will not generally be the same for a given day as the date using the "Julian" calendar which was in common use prior to the adoption of the Gregorian calendar, nor will Gregorian years "before the Common Era" ("BCE", or "BC") be numbered the same as with the current standard negative numbering.)

There are also standard schemes for numbering days without reference to months and years.  The most common is [Definition:]  the modified Julian date (MJD), which counts days from 17 Nov 1858 (1858-11-17). The older count is [Definition:]  the Julian date (JD), which sets its zero day exactly 2,400,000.5 days earlier than MJD. (JD days begin at noon!) Schema, however, counts seconds rather than days and arbitrarily begins its initial moment at the beginning of 1 Jan 1 CE (0001-01-01), to describe certain functions.  (Since a schema implementation need not expose this count, implementers are free to use other base moments and/or to count by days, providing they retain awareness of ·leap-seconds·.)

Note that the JD day-counting scheme is not the same as the Julian calendar which was supplanted by the Gregorian calendar described above.

D.2.1.3 Timezones: When does a Day Start?

All of the preceding discussion applies to "real" times at the "Greenwich meridian", the meridian where longitude is 0 degrees.  Human society has found it convenient to have noon all over the globe at least approximately when the Sun is overhead—and more recently also to have moments numbered the same in nearby localities, with the differences between separated localities well-known.  Thus the invention of timezones.  A timezone is a way of describing a local time by specifying the number of hours and minutes which must be added to the "standard" time to get the local time.  The "standard" time is selected to be that where noon is when the Sun is exactly overhead at 0 degrees longitude; ·UTC· is officially locked to that particular timezone.  Schema date/time datatypes (except duration) are timezone-sensitive; that is to say, they retain knowledge of a timezone if one is specified in a lexical representation.

A moment in time is like a point on a line; the point does not change if we change where we put zero on the line, but the number we use to represent that point changes.  Similarly, when one specifies a moment in time, one can specify the same moment regardless of which timezone one specifies, but the numbers one uses for year, month, day, hour, minute, and second will be different.

D.2.2 The Seven-property Model

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 ·UTC·, so having the timezone makes it possible to calculate the corresponding "raw" values, as they would be reckoned in that timezone.

an integer
an integer between 1 and 12 inclusive
an integer between 1 and 28, 29, 30, or 31 inclusive, depending on ·month· and ·year·
an integer between 0 and 23 inclusive, or 24 if both ·minute· and ·second· are zero
an integer between 0 and 59 inclusive
a decimal number greater than or equal 0, less than 60 except as prescribed in the table of leap-seconds in Seconds, Minutes, and Days (§D.2.1.1); must be less than 60 if ·timezone· is absent.
an ·optional· integer between –840 and 840 inclusive

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.

Note: Leap-seconds are not permitted when ·timezone· is absent, because the presence of a leap-second value together with particular ·hour· and ·minute· values determines a ·timezone· so it might as well be explicit.  (All date/time datatypes that do not require ·second· to be absent also prohibit that value for ·hour· and ·minute·.)

While calculating, property values from the dateTime 1971-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.  1971-12-31T00:00:00 happens to permit both the maximum number of days and the maximum number of seconds.

Time on Timeline for Date/time Seven-property Models
·timeOnTimeline· (dt) —> decimal number
Maps a date/timeSevenPropertyModel value to the decimal number representing its position on the "time line".

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.

D.2.3 Lexical Mappings

[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.

Date/time Lexical Representation Fragments
yearFrag ::= '-'? (([1-9digit digit digit+)) | ('0digit digit digit))
monthFrag ::= ('0' [1-9]) | ('1' [01])
dayFrag ::= ([0-2digit) | ('3' [01])
hourFrag ::= ([01digit) | ('2' [0-4])
minuteFrag ::= [0-5digit
secondFrag ::= [0-6digit ('.digit+)?
timezoneFrag ::= 'Z' | (('+' | '-') ('0digit | '1' [0-4]) ':minuteFrag)

Each fragment other than timezoneFrag defines a subset of the ·lexical space· of decimal; the corresponding ·lexical mapping· is the decimal ·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.

Partial Date/time Lexical Mappings
·yearFragValue· (YR) —> integer
Maps a yearFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·year· property of a date/timeSevenPropertyModel value.
·monthFragValue· (MO) —> integer
Maps a monthFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·month· property of a date/timeSevenPropertyModel value.
·dayFragValue· (DA) —> integer
Maps a dayFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·day· property of a date/timeSevenPropertyModel value.
·hourFragValue· (HR) —> integer
Maps a hourFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·hour· property of a date/timeSevenPropertyModel value.
·minuteFragValue· (MI) —> integer
Maps a minuteFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·minute· property of a date/timeSevenPropertyModel value.
·secondFragValue· (SE) —> decimal number
Maps a secondFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto a decimal number, presumably the ·second· property of a date/timeSevenPropertyModel value.
·timezoneFragValue· (TZ) —> integer
Maps a timezoneFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·timezone· property of a date/timeSevenPropertyModel value.

(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):

Partial Date/time Canonical Mappings
Maps an integer, presumably the ·year· property of a date/timeSevenPropertyModel value, onto a yearFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.
Maps an integer, presumably the ·month· property of a date/timeSevenPropertyModel value, onto a monthFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.
Maps an integer, presumably the ·day· property of a date/timeSevenPropertyModel value, onto a dayFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.
Maps an integer, presumably the ·hour· property of a date/timeSevenPropertyModel value, onto a hourFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.
Maps an integer, presumably the ·minute· property of a date/timeSevenPropertyModel value, onto a minuteFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.
Maps a decimal number, presumably the ·second· property of a date/timeSevenPropertyModel value, onto a secondFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.
Maps an integer, presumably the ·timezone· property of a date/timeSevenPropertyModel value, onto a timezoneFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.

E Function Definitions

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.

next sub-sectionE.1 Generic Number-related Functions

The following functions are used with various numeric and date/time datatypes.

Auxiliary Functions for Operating on Numeral Fragments
·digitValue· (d) —> integer
Maps each digit to its numerical value.
Arguments:
dmatches digit
Result:
a nonnegative integer less than ten
Algorithm:
Return
  • 0   when  d = '0' ,
  • 1   when  d = '1' ,
  • 2   when  d = '2' ,
  • etc.
·digitSequenceValue· (S) —> integer
Maps a sequence of digits to the position-weighted sum of the terms numerical values.
Arguments:
Sa finite sequence of character strings, each term matching digit.
Result:
a nonnegative integer
Algorithm:
Return the sum of ·digitValue·(Si) × 10length(S)–i  where i runs over the domain of S.
·fractionDigitSequenceValue· (S) —> integer
Maps a sequence of digits to the position-weighted sum of the terms numerical values, weighted appropriately for fractional digits.
Arguments:
Sa finite sequence of character strings, each term matching digit.
Result:
a nonnegative integer
Algorithm:
Return the sum of ·digitValue·(Si) – 10i  where i runs over the domain of S.
·fractionFragValue· (N) —> decimal number
Maps a fracFrag to the appropriate fractional decimal number.
Arguments:
Nmatches fracFrag
Result:
a nonnegative decimal number
Algorithm:
N is necessarily the left-to-right concatenation of a finite sequence S of character strings, each term matching digit.

Generic Numeral-to-Number Lexical Mappings
·unsignedNoDecimalMap· (N) —> integer
Maps an unsignedNoDecimalPtNumeral to its numerical value.
Arguments:Result:
a nonnegative integer
Algorithm:
N is the left-to-right concatenation of a finite sequence S of character strings, each term matching digit.
·noDecimalMap· (N) —> integer
Maps an noDecimalPtNumeral to its numerical value.
Arguments:
Nmatches noDecimalPtNumeral
Result:
a nonnegative integer
Algorithm:
N necessarily consists of an optional sign('+' or '-') and then a character string U that matches unsignedNoDecimalPtNumeral.
Return
·unsignedDecimalPtMap· (D) —> decimal number
Maps an unsignedDecimalPtNumeral to its numerical value.
Arguments:Result:
a nonnegative decimal number
Algorithm:
D necessarily consists of an optional character string N matching unsignedNoDecimalPtNumeral, a decimal point, and then an optional character string F matching fracFrag.
Return
·decimalPtMap· (N) —> decimal number
Maps a decimalPtNumeral to its numerical value.
Arguments:
Nmatches decimalPtNumeral
Result:
a decimal number
Algorithm:
N necessarily consists of an optional sign('+' or '-') and then an instance U of unsignedDecimalPtNumeral.
Return
·scientificMap· (N) —> decimal number
Maps a scientificNotationNumeral to its numerical value.
Arguments:Result:
Algorithm:
N necessarily consists of an instance C of either noDecimalPtNumeral or decimalPtNumeral, either an 'e' or an 'E', and then an instance E of noDecimalPtNumeral.
Return

Auxiliary Functions for Producing Numeral Fragments
·digit· (i) —> digit
Maps each integer between 0 and 9 to the corresponding digit.
Arguments:
ibetween 0 and 9 inclusive
Result:
matches digit
Algorithm:
Return
  • '0'   when  i = 0 ,
  • '1'   when  i = 1 ,
  • '2'   when  i = 2 ,
  • etc.
·digitRemainderSeq· (i) —> sequence of integers
Maps each nonnegative integer to a sequence of integers used by ·digitSeq· to ultimately create an unsignedNoDecimalPtNumeral.
Arguments:
ia nonnegative integer
Result:
sequence of nonnegative integers
Algorithm:
Return that sequence s for which
  • s0 = i  and
  • sj+1 = sj ·div· 10 .
·digitSeq· (i) —> sequence of integers
Maps each nonnegative integer to a sequence of integers used by ·unsignedNoDecimalPtCanonicalMap· to create an unsignedNoDecimalPtNumeral.
Arguments:
ia nonnegative integer
Result:
sequence of integers where each term is between 0 and 9 inclusive
Algorithm:
Return that sequence s for which  sj =·digitRemainderSeq·(i)j ·mod· 10 .
·lastSignificantDigit· (s) —> integer
Maps a sequence of nonnegative integers to the index of the first zero term.
Arguments:
sa sequence of nonnegative integers
Result:
a nonnegative integer
Algorithm:
Return the smallest nonnegative integer j such that s(i)j+1 is 0.
·FractionDigitRemainderSeq· (f) —> sequence of decimal numbers
Maps each nonnegative decimal number less than 1 to a sequence of decimal numbers used by ·fractionDigitSeq· to ultimately create an unsignedNoDecimalPtNumeral.
Arguments:
fnonnegative and less than 1
Result:
a sequence of nonnegative decimal numbers
Algorithm:
Return that sequence s for which
  • s0 = f – 10 , and
  • sj+1 = (sj ·mod· 1) – 10 .
·fractionDigitSeq· (f) —> sequence of integers
Maps each nonnegative decimal number less than 1 to a sequence of integers used by ·fractionDigitsCanonicalFragmentMap· to ultimately create an unsignedNoDecimalPtNumeral.
Arguments:
fnonnegative and less than 1
Result:
a sequence of integer;s where each term is between 0 and 9 inclusive
Algorithm:
Return that sequence s for which  sj = ·FractionDigitRemainderSeq·(f)j ·div· 1 .
·fractionDigitsCanonicalFragmentMap· (f) —> fracFrag
Maps each nonnegative decimal number less than 1 to a character string used by ·unsignedDecimalPtCanonicalMap· to create an unsignedDecimalPtNumeral.
Arguments:
fnonnegative and less than 1
Result:
matches fracFrag
Algorithm:

Generic Number to Numeral Canonical Mappings
Arguments:
ia nonnegative integer
Result:Algorithm:
Return ·digit·(·digitSeq·(i)·lastSignificantDigit·(·digitRemainderSeq·(i))) & . . . & ·digit·(·digitSeq·(i)0) .   (Note that the concatenation is in reverse order.)
Arguments:
ian integer
Result:Algorithm:
Return
Arguments:
na nonnegative decimal number
Result:Algorithm:
Arguments:
na decimal number
Result:Algorithm:
Return
Arguments:
na nonnegative decimal number
Result:Algorithm:
Return  ·unsignedDecimalPtCanonicalMap·(n / 10log(n·div· 1) & 'E' & ·noDecimalPtCanonicalMap·(log(n·div· 1)
Arguments:
na decimal number
Result:Algorithm:
Return

For example:

Lexical Mapping for Non-numerical constants Used With Numerical Datatypes
·specialRepValue· (S) —> constant
Maps the ·lexical representations· of constants used with some numerical datatypes to those constants.
Arguments:Result:
one of positiveInfinity, negativeInfinity, or notANumber.
Algorithm:
Return
  • positiveInfinity   when S is 'INF' or '+INF',
  • negativeInfinity   when S is '-INF', and
  • notANumber   when S is 'NaN'
Canonical Mapping for Non-numerical constants Used With Numerical Datatypes
·specialRepCanonicalMap· (c) —> numericalSpecialRep
Maps the constants used with some numerical datatypes to their ·canonical representations·.
Arguments:
cone of positiveInfinity, negativeInfinity, and notANumber
Result:Algorithm:
Return
  • 'INF'   when c is positiveInfinity
  • '-INF'   when c is negativeInfinity
  • 'NaN'   when c is notANumber
Auxilliary Functions for Reading Instances of precisionDecimalRep
·decimalPtPrecision· (LEX) —> integer
Maps a decimalPtNumeral onto an integer presumably intended as the ·arthmeticPrecision· of a precisionDecimal value.
Arguments:
LEXmatches decimalPtNumeral
Result:
an integer
Algorithm:
LEX necessarily contains a decimal point ('.') and may optionally contain a following fracFrag F consisting of some number n of digits.
Return
  • n   when F is present, and
  • 0   otherwise.
·scientificPrecision· (LEX) —> integer
Maps a scientificNotationNumeral onto an integer presumably intended as the ·arthmeticPrecision· of a precisionDecimal value.
Arguments:Result:
an integer
Algorithm:
LEX necessarily contains a noDecimalPtNumeral or decimalPtNumeral C preceeding an exponent indicator ('E' or 'e', and a following noDecimalPtNumeral E.
Return
Lexical Mapping
Arguments:
LEXmatches precisionDecimalRep
Result:Algorithm:
Let pD be a complete precisionDecimal value.
  1. Set pD's ·numericalValue· to
  2. set pD's ·arthmeticPrecision· to
  3. Set pD's ·sign· to
    • absent   when LEX is 'NaN'
    • negative   when the first character of LEX is '-', and
    • positive   otherwise.

Editorial Note: The algorithm for ·precisionDecimalCanonicalMap· has not yet been written.

Canonical Mapping
Arguments:
pDa precisionDecimal value
Result:
a character string matching precisionDecimalRep
Algorithm:
(TBD)

previous sub-section next sub-sectionE.2 duration-related Definitions

The following functions are primarily used with the duration datatype and its derivatives.

Auxiliary duration-related Functions Operating on Representation Fragments
·duYearFragmentMap· (Y) —> integer
Maps a duYearFrag to an integer, intended as part of the value of the ·month· property of a duration value.
Arguments:
Ymatches duYearFrag
Result:
a nonnegative integer
Algorithm:
Y is necessarily the letter 'Y' followed by a numeral N:
Return ·noDecimalMap·(N).
·duMonthFragmentMap· (M) —> integer
Maps a duMonthFrag to an integer, intended as part of the value of the ·month· property of a duration value.
Arguments:
Mmatches duYearFrag
Result:
a nonnegative integer
Algorithm:
M is necessarily the letter 'M' followed by a numeral N:
Return ·noDecimalMap·(N).
·duDayFragmentMap· (D) —> integer
Maps a duDayFrag to an integer, intended as part of the value of the ·second· property of a duration value.
Arguments:
Dmatches duDayFrag
Result:
a nonnegative integer
Algorithm:
D is necessarily the letter 'D' followed by a numeral N:
Return ·noDecimalMap·(N).
·duHourFragmentMap· (H) —> integer
Maps a duHourFrag to an integer, intended as part of the value of the ·second· property of a duration value.
Arguments:
Hmatches duHourFrag
Result:
a nonnegative integer
Algorithm:
D is necessarily the letter 'D' followed by a numeral N:
Return ·noDecimalMap·(N).
·duMinuteFragmentMap· (M) —> integer
Maps a duMinuteFrag to an integer, intended as part of the value of the ·second· property of a duration value.
Arguments:
Mmatches duMinuteFrag
Result:
a nonnegative integer
Algorithm:
M is necessarily the letter 'M' followed by a numeral N:
Return ·noDecimalMap·(N).
·duSecondFragmentMap· (S) —> decimal number
Maps a duSecondFrag to a decimal number, intended as part of the value of the ·second· property of a duration value.
Arguments:
Smatches duSecondFrag
Result:
a nonnegative decimal number
Algorithm:
S is necessarily 'S' followed by a numeral N:
Return
·duYearMonthFragmentMap· (YM) —> integer
Maps a duYearMonthFrag into an integer, intended as part of the ·month· property of a duration value.
Arguments:
YMmatches duYearMonthFrag
Result:
a nonnegative integer
Algorithm:
YM necessarily consists of an instance Y of duYearFrag and/or an instance M of duMonthFrag:
Let
Return  12 × y + m .
·duTimeFragmentMap· (T) —> decimal number
Maps a duTimeFrag into a decimal number, intended as part of the ·second· property of a duration value.
Arguments:
Tmatches duTimeFrag
Result:
a nonnegative decimal number
Algorithm:
T necessarily consists of an instance H of duHourFrag, and/or an instance M of duMinuteFrag, and/or an instance S of duSecondFrag.
Let
Return  3600 × h + 60 × m + s .
·duDayTimeFragmentMap· (DT) —> decimal number
Maps a duDayTimeFrag into a decimal number, which is the potential value of the ·second· property of a duration value.
Arguments:
DTmatches duDayTimeFrag
Result:
a nonnegative decimal number
Algorithm:
DT necesarily consists of an instance D of duDayFrag and/or an instance T of duTimeFrag.
Let
Return  86400 × d + t .

The duration Lexical Mapping
·durationMap· (DUR) —> duration
Separates the durationLexicalRep into the month part and the seconds part, then maps them into the ·month· and ·second· of the duration value.
Arguments:
DURmatches durationLexicalRep
Result:
a complete duration value
Algorithm:
DUR consists of possibly a leading '-', followed by 'P' and then an instance Y of duYearMonthFrag and/or an instance D of duDayTimeFrag:
Return a duration whose and whose

The yearMonthDuration Lexical Mapping
·yearMonthDurationMap· (YM) —> yearMonthDuration
Maps the lexical representation into the ·month· of a yearMonthDuration value.  (A yearMonthDuration's ·second· is always zero.)  ·yearMonthDurationMap· is a restriction of ·durationMap·.
Arguments:Result:
a complete yearMonthDuration value
Algorithm:
YM necessarily consists of an optional leading '-', followed by 'P' and then an instance Y of duYearMonthFrag:
Return a yearMonthDuration whose

The dayTimeDuration Lexical Mapping
·dayTimeDurationMap· (DT) —> dayTimeDuration
Maps the lexical representation into the ·second· of a dayTimeDuration value.  (A dayTimeDuration's ·month· is always zero.)  ·dayTimeDurationMap· is a restriction of ·durationMap·.
Arguments:
DTa dayTimeDuration value
Result:
a complete dayTimeDuration value
Algorithm:
DT necessarily consists of possibly a leading '-', followed by 'P' and then an instance D of duDayTimeFrag:
Return a dayTimeDuration whose

Auxiliary duration-related Functions Producing Representation Fragments
·duYearMonthCanonicalFragmentMap· (ym) —> duYearMonthFrag
Maps a nonnegative integer, presumably the absolute value of the ·month· of a duration value, to a duYearMonthFrag, a fragment of a duration ·lexical representation·.
Arguments:
yma nonnegative integer
Result:
a character string matching duYearMonthFrag
Algorithm:
Let
Return
·duDayCanonicalFragmentMap· (d) —> duDayFrag
Maps a nonnegative integer, presumably the day normalized value from the ·second· of a duration value, to a duDayFrag, a fragment of a duration ·lexical representation·.
Arguments:
da nonnegative integer
Result:
a character string matching duDayFrag
Algorithm:
Return
·duHourCanonicalFragmentMap· (h) —> duHourFrag
Maps a nonnegative integer, presumably the hour normalized value from the ·second· of a duration value, to a duHourFrag, a fragment of a duration ·lexical representation·.
Arguments:
ha nonnegative integer
Result:
a character string matching duHourFrag
Algorithm:
Return
·duMinuteCanonicalFragmentMap· (m) —> duMinuteFrag
Maps a nonnegative integer, presumably the minute normalized value from the ·second· of a duration value, to a duMinuteFrag, a fragment of a duration ·lexical representation·.
Arguments:
ma nonnegative integer
Result:
a character string matching duMinuteFrag
Algorithm:
Return
·duSecondCanonicalFragmentMap· (s) —> duSecondFrag
Maps a nonnegative decimal number, presumably the second normalized value from the ·second· of a duration value, to a duSecondFrag, a fragment of a duration ·lexical representation·.
Arguments:
sa nonnegative decimal number
Result:
matches duSecondFrag
Algorithm:
Return
·duTimeCanonicalFragmentMap· (hms) —> duTimeFrag
Maps three nonnegative numbers, presumably the hour, minute, and second normalized values from a duration's ·second·, to a duTimeFrag, a fragment of a duration ·lexical representation·.
Arguments:
ha nonnegative integer
ma nonnegative integer
sa nonnegative decimal number
Result:
a character string matching duTimeFrag
Algorithm:
Return
·duDayTimeCanonicalFragmentMap· (ss) —> duDayTimeFrag
Maps a nonnegative decimal number, presumably the absolute value of the ·second· of a duration value, to a duDayTimeFrag, a fragment of a duration ·lexical representation·.
Arguments:
ssa nonnegative decimal number
Result:Algorithm:
Let
Return

The duration Canonical Mapping
·durationCanonicalMap· (v) —> durationLexicalRep
Maps a duration's property values to durationLexicalRep fragments and combines the fragments into a complete durationLexicalRep.
Arguments:
va complete duration value
Result:Algorithm:
Let
  • m be v's ·month·,
  • s be v's ·second·, and
  • sgn be '-' if m or s is negative and the empty string ('') otherwise.
Return

The yearMonthDuration Canonical Mapping
Arguments:
yma complete yearMonthDuration value
Result:Algorithm:
Let
  • m be ym's ·month· and
  • sgn be '-' if m is negative and the empty string ('') otherwise.
Return  sgn & 'P' & ·duYearMonthCanonicalFragmentMap·(| m |) .

The dayTimeDuration Canonical Mapping
Arguments:
dta complete dayTimeDuration value
Result:Algorithm:
Let
  • s be dt's ·month· and
  • sgn be '-' if s is negative and the empty string ('') otherwise.
Return sgn & 'P' & ·duYearMonthCanonicalFragmentMap·(| s |) .

previous sub-section E.3 Date/time-related Definitions

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 and from "raw" values) and when adding duration values to or subtracting them from dateTime values.

Date/time Datatype Normalizing Procedures
Arguments:
yran integer
moan integer
Algorithm:
  1. Add  (mo – 1) ·div· 12  to yr.
  2. Set mo to  (mo – 1) ·mod· 12 .
·normalizeDay· (yrmoda)
Normalizes month and year values to values that obey the appropriate constraints.
Arguments:
yran integer
moan integer
daan integer
Algorithm:
  1. ·normalizeMonth·(yrmo)
  2. Repeat until da is positive and not greater than the limit specified in the table of day limits in Counting Days: Years and Months (§D.2.1.2) (which depends on yr and mo):
    1. If da exceeds the upper limit from the table then:
      1. Subtract that limit from da.
      2. Add 1 to mo.
      3. ·normalizeMonth·(yrmo)
    2. If da is not positive then:
      1. Subtract 1 from mo.
      2. ·normalizeMonth·(yrmo)
      3. Add the new upper limit from the table to da.
·normalizeMinute· (yrmodahrmi)
Normalizes minute, hour, month, and year values to values that obey the appropriate constraints.
Arguments:
yran integer
moan integer
daan integer
hran integer
mian integer
Algorithm:
  1. Add   mi ·div· 60  to hr.
  2. Set mi to  mi ·mod· 60 .
  3. Add  hr ·div· 24  to da.
  4. Set hr to  hr ·mod· 24 .
  5. ·normalizeDay·(yrmoda).
·lsiNormalizeSecond· (yryrdahrmise)
Normalizes second, minute, hour, month, and year values to values that obey the appropriate constraints.  (This algorithm is "leap-second insensitive".)
Arguments:
yran integer
yran integer
daan integer
hran integer
mian integer
sea decimal number
Algorithm:
  1. Add  se ·div· 60  to mi.
  2. Set se to  se ·mod· 60 .
  3. ·normalizeMinute·(yrmodahrmi).
·lssNormalizeSecond· (yrmodahrmise)
Normalizes second, minute, hour, month, and year values to values that obey the appropriate constraints.  (This algorithm is "leap-second sensitive".)
Arguments:
yr an integer
mo an integer
da an integer
hr an integer
mi an integer
se a decimal number
Algorithm:
  1. ·normalizeDay·(yrmoda).
  2. Add  60 × mi + 3600 × hr to se .
  3. Set mi and hr to zero.
  4. Repeat until se is nonnegative and less than 86400 plus the number of leap-seconds specified by the leap-second table in Seconds, Minutes, and Days (§D.2.1.1) (which depends on yr, mo, and da):
    1. If se equals or exceeds 86400 plus the upper limit from the table then:
      1. Subtract  (86400 plus that leap-second count) from se.
      2. Add 1 to da.
    2. If se is negative then:
      1. Subtract 1 from da.
      2. Add 86400 plus the new leap-second count from the table to se.
    3. ·normalizeDay·(yrmoda).
    1. If se is less than 86340 then:
      1. Set mi to se ·div· 60.
      2. Set se to se ·mod· 60.
    2. If se is not less than 86340 then:
      1. Set mi to 1439.
      2. Subtract 86340 from se.
  5. ·normalizeMinute·(yrmodahrmi)

Note: The "raw-value" functions following all have very similar algorithms

"Raw" Properties of Date/time Seven-property Models
·rawYear· (dt) —> integer
Returns the "raw" year value of a date/timeSevenPropertyModel, i.e., the "local timezone" year, as opposed to the ·UTC· year. (This matters only near the year boundaries.)
Arguments:Result:
an integer
Algorithm:
Let
  1. Add ·timezone· to mi
  2. ·normalizeMinute·(yrmodahrmi).
  3. If ·timezone· or dt's ·year· is absent, return dt's ·year·; otherwise, return yr.
·rawMonth· (dt) —> integer
Returns the "raw" month value of a date/timeSevenPropertyModel, i.e., the "local timezone" month, as opposed to the ·UTC· month. (This matters only near the month boundaries.)
Arguments:Result:
an integer
Algorithm:
Let
  1. Add ·timezone· to mi
  2. ·normalizeMinute·(yrmodahrmi).
  3. If ·timezone· or dt's ·month· is absent, return dt's ·month·; otherwise, return mo.
·rawDay· (dt) —> integer
Returns the "raw" day value of a date/timeSevenPropertyModel, i.e., the "local timezone" day, as opposed to the ·UTC· day.
Arguments:Result:
an integer
Algorithm:
Let
  1. Add ·timezone· to mi
  2. ·normalizeMinute·(yrmodahrmi).
  3. If ·timezone· or dt's ·day· is absent, return dt's ·day·; otherwise, return da.
·rawHour· (dt) —> integer
Returns the "raw" hour value of a date/timeSevenPropertyModel, i.e., the "local timezone" hour, as opposed to the ·UTC· hour.
Arguments:Result:
an integer
Algorithm:
Let
  1. Add ·timezone· to mi
  2. ·normalizeMinute·(yrmodahrmi).
  3. If ·timezone· or dt's ·hour· is absent, return dt's ·hour·; otherwise, return hr.
·rawMinute· (dt) —> integer
Returns the "raw" minute value of a date/timeSevenPropertyModel, i.e., the "local timezone" minute, as opposed to the ·UTC· minute.
Arguments:Result:
an integer
Algorithm:
Let
  1. Add ·timezone· to mi
  2. ·normalizeMinute·(yrmodahrmi).
  3. If ·timezone· or dt's ·minute· is absent, return dt's ·minute·; otherwise, return mi.
·rawSecond· (dt) —> decimal number
Returns the "raw" second value of a date/timeSevenPropertyModel, i.e., the "local timezone" second, as opposed to the ·UTC· second; however, for seconds, there is no difference.
Arguments:Result:
a decimal number
Algorithm:
Return ·second· value unchanged.
·setDateTimeFromRaw· (dtrawYrrawMorawDarawHrrawMirawSe)
Sets the properties of a date/timeSevenPropertyModel from the "raw" values provided (the "local timezone" values, as opposed to the ·UTC· values). absent values are given default values for computation, but ultimately absent properties remain absent.
Arguments:
dta date/timeSevenPropertyModel value
rawYran ·optional· integer
rawMoan ·optional· integer
rawDaan ·optional· integer
rawHran ·optional· integer
rawMian ·optional· integer
rawSean ·optional· decimal number
Algorithm:
Let
  1. If dt's ·timezone· is not absent,
    1. Subtract ·timezone· from mi
    2. ·normalizeMinute·(yr,mo,da,hr,mi).
  2. Set ·year· to yr when ·year· is not absent, ·month· to mo when ·month· is not absent, etc.

Time on Timeline for Date/time Seven-property Models
·timeOnTimeline· (dt) —> decimal number
Maps a date/timeSevenPropertyModel value to the decimal number representing its position on the "time line".
Arguments:Result:
a decimal number
Algorithm:
Let
  • yr be 1970 when dt's ·year· is absent, and  dt's ·year· – 1  otherwise,
  • mo be 12 or dt's ·month· , similarly,
  • da be  (the limit specified in the table of day limits) – 1  or  (dt's ·day·) – 1 , similarly,
  • hr be 0 or dt's ·hour· , similarly, and
  • mi be 0 or dt's ·minute· , similarly.
  1. (·year·)
    1. Set ToTl to  31536000 × yr .
  2. (Leap-year Days, ·month·, and ·day·)
    1. Add  86400 × (yr ·div· 400 – yr ·div· 100 + yr ·div· 4)  to ToTl.
    2. Add   86400 × (total number of days in months less than mo, from table in Counting Days: Years and Months (§D.2.1.2)) to ToTl
    3. Add   86400 × da  to ToTl.
  3. (·hour·, ·minute·, and ·second·)
    1. Add   3600 × hr + 60 × mi + se  to ToTl.
  4. Return ToTl.

Partial Date/time Lexical Mappings
·yearFragValue· (YR) —> integer
Maps a yearFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·year· property of a date/timeSevenPropertyModel value.
Arguments:
YRmatches yearFrag
Result:
an integer
Algorithm:
Return ·noDecimalMap·(YR)
·monthFragValue· (MO) —> integer
Maps a monthFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·month· property of a date/timeSevenPropertyModel value.
Arguments:
MOmatches monthFrag
Result:
an integer
Algorithm:
·dayFragValue· (DA) —> integer
Maps a dayFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·day· property of a date/timeSevenPropertyModel value.
Arguments:
DAmatches dayFrag
Result:
an integer
Algorithm:
·hourFragValue· (HR) —> integer
Maps a hourFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·hour· property of a date/timeSevenPropertyModel value.
Arguments:
HRmatches hourFrag
Result:
an integer
Algorithm:
·minuteFragValue· (MI) —> integer
Maps a minuteFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·minute· property of a date/timeSevenPropertyModel value.
Arguments:
MImatches minuteFrag
Result:
an integer
Algorithm:
·secondFragValue· (SE) —> decimal number
Maps a secondFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto a decimal number, presumably the ·second· property of a date/timeSevenPropertyModel value.
Arguments:
SEmatches secondFrag
Result:
a decimal number
Algorithm:
Return
·timezoneFragValue· (TZ) —> integer
Maps a timezoneFrag, part of a date/timeSevenPropertyModel's ·lexical representation·, onto an integer, presumably the ·timezone· property of a date/timeSevenPropertyModel value.
Arguments:
TZmatches timezoneFrag
Result:
an integer
Algorithm:
TZ necessarily consists of either just 'Z', or a sign ('+' or '-') followed by an instance H of hourFrag, a colon, and an instance M of minuteFrag
Return
Lexical Mapping
·gDayLexicalRep· (LEX) —> gDay
Maps a gDayLexicalRep to a gDay value.
Arguments:
LEXmatches gDayLexicalRep
Result:
a complete gDay value
Algorithm:
LEX necessarily includes an instance D of dayFrag, optionally followed by an instance T of timezoneFrag.
Let gD be a complete gDay value with all property values absent.
  1. Set gD's ·timezone· to ·timezoneFragValue·(T) when T is present and absent otherwise.
  2. ·setDateTimeFromRaw·(gD, absent, absent, ·dayFragValue·(D), absent, absent, absent)
  3. Return gD.
Auxiliary Functions for Date/time Canonical Mappings
·unsTwoDigitCanonicalFragmentMap· (i) —> unsignedNoDecimalPtNumeral
Maps a nonnegative integer less than 100 onto an unsigned always-two-digit numeral.
Arguments:
ia nonnegative integer less than 100
Result:Algorithm:
Return ·digit·(i ·div· 10) & ·digit·(i ·mod· 10)
·fourDigitCanonicalFragmentMap· (i) —> noDecimalPtNumeral
Maps an integer between -10000 and 10000 onto an always-four-digit numeral.
Arguments:
ian integer whose absolute value is less than 10000
Result:Algorithm:
Partial Date/time Canonical Mappings
·yearCanonicalFragmentMap· (y) —> yearFrag
Maps an integer, presumably the ·year· property of a date/timeSevenPropertyModel value, onto a yearFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.
Arguments:
yan integer
Result:
matches yearFrag
Algorithm:
Return
Arguments:
man integer between 1 and 12 inclusive
Result:
matches monthFrag
Algorithm:
·dayCanonicalFragmentMap· (d) —> dayFrag
Maps an integer, presumably the ·day· property of a date/timeSevenPropertyModel value, onto a dayFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.
Arguments:
dan integer between 1 and 31 inclusive  (may be limited further depending on associated ·year· and ·month·)
Result:
matches dayFrag
Algorithm:
·hourCanonicalFragmentMap· (h) —> hourFrag
Maps an integer, presumably the ·hour· property of a date/timeSevenPropertyModel value, onto a hourFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.
Arguments:
han integer between 0 and 23 inclusive.
Result:
matches hourFrag
Algorithm:Arguments:
man integer between 0 and 59 inclusive.
Result:
matches minuteFrag
Algorithm:
·secondCanonicalFragmentMap· (s) —> secondFrag
Maps a decimal number, presumably the ·second· property of a date/timeSevenPropertyModel value, onto a secondFrag, part of a date/timeSevenPropertyModel's ·lexical representation·.
Arguments:
sa nonnegative decimal number less than 70
Result:
matches secondFrag
Algorithm:Arguments:
tan integer between –840 and 840 inclusive
Result:
matches timezoneFrag
Algorithm:
Return
Canonical Mapping
Arguments:
gDa complete gDay value
Result:Algorithm:

F Datatypes and Facets

F.1 Fundamental Facets

The following table shows the values of the fundamental facets for each ·built-in· datatype.

 Datatypeorderedboundedcardinalitynumeric
primitivestringfalsefalsecountably infinitefalse
booleanfalsefalsefinitefalse
floattotaltruefinitetrue
doubletotaltruefinitetrue
decimaltotalfalsecountably infinitetrue
durationpartialfalsecountably infinitefalse
dateTimepartialfalsecountably infinitefalse
timepartialfalsecountably infinitefalse
datepartialfalsecountably infinitefalse
gYearMonthpartialfalsecountably infinitefalse
gYearpartialfalsecountably infinitefalse
gMonthDaypartialfalsecountably infinitefalse
gDaypartialfalsecountably infinitefalse
gMonthpartialfalsecountably infinitefalse
hexBinaryfalsefalsecountably infinitefalse
base64Binaryfalsefalsecountably infinitefalse
anyURIfalsefalsecountably infinitefalse
QNamefalsefalsecountably infinitefalse
NOTATIONfalsefalsecountably infinitefalse
derivednormalizedStringfalsefalsecountably infinitefalse
tokenfalsefalsecountably infinitefalse
languagefalsefalsecountably infinitefalse
IDREFSfalsefalsecountably infinitefalse
ENTITIESfalsefalsecountably infinitefalse
NMTOKENfalsefalsecountably infinitefalse
NMTOKENSfalsefalsecountably infinitefalse
Namefalsefalsecountably infinitefalse
NCNamefalsefalsecountably infinitefalse
IDfalsefalsecountably infinitefalse
IDREFfalsefalsecountably infinitefalse
ENTITYfalsefalsecountably infinitefalse
integertotalfalsecountably infinitetrue
nonPositiveIntegertotalfalsecountably infinitetrue
negativeIntegertotalfalsecountably infinitetrue
longtotaltruefinitetrue
inttotaltruefinitetrue
shorttotaltruefinitetrue
bytetotaltruefinitetrue
nonNegativeIntegertotalfalsecountably infinitetrue
unsignedLongtotaltruefinitetrue
unsignedInttotaltruefinitetrue
unsignedShorttotaltruefinitetrue
unsignedBytetotaltruefinitetrue
positiveIntegertotalfalsecountably infinitetrue

G ISO 8601 Date and Time Formats

Editorial Note: It is likely that this Appendix will be deleted once all date/time datatype descriptions are written to the new format using the seven-property model, as illustrated in gDay (§3.2.14).

next sub-sectionG.1 ISO 8601 Conventions

The ·primitive· datatypes duration, dateTime, time, date, gYearMonth, gMonthDay, gDay, gMonth and gYear use lexical formats inspired by [ISO 8601]. Following [ISO 8601], the lexical forms of these datatypes can include only the characters #20 through #7F. This appendix provides more detail on the ISO formats and discusses some deviations from them for the datatypes defined in this specification.

[ISO 8601] "specifies the representation of dates in the proleptic Gregorian calendar and times and representations of periods of time". The proleptic Gregorian calendar includes dates prior to 1582 (the year it came into use as an ecclesiastical calendar). It should be pointed out that the datatypes described in this specification do not cover all the types of data covered by [ISO 8601], nor do they support all the lexical representations for those types of data.

[ISO 8601] lexical formats are described using "pictures" in which characters are used in place of decimal digits. The allowed decimal digits are (#x30-#x39). For the primitive datatypes dateTime, time, date, gYearMonth, gMonthDay, gDay, gMonth and gYear. these characters have the following meanings:

  • C -- represents a digit used in the thousands and hundreds components, the "century" component, of the time element "year". Legal values are from 0 to 9.
  • Y -- represents a digit used in the tens and units components of the time element "year".  Legal values are from 0 to 9.
  • M -- represents a digit used in the time element "month".  The two digits in a MM format can have values from 1 to 12.
  • D -- represents a digit used in the time element "day". The two digits in a DD format can have values from 1 to 28 if the month value equals 2, 1 to 29 if the month value equals 2 and the year is a leap year, 1 to 30 if the month value equals 4, 6, 9 or 11, and 1 to 31 if the month value equals 1, 3, 5, 7, 8, 10 or 12.
  • h -- represents a digit used in the time element "hour". The two digits in a hh format can have values from 0 to 24. If the value of the hour element is 24 then the values of the minutes element and the seconds element must be 00 and 00.
  • m -- represents a digit used in the time element "minute". The two digits in a mm format can have values from 0 to 59.
  • s -- represents a digit used in the time element "second".  The two digits in a ss format can have values from 0 to 60.  In the formats described in this specification the whole number of seconds ·may· be followed by decimal seconds to an arbitrary level of precision. This is represented in the picture by "ss.sss".  A value of 60 or more is allowed only in the case of leap seconds. 

    Strictly speaking, a value of 60 or more is not sensible unless the month and day could represent March 31, June 30, September 30, or December 31 in ·UTC·. Because the leap second is added or subtracted as the last second of the day in ·UTC· time, the long (or short) minute could occur at other times in local time.  In cases where the leap second is used with an inappropriate month and day it, and any fractional seconds, should considered as added or subtracted from the following minute.

For all the information items indicated by the above characters, leading zeros are required where indicated.

In addition to the above, certain characters are used as designators and appear as themselves in lexical formats.

  • T -- is used as time designator to indicate the start of the representation of the time of day in dateTime.
  • Z -- is used as time-zone designator, immediately (without a space) following a data element expressing the time of day in Coordinated Universal Time (·UTC·) in dateTime, time, date, gYearMonth, gMonthDay, gDay, gMonth, and gYear.

In the lexical format for duration the following characters are also used as designators and appear as themselves in lexical formats:

  • P -- is used as the time duration designator, preceding a data element representing a given duration of time.
  • Y -- follows the number of years in a time duration.
  • M -- follows the number of months or minutes in a time duration.
  • D -- follows the number of days in a time duration.
  • H -- follows the number of hours in a time duration.
  • S -- follows the number of seconds in a time duration.

The values of the Year, Month, Day, Hour and Minutes components are not restricted but allow an arbitrary integer.  Similarly, the value of the Seconds component allows an arbitrary decimal.  Thus, the lexical format for duration and datatypes derived from it does not follow the alternative format of § 5.5.3.2.1 of [ISO 8601].

previous sub-section next sub-sectionG.2 Truncated and Reduced Formats

[ISO 8601] supports a variety of "truncated" formats in which some of the characters on the left of specific formats, for example, the century, can be omitted. Truncated formats are, in general, not permitted for the datatypes defined in this specification with three exceptions.  The time datatype uses a truncated format for dateTime which represents an instant of time that recurs every day. Similarly, the gMonthDay and gDay datatypes use left-truncated formats for date. The datatype gMonth uses a right and left truncated format for date.

[ISO 8601] also supports a variety of "reduced" or right-truncated formats in which some of the characters to the right of specific formats, such as the time specification, can be omitted.  Right truncated formats are also, in general, not permitted for the datatypes defined in this specification with the following exceptions: right-truncated representations of dateTime are used as lexical representations for date, gMonth, gYear.

previous sub-section G.3 Deviations from ISO 8601 Formats

        G.3.1 Sign Allowed
        G.3.2 No Year Zero
        G.3.3 More Than 9999 Years
        G.3.4 Time zone permitted

G.3.1 Sign Allowed

An optional minus sign is allowed immediately preceding, without a space, the lexical representations for duration, dateTime, date, gYearMonth, gYear.

G.3.2 No Year Zero

The year "0000" is an illegal year value.

G.3.3 More Than 9999 Years

To accommodate year values greater than 9999, more than four digits are allowed in the year representations of dateTime, date, gYearMonth, and gYear. This follows [ISO 8601:2000 Second Edition].

G.3.4 Time zone permitted

The lexical representations for the datatypes date, gYearMonth, gMonthDay, gDay, gMonth and gYear permit an optional trailing time zone specificiation.

H Adding durations to dateTimes

Editorial Note: It is expected that this Appendix will be replaced by a short function definition building upon those already defined herein, which will be placed with the other function definitions in Function Definitions (§E) and referenced in duration (§3.2.7).

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:

31M = January, March, May, July, August, October, or December
30M = April, June, September, or November
29M = February AND (modulo(Y, 400) = 0 OR (modulo(Y, 100) != 0) AND modulo(Y, 4) = 0)
28Otherwise

next sub-sectionH.1 Algorithm

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).

  • Months (may be modified additionally below)
    • temp := S[month] + D[month]
    • E[month] := modulo(temp, 1, 13)
    • carry := fQuotient(temp, 1, 13)
  • Years (may be modified additionally below)
    • E[year] := S[year] + D[year] + carry
  • Zone
    • E[zone] := S[zone]
  • Seconds
    • temp := S[second] + D[second]
    • E[second] := modulo(temp, 60)
    • carry := fQuotient(temp, 60)
  • Minutes
    • temp := S[minute] + D[minute] + carry
    • E[minute] := modulo(temp, 60)
    • carry := fQuotient(temp, 60)
  • Hours
    • temp := S[hour] + D[hour] + carry
    • E[hour] := modulo(temp, 24)
    • carry := fQuotient(temp, 24)
  • Days
    • if S[day] > maximumDayInMonthFor(E[year], E[month])
      • tempDays := maximumDayInMonthFor(E[year], E[month])
    • else if S[day] < 1
      • tempDays := 1
    • else
      • tempDays := S[day]
    • E[day] := tempDays + D[day] + carry
    • START LOOP
      • IF E[day] < 1
        • E[day] := E[day] + maximumDayInMonthFor(E[year], E[month] - 1)
        • carry := -1
      • ELSE IF E[day] > maximumDayInMonthFor(E[year], E[month])
        • E[day] := E[day] - maximumDayInMonthFor(E[year], E[month])
        • carry := 1
      • ELSE EXIT LOOP
      • temp := E[month] + carry
      • E[month] := modulo(temp, 1, 13)
      • E[year] := E[year] + fQuotient(temp, 1, 13)
      • GOTO START LOOP

Examples:

dateTimedurationresult
2000-01-12T12:13:14ZP1Y3M5DT7H10M3.3S2001-04-17T19:23:17.3Z
2000-01-P3M1999-10
2000-01-12PT33H2000-01-13

previous sub-section H.2 Commutativity and Associativity

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

I Regular Expressions

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.

Note:  Unlike some popular regular expression languages (including those defined by Perl and standard Unix utilities), the regular expression language defined here implicitly anchors all regular expressions at the head and tail, as the most common use of regular expressions in ·pattern· is to match entire literals. For example, a datatype ·derived· from string such that all values must begin with the character 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
[33]   regExp   ::=    branch ( '|' branch )*

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
Sall strings in L(S)
S|Tall strings in L(S) and all strings in L(T)

[Definition:]   A branch consists of zero or more ·piece·s, concatenated together.

Branch
[34]   branch   ::=   piece*

For all ·piece·s S, and for all ·branch·es T, valid ·branch·es R are: Denoting the set of strings L(R) containing:
Sall strings in L(S)
STall strings st with s in L(S) and t in L(T)

[Definition:]   A piece is an ·atom·, possibly followed by a ·quantifier·.

Piece
[35]   piece   ::=   atom quantifier?

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:
Sall 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
Note:  The regular expression language in the Perl Programming Language [Perl] does not include a quantifier of the form 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
[36]   quantifier   ::=   [?*+] | ( '{' quantity '}' )
[37]   quantity   ::=   quantRange | quantMin | QuantExact
[38]   quantRange   ::=   QuantExact ',' QuantExact
[39]   quantMin   ::=   QuantExact ','
[40]   QuantExact   ::=   [0-9]+

[Definition:]   An atom is either a ·normal character·, a ·character class·, or a parenthesized ·regular expression·.

Atom
[41]   atom   ::=   Char | charClass | ( '(' regExp ')' )

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:
cthe single string consisting only of c
Call 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
[42]   Char   ::=   [^.\?*+()|#x5B#x5D]

Note that a ·normal character· can be represented either as itself, or with a character reference.

I.1 Character Classes

[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
[43]   charClass   ::=    charClassEsc | charClassExpr | WildcardEsc

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
[44]   charClassExpr   ::=   '[' charGroup ']'

[Definition:]   A character group is either a ·positive character group·, a ·negative character group·, or a ·character class subtraction·.

Character Group
[45]   charGroup   ::=    posCharGroup | negCharGroup | charClassSub

[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
[46]   posCharGroup   ::=    ( charRange | charClassEsc )+

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:
Rall characters in C(R).
Eall characters in C(E).
RPall characters in C(R) and all characters in C(P).
EPall 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
[47]   negCharGroup   ::=   '^' posCharGroup

[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
[48]   charClassSub   ::=    ( posCharGroup | negCharGroup ) '-' charClassExpr

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
[49]   charRange   ::=    seRange | XmlChar
[50]   seRange   ::=   charOrEsc '-' charOrEsc
[51]   charOrEsc   ::=   XmlChar | SingleCharEsc
[52]   XmlChar   ::=   [^\#x2D#x5B#x5D]

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:

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:

Note:  The code point of a ·single character escape· is the code point of the single character in the set of characters that it identifies.

I.1.1 Character Class Escapes

[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
[53]   charClassEsc   ::=    ( SingleCharEsc | MultiCharEsc | catEsc | complEsc )

[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
[54]   SingleCharEsc   ::=   '\' [nrt\|.?*+(){}#x2D#x5B#x5D#x5E]

The valid ·single character escape·s are: Identifying the set of characters C(R) containing:
\nthe newline character (#xA)
\rthe return character (#xD)
\tthe 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
[55]   catEsc   ::=   '\p{' charProp '}'
[56]   complEsc   ::=   '\P{' charProp '}'
[57]   charProp   ::=   IsCategory | IsBlock
Note:  [Unicode Database] is subject to future revision.  For example, the mapping from code points to character properties might be updated. All ·minimally conforming· processors ·must· support the character properties defined in the version of [Unicode Database] that is current at the time this specification became a W3C Recommendation.  However, implementors are encouraged to support the character properties defined in any future version.

The following table specifies the recognized values of the "General Category" property.

CategoryPropertyMeaning
LettersLAll Letters
Luuppercase
Lllowercase
Lttitlecase
Lmmodifier
Loother
 
MarksMAll Marks
Mnnonspacing
Mcspacing combining
Meenclosing
 
NumbersNAll Numbers
Nddecimal digit
Nlletter
Noother
 
PunctuationPAll Punctuation
Pcconnector
Pddash
Psopen
Peclose
Piinitial quote (may behave like Ps or Pe depending on usage)
Pffinal quote (may behave like Ps or Pe depending on usage)
Poother
 
SeparatorsZAll Separators
Zsspace
Zlline
Zpparagraph
 
SymbolsSAll Symbols
Smmath
Sccurrency
Skmodifier
Soother
 
OtherCAll Others
Cccontrol
Cfformat
Coprivate use
Cnnot assigned
Categories
[58]   IsCategory   ::=    Letters | Marks | Numbers | Punctuation | Separators | Symbols | Others
[59]   Letters   ::=   'L' [ultmo]?
[60]   Marks   ::=   'M' [nce]?
[61]   Numbers   ::=   'N' [dlo]?
[62]   Punctuation   ::=   'P' [cdseifo]?
[63]   Separators   ::=   'Z' [slp]?
[64]   Symbols   ::=   'S' [mcko]?
[65]   Others   ::=   'C' [cfon]?
Note:  The properties mentioned above exclude the 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
[66]   IsBlock   ::=   'Is' [a-zA-Z0-9#x2D]+

The following table specifies the recognized block names (for more information, see the "Blocks.txt" file in [Unicode Database]).

Start CodeEnd CodeBlock Name Start CodeEnd CodeBlock Name
#x0000#x007FBasicLatin #x0080#x00FFLatin-1Supplement
#x0100#x017FLatinExtended-A #x0180#x024FLatinExtended-B
#x0250#x02AFIPAExtensions #x02B0#x02FFSpacingModifierLetters
#x0300#x036FCombiningDiacriticalMarks #x0370#x03FFGreek
#x0400#x04FFCyrillic #x0530#x058FArmenian
#x0590#x05FFHebrew #x0600#x06FFArabic
#x0700#x074FSyriac #x0780#x07BFThaana
#x0900#x097FDevanagari #x0980#x09FFBengali
#x0A00#x0A7FGurmukhi #x0A80#x0AFFGujarati
#x0B00#x0B7FOriya #x0B80#x0BFFTamil
#x0C00#x0C7FTelugu #x0C80#x0CFFKannada
#x0D00#x0D7FMalayalam #x0D80#x0DFFSinhala
#x0E00#x0E7FThai #x0E80#x0EFFLao
#x0F00#x0FFFTibetan #x1000#x109FMyanmar
#x10A0#x10FFGeorgian #x1100#x11FFHangulJamo
#x1200#x137FEthiopic #x13A0#x13FFCherokee
#x1400#x167FUnifiedCanadianAboriginalSyllabics #x1680#x169FOgham
#x16A0#x16FFRunic #x1780#x17FFKhmer
#x1800#x18AFMongolian #x1E00#x1EFFLatinExtendedAdditional
#x1F00#x1FFFGreekExtended #x2000#x206FGeneralPunctuation
#x2070#x209FSuperscriptsandSubscripts #x20A0#x20CFCurrencySymbols
#x20D0#x20FFCombiningMarksforSymbols #x2100#x214FLetterlikeSymbols
#x2150#x218FNumberForms #x2190#x21FFArrows
#x2200#x22FFMathematicalOperators #x2300#x23FFMiscellaneousTechnical
#x2400#x243FControlPictures #x2440#x245FOpticalCharacterRecognition
#x2460#x24FFEnclosedAlphanumerics #x2500#x257FBoxDrawing
#x2580#x259FBlockElements #x25A0#x25FFGeometricShapes
#x2600#x26FFMiscellaneousSymbols #x2700#x27BFDingbats
#x2800#x28FFBraillePatterns #x2E80#x2EFFCJKRadicalsSupplement
#x2F00#x2FDFKangxiRadicals #x2FF0#x2FFFIdeographicDescriptionCharacters
#x3000#x303FCJKSymbolsandPunctuation #x3040#x309FHiragana
#x30A0#x30FFKatakana #x3100#x312FBopomofo
#x3130#x318FHangulCompatibilityJamo #x3190#x319FKanbun
#x31A0#x31BFBopomofoExtended #x3200#x32FFEnclosedCJKLettersandMonths
#x3300#x33FFCJKCompatibility #x3400#x4DB5CJKUnifiedIdeographsExtensionA
#x4E00#x9FFFCJKUnifiedIdeographs #xA000#xA48FYiSyllables
#xA490#xA4CFYiRadicals #xAC00#xD7A3HangulSyllables
 
 #xE000#xF8FFPrivateUse
#xF900#xFAFFCJKCompatibilityIdeographs #xFB00#xFB4FAlphabeticPresentationForms
#xFB50#xFDFFArabicPresentationForms-A #xFE20#xFE2FCombiningHalfMarks
#xFE30#xFE4FCJKCompatibilityForms #xFE50#xFE6FSmallFormVariants
#xFE70#xFEFEArabicPresentationForms-B #xFEFF#xFEFFSpecials
#xFF00#xFFEFHalfwidthandFullwidthForms #xFFF0#xFFFDSpecials
Note:  The blocks mentioned above exclude the 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.
Note:  [Unicode Database] is subject to future revision. For example, the grouping of code points into blocks might be updated. All ·minimally conforming· processors ·must· support the blocks defined in the version of [Unicode Database] that is current at the time this specification became a W3C Recommendation.  However, implementors are encouraged to support the blocks defined in any future version of the Unicode Standard.

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
[67]   MultiCharEsc   ::=   '\' [sSiIcCdDwW]
[68]   WildcardEsc   ::=   '.'

Character sequenceEquivalent ·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]
Note:  The ·regular expression· language defined here does not attempt to provide a general solution to "regular expressions" over UCS character sequences.  In particular, it does not easily provide for matching sequences of base characters and combining marks. The language is targeted at support of "Level 1" features as defined in [Unicode Regular Expression Guidelines].  It is hoped that future versions of this specification will provide support for "Level 2" features.

J Changes since version 1.0

next sub-sectionJ.1 Changes Already Made

        J.1.1 Datatypes, Facets and Related Rewrites
        J.1.2 Numerical Datatypes
        J.1.3 Date/time Datatypes

A number of proposals for final wording satisfying various approved requirements for Schema 1.1 are included in the prose of this document.  Only one has been formally accepted by the WG:  the rewrite of duration (including the new derived datatypes yearMonthDuration and dayTimeDuration), in duration (§3.2.7), yearMonthDuration (§3.3.26) and dayTimeDuration (§3.3.27); even that new approved text has a few improvements proffered.  The new writeups of Datatype System (§2), precisionDecimal (§3.2.6), The Seven-property Model (§D.2.2), and gDay (§3.2.14) are included herein but have not yet received final approval by the WG. In versions of this draft that show add/del markup, the unapproved new material is marked as revision text.  (Approved changes are not marked as revisions.)

J.1.1 Datatypes, Facets and Related Rewrites

The model of an abstract datatype is being made more precise and explicit.  Datatype System (§2) has mostly been rewritten, but there is still discussion within the WG as to the final form; this text has not been "formally blessed" by the WG.  In versions of this specification that show adds and dels, this material shaws as a proposed change. 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)).

J.1.2 Numerical Datatypes

The precisionDecimal datatype has been added.  It differs from decimal in that values corry not ony "numerical value" but also "precision"  Precision is explained in Precision (§D.1.1).  The writeup in precisionDecimal (§3.2.6) has not yet been approved by the WG.  In versions of this specification that show adds and dels, this material shows as a proposed change.

J.1.3 Date/time Datatypes

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.2).  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.  In addition to the normative material, the nonnormative Dates and Times in the Real World (§D.2.1) was added to explain in more detail the model of dates and times behind the seven-property model, so that there will be no confusion about the handling of such things as "leap-seconds".

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" ("raw" property values) so that in any given timezone, the days start at "raw" 00:00:00 and end not quite including "raw" 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.)

previous sub-section J.2 Specific Outstanding Issues

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.

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.
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.
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.
RQ-148 (clarify use of "truncation)
The word will probably be removed.
RQ-120 (consistent use of "derived)
"Derivations" other than "derivations by restriction" will be renamed "constructions".
RQ-24 (systematic facets: assignment of datatype to nodes without components)
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.
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.
RQ-24 (systematic approach to facets)
This decision is not yet written up herein:  The four informational facets, each of which have only one property, will be lumped into one facet having four properties.  This will represent a further technical change to the facet structure, but will not result in any additional or lost information in a schema.
RQ-141 (add abstract anyAtomicType) RQ-24 (systematic facets: status and value space of anySimpleType)
A new "magic" datatype will be introduced as a child of anySimpleType and the parent of all primitive atomic datatypes.
RQ-150 (minimum nbr of digits for decimal)
The minimum will be lowered to 16 digits; a health warning will be added to indicate that optimized implementations of derived datatypes may exceed the limits of the base, but are not required to.
RQ-1 (canonical representation of float, double)
The description of canonical representations for float and double needs to be cleaned up.
RQ-140 (positive and negative zero in float and double)
Two zeros will be provided similar to those in precisionDecimal
RQ-31 (precisionDecimal)
precisionDecimal has been added.  It is possible that precisionDecimal will replace decimal.
RQ-30 (negative fractionDigits for decimal)
The WG feels that having this capability for precisionDecimal will be adequate.
RQ-28 (scientific notation for decimal)
The WG feels that having this capability for precisionDecimal will be adequate.
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" ("raw" property values) so that in any given timezone, the days start at "raw" 00:00:00 and end not quite including "raw" 24:00:00. Days are not 00:00:00Z to 24:00:00Z in timezones other than Z.
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.
RQ-122 (define dateTime value space)
Much of the material defining the various date/time datatypes is found here and is or will be referenced in the sections defining each individual date/time datatype. See e.g. gDay (§3.2.14).
RQ-123 (year 0000 in date/time datatypes)
The following rewrite includes allowing year 0000 (1 BCE) and redefining all the lexical representations with negative years from that specified in Schema 1.0, as warned in a Note in Schema 1.0 2E.  A formal Note calling attention to this change elsewhere in the "normative" part of this specification will be added.

K Glossary (non-normative)

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.

atomic
Atomic datatypes are those having values which are regarded by this specification as being indivisible.
base type
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·.
bounded
A datatype is bounded if its ·value space· has either an ·inclusive upper bound· or an ·exclusive upper bound· and either an ·inclusive lower bound· or an ·exclusive lower bound·.
built-in
Built-in datatypes are those which are defined in this specification, and can be either ·primitive· or ·derived·;
canonical lexical representation
A canonical lexical representation is a set of literals from among the valid set of literals for a datatype such that there is a one-to-one mapping between literals in the canonical lexical representation and values in the ·value space·.
canonical mapping
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·).
canonical representation
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·
cardinality
Every ·value space· has associated with it the concept of cardinality.  Some ·value space·s are finite, some are countably infinite while still others could conceivably be uncountably infinite (although no ·value space· defined by this specification is uncountable infinite). A datatype is said to have the cardinality of its ·value space·.
comparable
otherwise they are comparable.
conformance to the XML Representation of Schemas
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.
constraining facet
constraining facet values may be set or changed during derivation (subject to facet-specific controls) and which control various aspects of the derived datatype
constraining facet
A constraining facet is an optional property that can be applied to a datatype to constrain its ·value space·.
Constraint on Schemas
Constraint on Schemas
constructed
Constructed datatypes are those that are defined in terms of other datatypes.
datatype
In this specification, a datatype is a 3-tuple, consisting of a) a set of distinct values, called its ·value space·, b) a set of lexical representations, called its ·lexical space·, and c) a set of ·facet·s that characterize properties of the ·value space·, individual values or lexical items.
datatype
In this specification, a datatype is a thing with four properties
derived
Derived datatypes are those that are defined in terms of other datatypes.
derived
Derived datatypes are those that are ·constructed· by restiction or extension.
div
If m and n are numbers, then m div n is the greatest integer in  m / n .
error
error
exclusive lower bound
A value l in an ·ordered·  ·value space· L is said to be an exclusive lower bound of a ·value space· V (where V is a subset of L) if for all v in V, l < v.
exclusive upper bound
A value u in an ·ordered·  ·value space· U is said to be an exclusive upper bound of a ·value space· V (where V is a subset of U) if for all v in V, u > v.
facet
A facet is a single defining aspect of a ·value space·.  Generally speaking, each facet characterizes a ·value space· along independent axes or dimensions.
facet
Facets are designated and named values that either provide information about an aspect of the datatype (·information facets·) or control some aspect of the datatype (·constraining facets·).
for compatibility
for compatibility
fundamental facet
A fundamental facet is an abstract property which serves to semantically characterize the values in a ·value space·.
inclusive lower bound
A value l in an ·ordered·  ·value space· L is said to be an inclusive lower bound of a ·value space· V (where V is a subset of L) if for all v in V, l <= v.
inclusive upper bound
A value u in an ·ordered·  ·value space· U is said to be an inclusive upper bound of a ·value space· V (where V is a subset of U) if for all v in V, u >= v.
incomparable
When a <> b, a and b are incomparable,
information facet
information facets provide the application with some information about the datatype
itemType
The ·atomic· or ·union· datatype that participates in the definition of a ·list· datatype is known as the itemType of that ·list· datatype.
JD
the Julian date (JD), which sets its zero day exactly 2,400,000.5 days earlier than MJD.
leap-second
·UTC· day boundaries are kept approximately in sync with UT1 by adding an extra leap-second or so to a day once in a while
lexical mapping
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.
lexical representation
The members of the ·lexical space· are lexical representations of the values to which they are mapped.
lexical space
A lexical space is the set of valid literals for a datatype.
lexical space
The lexical space of a datatype is the prescribed domain of ·the lexical mapping· for that datatype.
list
List datatypes are those having values each of which consists of a finite-length (possibly empty) sequence of values of an ·atomic· datatype.
match
match
may
may
memberTypes
The datatypes that participate in the definition of a ·union· datatype are known as the memberTypes of that ·union· datatype.
minimally conforming
Minimally conforming processors ·must· completely and correctly implement the ·Constraint on Schemas· and ·Validation Rule· .
MJD
the modified Julian date (MJD), which counts days from 17 Nov 1858 (1858-11-17).
mod
If m and n are numbers, then m mod n is  (m / n) – ( m ·div· n) .
must
must
non-numeric
A datatype whose values are not ·numeric· is said to be non-numeric.
numeric
A datatype is said to be numeric if its values are conceptually quantities (in some mathematical number system).
optional
An optional property is permitted but not required to have the special value absent.
order-relation
An order relation on a ·value space· is a mathematical relation that imposes a ·total order· or a ·partial order· on the members of the ·value space·.
ordered
A ·value space·, and hence a datatype, is said to be ordered if there exists an ·order-relation· defined for that ·value space·.
partial order
A partial order is an ·order-relation· that is irreflexive, asymmetric and transitive.
precisionDecimal
The precisionDecimal datatype is similar to decimal, except that each value carries with it a precision as well as a numeric value; it also includes special values for positive and negative infinity and "not a number", and differentiates between "positive zero" and "negative zero".
primitive
Primitive datatypes are those that are not defined in terms of other datatypes; they exist ab initio.
regular expression
A regular expression is composed from zero or more ·branch·es, separated by | characters.
restriction
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·.
Schema Representation Constraint
Schema Representation Constraint
TAI
International Atomic Time (TAI or Temps Atomique International) is time measured in seconds as established by a collection of atomic clocks maintained by various national standards agencies.
total order
A total order is an ·partial order· such that for no a and b is it the case that a <> b.
union
Union datatypes are those whose ·value space·s and ·lexical space·s are the union of the ·value space·s and ·lexical space·s of one or more other datatypes.
user-derived
User-derived datatypes are those ·derived· datatypes that are defined by individual schema designers.
UT1
Universal Time 1 (UT1) is "real" time: One day is (exactly, or at least as close as can be astronomically measured) one revolution of the Earth about its axis with respect to the Sun.  The day is divided into 86400 equal-length seconds, which may vary in length from day to day.
UTC
Universal Coordinated Time (UTC) is an adaptation of TAI which closely approximates UT1 by adding ·leap-seconds· to selected ·UTC· days.
Validation Rule
Validation Rule
value space
A value space is the set of values for a given datatype. Each value in the value space of a datatype is denoted by one or more literals in its ·lexical space·.
value space
The value space of a datatype is the set of values for that datatype.

L References

next sub-sectionL.1 Normative

Clinger, WD (1990)
William D Clinger. How to Read Floating Point Numbers Accurately. In Proceedings of Conference on Programming Language Design and Implementation, pages 92-101. Available at: ftp://ftp.ccs.neu.edu/pub/people/will/howtoread.ps
IEEE 754-1985
IEEE. IEEE Standard for Binary Floating-Point Arithmetic. See http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html
Namespaces in XML
World Wide Web Consortium.  Namespaces in XML. Available at: http://www.w3.org/TR/REC-xml-names/
RFC 2045
N. Freed and N. Borenstein. RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies. 1996.  Available at: http://www.ietf.org/rfc/rfc2045.txt
RFC 2396
Tim Berners-Lee, et. al. RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax.. 1998.  Available at: http://www.ietf.org/rfc/rfc2396.txt
RFC 2732
RFC 2732: Format for Literal IPv6 Addresses in URL's. 1999. Available at: http://www.ietf.org/rfc/rfc2732.txt
RFC 3066
H. Alvestrand, ed. RFC 3066: Tags for the Identification of Languages 1995. Available at: http://www.ietf.org/rfc/rfc3066.txt
Unicode Database
The Unicode Consortium. The Unicode Character Database. Available at: http://www.unicode.org/Public/3.1-Update/UnicodeCharacterDatabase-3.1.0.html
XML
Extensible Markup Language (XML) 1.0, Third Edition, Tim Bray et al., eds., W3C, 4 February 2004. See http://www.w3.org/TR/2004/REC-xml-20040204/
XML Base
World Wide Web Consortium.  XML Base. Available at: http://www.w3.org/TR/2001/REC-xmlbase-20010627/
XML Linking Language
World Wide Web Consortium.  XML Linking Language (XLink). Available at: http://www.w3.org/TR/2001/REC-xlink-20010627/. Note: only the URI reference escaping procedure defined in Section 5.4 is normatively referenced.
XML Schema Part 1: Structures
XML Schema Version 1.1 Part 1: Structures. Available at: http://www.w3.org/TR/2004/WD-xmlschema11-1-20040716/structures.html
XML Schema Requirements

previous sub-section L.2 Non-normative

Character Model
Martin J. Dürst and François Yergeau, eds.  Character Model for the World Wide Web 1.0:  Fundamentals.  2001.  Available at:  http://www.w3.org/TR/2004/WD-charmod-20040225
Gay, DM (1990)
David M. Gay.  Correctly Rounded Binary-Decimal and Decimal-Binary Conversions. AT&T Bell Laboratories Numerical Analysis Manuscript 90-10, November 1990. Available at: http://cm.bell-labs.com/cm/cs/doc/90/4-10.ps.gz
HTML 4.01
World Wide Web Consortium.  Hypertext Markup Language, version 4.01.  Available at: http://www.w3.org/TR/1999/REC-html401-19991224/
IETF INTERNET-DRAFT: IRIs
M. Dürst and M. Suignard . Internationalized Resource Identifiers 2002. Available at: http://www.w3.org/International/iri-edit/draft-duerst-iri-08.txt
International Earth Rotation Service (IERS)
International Earth Rotation Service (IERS). See http://maia.usno.navy.mil
ISO 11404
ISO (International Organization for Standardization). Language-independent Datatypes. See http://www.iso.ch/cate/d19346.html
ISO 8601
ISO (International Organization for Standardization). Representations of dates and times, 1988-06-15.
ISO 8601:1998 Draft Revision
ISO (International Organization for Standardization). Representations of dates and times, draft revision, 1998.
ISO 8601:2000 Second Edition
ISO (International Organization for Standardization). Representations of dates and times, second edition, 2000-12-15.
Perl
The Perl Programming Language.  See http://www.perl.com/pub/language/info/software.html
RDF Schema
World Wide Web Consortium. RDF Schema Specification. Available at: http://www.w3.org/TR/2000/CR-rdf-schema-20000327/
Ruby
World Wide Web Consortium.  Ruby Annotation.  Available at: http://www.w3.org/TR/2001/REC-ruby-20010531
SQL
ISO (International Organization for Standardization).  ISO/IEC 9075-2:1999, Information technology --- Database languages --- SQL --- Part 2: Foundation (SQL/Foundation). [Geneva]: International Organization for Standardization, 1999. See http://www.iso.ch/cate/d26197.html
U.S. Naval Observatory Time Service Department
Information about Leap Seconds Available at: http://tycho.usno.navy.mil/leapsec.990505.html
Unicode Regular Expression Guidelines
Mark Davis.  Unicode Regular Expression Guidelines, 1988. Available at: http://www.unicode.org/unicode/reports/tr18/
XML Schema Language: Part 0 Primer
World Wide Web Consortium.  XML Schema Language: Part 0 Primer.  Available at: http://www.w3.org/TR/2004/PER-xmlschema-0-20040318/
XML Schema Requirements
XML Schema Requirements , Ashok Malhotra and Murray Maloney, eds., W3C, 15 February 1999. See http://www.w3.org/TR/1999/NOTE-xml-schema-req-19990215
XSL
World Wide Web Consortium.  Extensible Stylesheet Language (XSL).  Available at:  http://www.w3.org/TR/2001/REC-xsl-20011015/

M Acknowledgements (non-normative)

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.

The editors acknowledge the members of the XML Schema Working Group, the members of other W3C Working Groups, and industry experts in other forums who have contributed directly or indirectly to the process or content of creating this document and its predecessor.

The current members 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 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. Affiliations given are those current at the time of their first work with the WG.