Movatterモバイル変換


[0]ホーム

URL:


W3C

XML Schema Part 2: Datatypes Second Edition

W3C Recommendation 28 October 2004

This version:
http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/
Latest version:
http://www.w3.org/TR/xmlschema-2/
Previous version:
http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/
Editors:
Paul V. Biron, Kaiser Permanente, for Health Level Seven<Paul.V.Biron@kp.org>
Ashok Malhotra, Microsoft (formerly of IBM)<ashokma@microsoft.com>

Please refer to theerrata for this document, which may include some normative corrections.

This document is also available in these non-normative formats: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, and Independent copy of the DTD for schema documents.See alsotranslations.

Copyright © 2004 W3C® (MIT,ERCIM,Keio), All Rights Reserved. W3Cliability,trademark anddocument use rules apply.


Abstract

XML Schema: Datatypes is part 2 of the specification of the XMLSchema language. It defines facilities for defining datatypes to be usedin XML Schemas as well as other XML specifications.The datatype language, which is itself represented inXML 1.0, provides a superset of the capabilities found in XML 1.0document type definitions (DTDs) for specifying datatypes on elementsand attributes.

Status of this Document

This section describes the status of this document at thetime of its publication. Other documents may supersede this document.A list of current W3C publications and the latestrevision of this technical report can be found in theW3C technical reports index athttp://www.w3.org/TR/.

This is aW3CRecommendation, which forms part of the Second Edition of XMLSchema. This document has been reviewed by W3C Members andother interested parties and has been endorsed by the Director as aW3C Recommendation. It is a stable document and may be used asreference material or cited as a normative reference from another document. W3C's role in making the Recommendation is to draw attentionto the specification and to promote its widespread deployment. Thisenhances the functionality and interoperability of the Web.

This document has been produced by theW3C XML Schema Working Groupas part of the W3CXMLActivity. The goals of the XML Schema language are discussed intheXML SchemaRequirements document. The authors of this document are themembers of the XML Schema Working Group. Different parts of thisspecification have different editors.

This document was produced under the24January 2002 Current Patent Practice (CPP) as amended by theW3C Patent PolicyTransition Procedure. The Working Group maintains apubliclist of patent disclosures relevant to this document;that page also includes instructions for disclosing a patent. An individual whohas actual knowledge of a patent which the individual believescontains Essential Claim(s) with respect to this specification shoulddisclose the information in accordance withsection 6 of the W3C Patent Policy.

The English version of this specification is the only normativeversion. Information about translations of this document is availableathttp://www.w3.org/2001/05/xmlschema-translations.

This second edition isnot a new version,it merely incorporates the changes dictated by the corrections toerrors found in thefirstedition as agreed by the XML Schema Working Group, as aconvenience to readers. A separate list of all such corrections isavailable athttp://www.w3.org/2001/05/xmlschema-errata.

The errata list for this second edition is available athttp://www.w3.org/2004/03/xmlschema-errata.

Please report errors in this document towww-xml-schema-comments@w3.org (archive).

Note: Ashok Malhotra's affiliation has changed since the completion ofeditorial work on this second edition. He is now at Oracle, and can becontacted at<ashok.malhotra@oracle.com>.

Table of Contents

1Introduction
    1.1Purpose
    1.2Requirements
    1.3Scope
    1.4Terminology
    1.5Constraints and Contributions
2Type System
    2.1Datatype
    2.2Value space
    2.3Lexical space
    2.4Facets
    2.5Datatype dichotomies
3Built-in datatypes
    3.1Namespace considerations
    3.2Primitive datatypes
    3.3Derived datatypes
4Datatype components
    4.1Simple Type Definition
    4.2Fundamental Facets
    4.3Constraining Facets
5Conformance

Appendices

ASchema for Datatype Definitions (normative)
BDTD for Datatype Definitions (non-normative)
CDatatypes and Facets
    C.1Fundamental Facets
DISO 8601 Date and Time Formats
    D.1ISO 8601 Conventions
    D.2Truncated and Reduced Formats
    D.3Deviations from ISO 8601 Formats
EAdding durations to dateTimes
    E.1Algorithm
    E.2Commutativity and Associativity
FRegular Expressions
    F.1Character Classes
GGlossary (non-normative)
HReferences
    H.1Normative
    H.2Non-normative
IAcknowledgements (non-normative)


1 Introduction

next sub-section1.1 Purpose

The[XML 1.0 (Second Edition)] specification defines limitedfacilities for applying datatypes to document content in that documentsmay contain or refer to DTDs that assign types to elements and attributes.However, document authors, including authors of traditionaldocuments and those transportingdata in XML,often require a higher degree of type checking to ensure robustness indocument understanding and data interchange.

The table below offers two typical examples of XML instancesin which datatypes are implicit: the instance on the leftrepresents a billing invoice, the instance on theright 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 postalabbreviation 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 manyof the same types of information: a date, telephone number, email addressand an "importance" value (from an enumeratedlist, such as "low", "medium" or "high"). Applications which processinvoices and memos need to raise exceptions if something that wassupposed to be a date or telephone number does not conform to the rulesfor valid dates or telephone numbers.

In both cases, validity constraints exist on the content of theinstances that are not expressible in XML DTDs. The limited datatypingfacilities in XML have prevented validating XML processors from supplyingthe rigorous type checking required in these situations. The resulthas been that individual applications writers have had to implement typechecking in an ad hoc manner. This specification addressesthe need of both document authors and applications writers for a robust,extensible datatype system for XML which could be incorporated intoXML processors. As discussed below, these datatypes could be used in otherXML-related standards as well.

previous sub-sectionnext sub-section1.2 Requirements

The[XML Schema Requirements] document spells outconcrete 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/exportfrom database systems (e.g., relational, object, OLAP);
  3. distinguish requirements relating to lexical data representationvs. those governing an underlying information set;
  4. allow creation of user-defined datatypes, such asdatatypes that are derived from existing datatypes and whichmay constrain certain of its properties (e.g., range,precision, length, format).

previous sub-sectionnext sub-section1.3 Scope

This portion of the XML Schema Language discusses datatypes that can beused in an XML Schema. These datatypes can be specified for elementcontent that would be specified as#PCDATA and attributevalues ofvarioustypes in a DTD. It is the intention of this specificationthat it be usable outside of the context of XML Schemas for a wide rangeof other XML-related activities such as[XSL] and[RDF Schema].

previous sub-sectionnext sub-section1.4 Terminology

The terminology used to describe XML Schema Datatypes is defined in thebody of this specification. The terms defined in the following list areused in building those definitions and in describing the actions of adatatype processor:

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

previous sub-section1.5 Constraints and Contributions

This specification provides three different kinds of normativestatements about schema components, their representations in XML andtheir contribution to the schema-validation of information items:

[Definition:]  Constraint on Schemas
Constraints on the schema components themselves, i.e. conditionscomponents·must· satisfy to be components at all.Largely to be found inDatatype components (§4).
[Definition:]  Schema Representation Constraint
Constraints on the representation of schema components in XML. Some butnot all of these are expressed inSchema for Datatype Definitions (normative) (§A) andDTD for Datatype Definitions (non-normative) (§B).
[Definition:]  Validation Rule
Constraints expressed by schema components which informationitems·must· satisfy to be schema-valid. Largelyto be found inDatatype components (§4).

2 Type System

This section describes the conceptual framework behind the type systemdefined in this specification. The framework has been influenced by the[ISO 11404] standard on language-independent datatypes aswell as the datatypes for[SQL] and for programminglanguages such as Java.

The datatypes discussed in this specification are computerrepresentations of well known abstract concepts such asinteger anddate. It is not the place of thisspecification to define these abstract concepts; many other publicationsprovide excellent definitions.

next sub-section2.1 Datatype

[Definition:]  In this specification,adatatype is a 3-tuple, consisting ofa) 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·sthat characterize properties of the·value space·,individual values or lexical items.

previous sub-sectionnext sub-section2.2 Value space

[Definition:]  Avaluespace is the set of values for a given datatype.Each value in thevalue space of a datatype is denoted byone or more literals in its·lexical space·.

The·value space· of a given datatype canbe defined in one of the following ways:

  • defined axiomatically from fundamental notions (intensional definition)[see·primitive·]
  • enumerated outright (extensional definition)[see·enumeration·]
  • defined by restricting the·value space· ofan already defined datatype to a particular subset with a given setof 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·]

·value space·s have certain properties. For example,they always have the property of·cardinality·,some definition ofequalityand might be·ordered·, by which individualvalues within the·value space· can be compared toone another. The properties of·value space·s thatare recognized by this specification are defined inFundamental facets (§2.4.1).

previous sub-sectionnext sub-section2.3 Lexical space

In addition to its·value space·, each datatype alsohas a lexical space.

[Definition:]  Alexical space is the set of validliteralsfor a datatype.

For example, "100" and "1.0E2" are two different literals from the·lexical space· offloat which bothdenote the same value. The type system defined in this specificationprovides a mechanism for schema designers to control the set of valuesand the corresponding set of acceptable literals of those values fora datatype.

Note: The literals in the·lexical space·s defined in this specificationhave the following characteristics:
Interoperability:
The number of literals for each value has been kept small; for manydatatypes there is a one-to-one mapping between literals and values.This makes it easy to exchange the values between different systems.In many cases, conversion from locale-dependent representations willbe required on both the originator and the recipient side, both forcomputer processing and for interaction with humans.
Basic readability:
Textual, rather than binary, literals are used.This makes hand editing, debugging, and similar activities possible.
Ease of parsing and serializing:
Where possible, literals correspond to those found in commonprogramming languages and libraries.

2.3.1 Canonical Lexical Representation

While the datatypes defined in this specification have, for the most part,a single lexical representation i.e. each value in the datatype's·value space· is denoted by a single literal in its·lexical space·, this is not always the case. Theexample in the previous section showed two literals for the datatypefloat which denote the same value. Similarly, there·may· beseveral literals for one of the date or time datatypes that denote thesame value using different timezone indicators.

[Definition:]  Acanonical lexical representationis a set of literals from among the valid set of literalsfor a datatype such that there is a one-to-one mapping between literalsin thecanonical lexical representation andvalues in the·value space·.

previous sub-sectionnext sub-section2.4 Facets

        2.4.1Fundamental facets
        2.4.2Constraining or Non-fundamental facets

[Definition:]  Afacet is a singledefining aspect of a·value space·. Generallyspeaking, each facet characterizes a·value space·along independent axes or dimensions.

The facets of a datatype serve to distinguish those aspects ofone datatype whichdiffer from other datatypes.Rather than being defined solely in terms of a prose descriptionthe datatypes in this specification are defined in terms ofthesynthesis of facet values which together determine the·value space· and properties of the datatype.

Facets are of two types:fundamental facets that definethe datatype andnon-fundamental orconstraining facets that constrain the permitted values of a datatype.

2.4.1 Fundamental facets

[Definition:]  Afundamental facet is an abstract property whichserves to semantically characterize the values in a·value space·.

Allfundamental facets are fully described inFundamental Facets (§4.2).

2.4.2 Constraining or Non-fundamental facets

[Definition:]  Aconstraining facet is an optional property that can beapplied to a datatype to constrain its·value space·.

Constraining the·value space· consequently constrainsthe·lexical space·. Adding·constraining facet·s to a·base type·is described inDerivation by restriction (§4.1.2.1).

Allconstraining facets are fully described inConstraining Facets (§4.3).

previous sub-section2.5 Datatype dichotomies

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

It is useful to categorize the datatypes defined in this specificationalong 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·esNmtoken from[XML 1.0 (Second Edition)] could be the value of an·atomic·datatype (NMTOKEN); while a sequence of such tokenscould be the value of a·list· datatype(NMTOKENS).

2.5.1.1 Atomic datatypes

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

2.5.1.2 List datatypes

Several type systems (such as the one described in[ISO 11404]) treat·list· datatypes asspecial cases of the more general notions of aggregate or collectiondatatypes.

·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 internalstructure is a space-separatedsequence 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· datatypeis known as theitemType 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 asstringoranyURI)or a·union· datatype any of whose{member type definitions}'s·lexical space· allows space.In such a case, regardless of the input, list itemswill be separated at space boundaries.

Example
<simpleType name='listOfString'>  <list itemType='string'/></simpleType>
<someElement xsi:type='listOfString'>this is not list item 1this is not list item 2this is not list item 3</someElement>
In the above example, the value of thesomeElement elementis 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·, theunit of length ismeasured in number of list items. The value of·whiteSpace·is fixed to the valuecollapse.

For·list· datatypes the·lexical space·is composed of space-separatedliterals of its·itemType·. Hence, any·pattern· specified when a new datatype is·derived· from a·list· datatype is matched againsteach literal of the·list· datatype andnot 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>

Thecanonical-lexical-representation for the·list· datatype is defined as the lexical form in whicheach item in the·list· has the canonical lexicalrepresentation of its·itemType·.

2.5.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 ofits·memberTypes·.·union· datatypes are always·derived·.Currently, there are no·built-in· ·union·datatypes.

Example
A prototypical example of a·union· type is themaxOccurs attribute on theelement elementin XML Schema itself: it is a union of nonNegativeIntegerand 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 thedefinition of a·union· datatype are known as thememberTypes of that·union· datatype.

The order in which the·memberTypes· are specified in thedefinition (that is, the order of the <simpleType> children of the <union>element, or the order of theQNames in thememberTypesattribute) is significant.During validation, an element or attribute's value is validated against the·memberTypes· in the order in which they appear in thedefinition until a match is found. The evaluation order can be overriddenwith the use ofxsi:type.

Example
For example, given the definition below, the first instance of the <size> elementvalidates correctly as aninteger (§3.3.13), the second and third asstring (§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>

Thecanonical-lexical-representation for a·union· datatype is defined as the lexical form in whichthe values have the canonical lexical representationof the appropriate·memberTypes·.

Note: A datatype which is·atomic· in this specificationneed not be an "atomic" datatype in any programming language used toimplement 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 thisspecification need not be a "union" datatype in any programminglanguage used to implement this specification.

2.5.2 Primitive vs. derived datatypes

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

  • [Definition:]  Primitivedatatypes are those that are not defined in terms of other datatypes;they existab initio.
  • [Definition:]  Deriveddatatypes are those that are defined in terms of other datatypes.

For example, in this specification,float is a well-definedmathematicalconcept that cannot be defined in terms of other datatypes, whileainteger is a special case of the more general datatypedecimal.

[Definition:]  The simple ur-type definition is a special restriction of theur-type definitionwhose name isanySimpleType in the XML Schema namespace.anySimpleType can beconsidered 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 boththe·primitive· and·derived·categories. It is felt that a judiciously chosen set of·primitive· datatypes will serve the widestpossible audience by providing a set of convenient datatypes thatcan be used as is, as well as providing a rich enough base fromwhich the variety of datatypes needed by schema designers can be·derived·.

In the example above,integer is·derived·fromdecimal.

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

As described in more detail inXML 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 torestrict the·value space· of the·user-derived·datatype to a subset of that of the·base type·; 2) by creatinga·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.5.2.1 Derived by restriction

[Definition:]  A datatype is said to be·derived· byrestriction from another datatypewhen values for zero or more·constraining facet·s are specifiedthat serve to constrain its·value space· and/or its·lexical space· to a subset of those of its·base type·.

[Definition:]  Everydatatype that is·derived· byrestrictionis defined in terms of an existing datatype, referred to as itsbase type.base types can be either·primitive· or·derived·.

2.5.2.2 Derived by list

A·list· datatype can be·derived·from another datatype (its·itemType·) by creatinga·value space· that consists of a finite-length sequenceof values of its·itemType·.

2.5.2.3 Derived by union

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

2.5.3 Built-in vs. user-derived datatypes

Conceptually there is no difference between the·built-in· ·derived· datatypesincluded in this specification and the·user-derived·datatypes which will be created by individual schema designers.The·built-in· ·derived· datatypesare those which are believed to be so common that if they were notdefined in this specification many schema designers would end up"reinventing" them. Furthermore, including these·derived· datatypes in this specification serves todemonstrate the mechanics and utility of the datatype generationfacilities of this specification.

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

3 Built-in datatypes

Diagram of built-in type hierarchy

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 theint 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, followedby 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 specificationare designed to be used with the XML Schema definition language as well as otherXML 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 theXML 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 aunique namespace. However,·user-derived· datatypesdo not come from the namespace defined by this specification; rather,they come from the namespace of the schema in which they are defined(seeXML Representation ofSchemas in[XML Schema Part 1: Structures]).

previous sub-sectionnext sub-section3.2 Primitive datatypes

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

The·primitive· datatypes defined by this specificationare described below. For each datatype, the·value space· and·lexical space·are defined,·constraining facet·s which applyto the datatype are listed and any datatypes·derived·from this datatype are specified.

·primitive· datatypes can only be added by revisionsto this specification.

3.2.1 string

[Definition:]  Thestring datatyperepresents character strings in XML. The·value space·ofstring is the set of finite-length sequences ofcharacters (as defined in[XML 1.0 (Second Edition)]) that·match· theChar production from[XML 1.0 (Second Edition)].Acharacter is an atomic unit ofcommunication; it is not further specified except to note that everycharacter has a correspondingUniversal Character Set code point, which is an integer.

Note: Many human languages have writing systems that requirechild elements for control of aspects such as bidirectional formating orruby annotation (see[Ruby] and Section 8.2.4Overriding thebidirectional algorithm: the BDO element of[HTML 4.01]).Thus,string, as a simple type that can contain onlycharacters 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.5Any Element, Any Attributeof[XML Schema Language: Part 0 Primer].
Note: As noted inordered, the fact that this specification doesnot 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 thefollowing·constraining facets·:

3.2.1.2 Derived datatypes

The following·built-in·datatypes are·derived· fromstring:

3.2.2 boolean

[Definition:]  boolean has the·value space· required to support the mathematicalconcept 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 forboolean is the set ofliterals {true, false}.

3.2.2.3 Constraining facets

boolean has thefollowing·constraining facets·:

3.2.3 decimal

[Definition:]  decimalrepresents a subset of the real numbers, which can be represented by decimal numerals.The·value space· ofdecimalis the set of numbers that can be obtained by multiplying an integer by a non-positivepower of ten, i.e., expressible asi × 10^-nwherei andn are integersandn >= 0.Precision is not reflected in this value space;the number 2.0 is not distinct from the number 2.00.The·order-relation· ondecimalis the order relation on real numbers, restrictedto 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 digitsthey are prepared to support, in which case that application-definedmaximum number·must· be clearly documented.
3.2.3.1 Lexical representation

decimal has a lexical representationconsisting of a finite-length sequence of decimal digits (#x30-#x39) separatedby 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) canbe omitted.For example:-1.23, 12678967.543233, +100000.00, 210.

3.2.3.2 Canonical representation

The canonical representation fordecimal is defined byprohibiting certain options from theLexical representation (§3.2.3.1). Specifically, the precedingoptional "+" sign is prohibited. The decimal point is required. Leading andtrailing zeroes are prohibited subject to the following: there must be at leastone digit to the right and to the left of the decimal point which may be a zero.

3.2.3.3 Constraining facets

decimal has thefollowing·constraining facets·:

3.2.3.4 Derived datatypes

The following·built-in·datatypes are·derived· fromdecimal:

3.2.4 float

[Definition:]  floatis patterned after the IEEE single-precision 32-bit floating point type[IEEE 754-1985]. The basic·value space· offloat consists of the valuesm × 2^e, wheremis an integer whose absolute value is less than2^24, ande is an integerbetween -149 and 104, inclusive. In addition to the basic·value space· described above, the·value space· offloat also contains thefollowingthreespecial values:positive and negative infinity and not-a-number(NaN).The·order-relation· onfloatis:x < y iff y - x is positivefor 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 thatare 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 differentdefinitions of equality for computational purposes;[IEEE 754-1985]-based computation systemsare examples. Nothing in this Recommendation should be construed as requiring thatsuch 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 beexcluded from the resulting restricted·value space·. In particular,when "NaN" is used as a facet value for a bounding facet, since no otherfloat 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 oneNaN and only one zero. This makes the equality and ordering of values in the dataspace differ from that of[IEEE 754-1985] only in that for schema purposes NaN = NaN.

A literal in the·lexical space· representing adecimal numberd maps to the normalized valuein the·value space· offloat that isclosest tod in the sense defined by[Clinger, WD (1990)]; ifd isexactly halfway between two such values then the even value is chosen.

3.2.4.1 Lexical representation

float values have a lexical representationconsisting of a mantissa followed, optionally, by the character"E" or "e", followed by an exponent. The exponent·must·be aninteger. The mantissa must be adecimal number. The representationsfor exponent and mantissa must follow the lexical rules forinteger anddecimal. If the "E" or "e" andthe following exponent are omitted, an exponent value of 0 is assumed.

Thespecial valuespositiveand negative infinity and not-a-number have lexical representationsINF,-INF andNaN, respectively.Lexical representations for zero may take a positive or negative sign.

For example,-1E4, 1267.43233E12, 12.78e-2, 12, -0, 0andINF are all legal literals forfloat.

3.2.4.2 Canonical representation

The canonical representation forfloat is defined byprohibiting certain options from theLexical representation (§3.2.4.1). Specifically, the exponentmust be indicated by "E". Leading zeroes and the preceding optional "+" signare prohibited in the exponent.If the exponent is zero, it must be indicated by "E0".For the mantissa, the preceding optional "+" sign is prohibitedand the decimal point is required.Leading and trailing zeroes are prohibited subject to the following:number representations mustbe normalized such that there is a single digitwhich is non-zeroto the left of the decimal point and at least a single digit to theright of the decimal pointunless the value being represented is zero. The canonicalrepresentation for zero is 0.0E0.

3.2.4.3 Constraining facets

float has thefollowing·constraining facets·:

3.2.5 double

[Definition:]  Thedoubledatatypeis patterned after theIEEE double-precision 64-bit floating pointtype[IEEE 754-1985]. The basic·value space·ofdouble consists of the valuesm × 2^e, wheremis an integer whose absolute value is less than2^53, ande is aninteger between -1075 and 970, inclusive. In addition to the basic·value space· described above, the·value space· ofdouble also containsthe followingthreespecial values:positive and negative infinity and not-a-number(NaN).The·order-relation· ondoubleis:x < y iff y - x is positivefor 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 thatare 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 differentdefinitions of equality for computational purposes;[IEEE 754-1985]-based computation systemsare examples. Nothing in this Recommendation should be construed as requiring thatsuch 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 beexcluded from the resulting restricted·value space·. In particular,when "NaN" is used as a facet value for a bounding facet, since no otherdouble 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 oneNaN and only one zero. This makes the equality and ordering of values in the dataspace differ from that of[IEEE 754-1985] only in that for schema purposes NaN = NaN.

A literal in the·lexical space· representing adecimal numberd maps to the normalized valuein the·value space· ofdouble that isclosest tod; ifd isexactly halfway between two such values then the even value is chosen.This is thebest approximation ofd([Clinger, WD (1990)],[Gay, DM (1990)]), which is moreaccurate than the mapping required by[IEEE 754-1985].

3.2.5.1 Lexical representation

double values have a lexical representationconsisting of a mantissa followed, optionally, by the character "E" or"e", followed by an exponent. The exponent·must· bean integer. The mantissa must be a decimal number. The representationsfor exponent and mantissa must follow the lexical rules forinteger anddecimal. If the "E" or "e"and the following exponent are omitted, an exponent value of 0 is assumed.

Thespecial valuespositiveand negative infinity and not-a-number have lexical representationsINF,-INF andNaN, respectively.Lexical representations for zero may take a positive or negative sign.

For example,-1E4, 1267.43233E12, 12.78e-2, 12, -0, 0andINFare all legal literals fordouble.

3.2.5.2 Canonical representation

The canonical representation fordouble is defined byprohibiting certain options from theLexical representation (§3.2.5.1). Specifically, the exponentmust be indicated by "E". Leading zeroes and the preceding optional "+" signare prohibited in the exponent.If the exponent is zero, it must be indicated by "E0".For the mantissa, the preceding optional "+" sign is prohibitedand the decimal point is required.Leading and trailing zeroes are prohibited subject to the following:number representations mustbe normalized such that there is a single digitwhich is non-zeroto the left of the decimal point and at least a single digit to theright of the decimal pointunless the value being represented is zero. The canonicalrepresentation for zero is 0.0E0.

3.2.5.3 Constraining facets

double has thefollowing·constraining facets·:

3.2.6 duration

[Definition:]  duration represents a duration of time.The·value space· ofduration isa six-dimensional space where the coordinatesdesignate the Gregorian year, month, day, hour, minute, and second components defined in§ 5.5.3.2 of[ISO 8601],respectively. These components are orderedin their significance by their order of appearance i.e. as year, month, day,hour, minute, and second.

Note:

All
·minimally conforming· processors·must·support year values with a minimum of 4 digits (i.e.,YYYY) and a minimum fractional second precision of milliseconds or three decimal digits (i.e.s.sss). However,·minimally conforming· processors·may·set an application-defined limit on the maximum number of digitsthey are prepared to support in these two cases, in which case that application-definedmaximum number·must· be clearly documented.
3.2.6.1 Lexical representation

The lexical representation forduration is the[ISO 8601] extended format PnYnMnDTnHnMnS, wherenY represents the number of years,nM thenumber of months,nD the number of days, 'T' is thedate/time separator,nH the number of hours,nM the number of minutes andnS thenumber of seconds. The number of seconds can include decimal digitsto arbitrary precision.

The values of theYear, Month, Day, Hour and Minutes components are not restricted butallow an arbitraryunsigned integer, i.e., an integer thatconforms to the pattern[0-9]+..Similarly, the value of the Seconds componentallows an arbitrary unsigned decimal.Following[ISO 8601], at least one digit mustfollow the decimal point if it appears. That is, the value of the Seconds componentmust conform to the pattern[0-9]+(\.[0-9]+)?.Thus, the lexical representation ofduration does not follow the alternativeformat of § 5.5.3.2.1 of[ISO 8601].

An optional preceding minus sign ('-') isallowed, to indicate a negative duration. If the sign is omitted apositive duration is indicated. See alsoISO 8601 Date and Time Formats (§D).

For example, to indicate a duration of 1 year, 2 months, 3 days, 10hours, and 30 minutes, one would write:P1Y2M3DT10H30M.One could also indicate a duration of minus 120 days as:-P120D.

Reduced precision and truncated representations of this format are allowedprovided they conform to the following:

  • If the number of years, months, days, hours, minutes, or seconds in anyexpression equals zero, the number and its corresponding designator·may·be omitted. However, at least one number and its designator·must·be present.
  • The seconds part·may· have a decimal fraction.
  • The designator 'T' mustbe absent if and only if all of the time items are absent.The designator 'P' must always be present.

For example, P1347Y, P1347M and P1Y2MT2H are all allowed;P0Y1347M and P0Y1347M0D are allowed. P-1347M is not allowed although-P1347M is allowed. P1Y2MT is not allowed.

3.2.6.2 Order relation on duration

In general, the·order-relation· ondurationis a partial order since there is no determinate relationship between certaindurations such as one month (P1M) and 30 days (P30D).The·order-relation·of twoduration valuesx andy isx < y iff s+x < s+yfor each qualifieddateTime sin the list below. These values fors cause the greatest deviations in the addition ofdateTimes and durations. Addition of durations to time instants is definedinAdding durations to dateTimes (§E).

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

The following table shows the strongest relationship that can be determinedbetween example durations. The symbol <> means that the order relation isindeterminate. Note that because of leap-seconds, a seconds field can varyfrom 59 to 60. However, because of the way that addition is defined inAdding durations to dateTimes (§E), they are still totally ordered.

 Relation
P1Y> P364D<> P365D <> P366D< P367D
P1M> P27D<> P28D<> P29D<> P30D<> P31D< P32D
P5M> P149D<> P150D<> P151D<> P152D<> P153D< P154D

Implementations are free to optimize the computation of the ordering relationship. For example, the following table can be used tocompare durations of a small number of months against days.

 Months12345678910111213...
DaysMinimum285989120150181212242273303334365393...
Maximum316292123153184215245276306337366397...
3.2.6.3 Facet Comparison for durations

In comparingdurationvalues withminInclusive,minExclusive,maxInclusive andmaxExclusive facet valuesindeterminate comparisons should be considered as "false".

3.2.6.4 Totally ordered durations

Certain derived datatypes of durations can be guaranteed have a total order. Forthis, they must have fields from only one row in the list below and the time zonemust either be required or prohibited.

For example, a datatype could be defined to correspond to the[SQL] datatype Year-Month interval that required a four digityear field and a two digit month field but required all other fields to be unspecified. This datatype could be defined as below and would have a total order.

<simpleType name='SQL-Year-Month-Interval'>    <restriction base='duration'>      <pattern value='P\p{Nd}{4}Y\p{Nd}{2}M'/>    </restriction></simpleType>
3.2.6.5 Constraining facets

duration has thefollowing·constraining facets·:

3.2.7 dateTime

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

The·value space· ofdateTime is closely related to the dates and times described in ISO 8601.For clarity, the text above specifies a particular origin point for thetimeline.It should be noted, however, that schema processors need not expose thetimeOnTimeline value to schema users, and there is no requirement that atimeline-based implementation use the particular origin described here inits internal representation.Other interpretations of the·value space· which lead to thesame 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 representationsare converted to UTC during conversion of literals to values."Local" or untimezoned times are presumed to be the time in the timezone of someunspecified locality as prescribed by the appropriate legal authority;currently there are no legally prescribed timezones which are durationswhose magnitude is greater than 14 hours. The value of each numeric-valued property(other than timeOnTimeline) is limited to the maximum value within the intervaldetermined 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 inspiredby
[ISO 8601]. '0001' is the lexical representation of the year 1 of the Common Era(1CE, 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 BeforeCommon Era (1 BCE, sometimes written "1 BC").

Those using this (1.0) version of this Recommendation torepresent negative years should be aware that the interpretation of lexicalrepresentations beginning with a'-' is likely to change insubsequent 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 version1.0, allows the form '0000', representing the year 1 BCE. A number of external commentatorshave also suggested that '0000' beallowed, as the lexical representation for 1 BCE, which is the normal usage inastronomical contexts. It is the intention of the XML Schema Working Group to allow '0000' as a lexical representation in thedateTime,date,gYear, andgYearMonth datatypes in a subsequent version of this Recommendation. '0000' will be the lexical representation of 1BCE (which is a leap year), '-0001' will become the lexical representation of 2BCE (not 1 BCE as in this (1.0) version), '-0002' of 3 BCE, etc.

Note: See the conformance note in (§3.2.6) whichapplies to this datatype as well.
3.2.7.1 Lexical representation

The·lexical space· ofdateTime consists offinite-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-signednumeral that represents the year; if more than four digits, leading zerosare prohibited, and '0000' is prohibited (see the Note above (§3.2.7); also note that a plus sign isnot permitted);
  • the remaining '-'s are separators between parts of the date portion;
  • the firstmm 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 theminutes and seconds represented are zero, and thedateTime value sorepresented is the first instant of the following day (the hour property of adateTime object in the·value space· cannot havea value greater than 23);
  • ':' is a separator between parts of the time-of-day portion;
  • the secondmm is a two-digit numeral that represents the minute;
  • ss is a two-integer-digit numeral that represents thewhole seconds;
  • '.'s+ (if present) represents thefractional 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 DaylightSavings 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 withdateTimes and durations,seeAdding durations to dateTimes (§E).

3.2.7.2 Canonical representation

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

3.2.7.3 Timezones

Timezones are durations with (integer-valued) hour and minute properties(with the hour magnitude limited to at most 14, and the minute magnitudelimited to at most 59, except that if the hour magnitude is 14, the minutevalue 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

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

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

3.2.7.4 Order relation on dateTime

dateTime value objects on either timeline are totally ordered by their timeOnTimelinevalues; between the two timelines,dateTime value objects are ordered by theirtimeOnTimeline values when their timeOnTimeline values differ by more thanfourteen hours, with those whose difference is a duration of 14 hours or lessbeing·incomparable·.

In general, the·order-relation· ondateTimeis a partial order since there is no determinate relationship between certaininstants. For example, there is no determinateordering between(a)2000-01-20T12:00:00 and (b) 2000-01-20T12:00:00Z. Based ontimezones currently in use, (c) could vary from 2000-01-20T12:00:00+12:00 to2000-01-20T12:00:00-13:00. It is, however, possible for this range to expand orcontract in the future, based on local laws. Because of this, the followingdefinition uses a somewhat broader range of indeterminate values: +14:00..-14:00.

The following definition uses the notation S[year] to represent the yearfield 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 notalready have a timezone.This is a logical explanation of the process. Actualimplementations are free to optimize as long as they produce the same results.

The ordering between twodateTimes P and Q is defined by the followingalgorithm:

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 inAdding durations to dateTimes (§E)

  • 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.7.5 Totally ordered dateTimes

Certain derived types fromdateTimecan be guaranteed have a total order. Todo so, they must require that a specific set of fields are always specified, andthat remaining fields (if any) are always unspecified. For example, the datedatatype 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.7.6 Constraining facets

dateTime has thefollowing·constraining facets·:

3.2.8 time

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

Since the lexical representation allows an optional time zoneindicator,time values are partially ordered because it maynot be able to determine the order of two values one of which has atime zone and the other does not. The order relation ontime values is theOrder relation on dateTime (§3.2.7.4) using an arbitrary date. See alsoAdding durations to dateTimes (§E). Pairs oftime values with or without time zone indicators are totally ordered.

Note: See the conformance note in (§3.2.6) whichapplies to the seconds part of this datatype as well.
3.2.8.1 Lexical representation

The lexical representation fortime is the lefttruncated lexical representation fordateTime: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 behindCoordinated Universal Time (UTC), one would write: 13:20:00-05:00. See alsoISO 8601 Date and Time Formats (§D).

3.2.8.2 Canonical representation

The canonical representation fortime is definedby prohibiting certain options from theLexical representation (§3.2.8.1). Specifically, either the time zone mustbe omitted or, if present, the time zone must be Coordinated UniversalTime (UTC) indicated by a "Z".Additionally, the canonical representation for midnight is 00:00:00.

3.2.8.3 Constraining facets

time has thefollowing·constraining facets·:

3.2.9 date

[Definition:]  The·value space· ofdateconsists of top-open intervals of exactly one day in length on the timelines ofdateTime, beginning on the beginning moment of each day (ineach timezone), i.e. '00:00:00', up to but not including '24:00:00' (which isidentical with '00:00:00' of the next day). For nontimezoned values, the top-openintervals disjointly cover the nontimezoned timeline, one per day. For timezonedvalues, the intervals begin at every minute and therefore overlap.

A "date object" is an object with year, month, and day properties just like thoseofdateTime objects, plus an optionaltimezone-valuedtimezone property. (As with values ofdateTime timezones are aspecial case of durations.)Just as adateTime object corresponds to a point on one of thetimelines, adate object corresponds to an interval on oneof the two timelines as just described.

Timezoneddate values track the starting moment of their day, asdetermined by their timezone; said timezone is generally recoverable forcanonical representations.[Definition:]  Therecoverable timezone is that duration whichis the result of subtracting the first moment (or any moment) of the timezoneddate from the first moment (or the corresponding moment) UTC on thesamedate.·recoverable timezone·s arealways durations between '+12:00' and '-11:59'. This "timezone normalization"(which follows automatically from the definition of thedate·value space·) is explained more inLexical representation (§3.2.9.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 (adateTime value, always UTC) will have adate portiondifferent from that of thedate itself!However, noon of thatdate (the midpoint of the interval) in that(normalized) timezone will always have the samedate portion as thedate itself, even when that noon point in time is normalized toUTC. For example, 2002-10-10-05:00 begins during 2002-10-09Z and 2002-10-10+05:00ends during 2002-10-11Z, but noon of both 2002-10-10-05:00 and 2002-10-10+05:00falls in the interval which is 2002-10-10Z.
Note: See the conformance note in (§3.2.6) whichapplies to the year part of this datatype as well.
3.2.9.1 Lexical representation

For the following discussion, let the "date portion" of adateTimeordate object be an object similar to adateTime ordate object, with similar year, month, and day properties, but noothers, having the same value for these properties as the originaldateTime ordate object.

The·lexical space· ofdate consists of finite-lengthsequences of characters of the form:'-'? yyyy '-' mm '-' dd zzzzzz?where thedate and optional timezone are represented exactly thesame way as they are fordateTime. The first moment of theinterval 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 adate will always bea duration between '+12:00' and '11:59'. Timezone lexical representations, asexplained fordateTime, can range from '+14:00' to '-14:00'.The result is that literals ofdates with very large or verynegative timezones will map to a "normalized"date value with a·recoverable timezone· different from that represented in the originalrepresentation, and a matching difference of +/- 1 day in thedate itself.
3.2.9.2 Canonical representation

Given a member of thedate·value space·, thedate portion of the canonical representation (the entire representationfor nontimezoned values, and all but the timezone representation for timezoned values)is always thedate portion of thedateTime canonicalrepresentation of the interval midpoint (thedateTime 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.10 gYearMonth

[Definition:]  gYearMonth represents aspecific gregorian month in a specific gregorian year. The·value space· ofgYearMonthis 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 instancese.g. 1999-10 to represent the whole month of 1999-10, independent ofhow many days this month has.

Since the lexical representation allows an optional time zoneindicator,gYearMonth values are partially ordered because it maynot be possible to unequivocally determine the order of two values one ofwhich has a time zone and the other does not. IfgYearMonthvalues are considered as periods of time, the order relation ongYearMonth values is the order relation on their starting instants.This is discussed inOrder relation on dateTime (§3.2.7.4). See alsoAdding durations to dateTimes (§E). Pairs ofgYearMonthvalues with or without time zone indicators are totally ordered.

Note: Because month/year combinations in one calendar only rarely correspondto month/year combinations in other calendars, values of this typeare not, in general, convertible to simple values corresponding to month/yearcombinations in other calendars. This type should therefore be used with cautionin contexts where conversion to other calendars is desired.
Note: See the conformance note in (§3.2.6) whichapplies to the year part of this datatype as well.
3.2.10.1 Lexical representation

The lexical representation forgYearMonth is the reduced(right truncated) lexical representation fordateTime:CCYY-MM. No left truncation is allowed. An optional following timezone qualifier is allowed. To accommodate year values outside the range from 0001 to 9999, additional digitscan 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 alsoISO 8601 Date and Time Formats (§D).

3.2.10.2 Constraining facets

gYearMonth has thefollowing·constraining facets·:

3.2.11 gYear

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

Since the lexical representation allows an optional time zoneindicator,gYear values are partially ordered because it maynot be possible to unequivocally determine the order of two values one of which has atime zone and the other does not. IfgYear values are considered as periods of time, the order relationongYear values is the order relation on their starting instants.This is discussed inOrder relation on dateTime (§3.2.7.4). See alsoAdding durations to dateTimes (§E). Pairs ofgYear values with or without time zone indicators are totally ordered.

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

The lexical representation forgYear is the reduced (righttruncated) lexical representation fordateTime: CCYY.No left truncation is allowed. An optional following timezone qualifier is allowed as fordateTime. Toaccommodate year values outside the range from 0001 to 9999, additionaldigits 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 alsoISO 8601 Date and Time Formats (§D).

3.2.11.2 Constraining facets

gYear has thefollowing·constraining facets·:

3.2.12 gMonthDay

[Definition:]  gMonthDay is a gregorian date that recurs, specifically a day ofthe year such as the third of May. Arbitrary recurring dates are notsupported by this datatype. The·value space· ofgMonthDay is the set ofcalendardates, 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 zoneindicator,gMonthDay values are partially ordered because it maynot be possible to unequivocally determine the order of two values one of which has atime zone and the other does not. IfgMonthDay values are considered as periods of time,in an arbitrary leap year, the order relationongMonthDay values is the order relation on their starting instants.This is discussed inOrder relation on dateTime (§3.2.7.4). See alsoAdding durations to dateTimes (§E). Pairs ofgMonthDay values with or without time zone indicators are totally ordered.

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

The lexical representation forgMonthDay is the lefttruncated lexical representation fordate: --MM-DD.An optional following timezone qualifier is allowed as fordate.No preceding sign is allowed. No other formats are allowed. See alsoISO 8601 Date and Time Formats (§D).

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.12.2 Constraining facets

gMonthDay has thefollowing·constraining facets·:

3.2.13 gDay

[Definition:]  gDay is a gregorian day that recurs, specifically a dayof the month such as the 5th of the month. Arbitrary recurring daysare not supported by this datatype. The·value space·ofgDay is the space of a set ofcalendardates as defined in § 3 of[ISO 8601]. Specifically,it is a set of one-day long, monthly periodic instances.

This datatype can be used to represent a specific day of the month.To say, for example, that I get my paycheck on the 15th of each month.

Since the lexical representation allows an optional time zoneindicator,gDay values are partially ordered because it maynot be possible to unequivocally determine the order of two values one ofwhich has a time zone and the other does not. IfgDay values are considered as periods of time,in an arbitrary month that has 31 days,the order relationongDay values is the order relation on their starting instants.This is discussed inOrder relation on dateTime (§3.2.7.4). See alsoAdding durations to dateTimes (§E). Pairs ofgDayvalues with or without time zone indicators are totally ordered.

Note: Because days in one calendar only rarely correspondto days in other calendars, values of this type do not,in general, have any straightforward or intuitive representationin terms of most other calendars. This type should therefore beused with caution in contexts where conversion to other calendarsis desired.
3.2.13.1 Lexical representation

The lexical representation forgDay is the lefttruncated lexical representation fordate: ---DD .An optional following timezone qualifier is allowed as fordate. No preceding sign isallowed. No other formats are allowed. See alsoISO 8601 Date and Time Formats (§D).

3.2.13.2 Constraining facets

gDay has thefollowing·constraining facets·:

3.2.14 gMonth

[Definition:]  gMonth is a gregorian month that recurs every year.The·value space·ofgMonth is the space of a set ofcalendarmonths 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 zoneindicator,gMonth values are partially ordered because it maynot be possible to unequivocally determine the order of two values one of which has atime zone and the other does not. IfgMonth values are considered as periods of time, the order relationongMonth is the order relation on their starting instants.This is discussed inOrder relation on dateTime (§3.2.7.4). See alsoAdding durations to dateTimes (§E). Pairs ofgMonthvalues with or without time zone indicators are totally ordered.

Note: Because months in one calendar only rarely correspondto months in other calendars, values of this type do not,in general, have any straightforward or intuitive representationin terms of most other calendars. This type should therefore beused with caution in contexts where conversion to other calendarsis desired.
3.2.14.1 Lexical representation

The lexical representation forgMonth is the leftand right truncated lexical representation fordate: --MM.An optional following timezone qualifier is allowed as fordate. No preceding sign isallowed. No other formats are allowed. See alsoISO 8601 Date and Time Formats (§D).

3.2.14.2 Constraining facets

gMonth has thefollowing·constraining facets·:

3.2.15 hexBinary

[Definition:]  hexBinary representsarbitrary hex-encoded binary data. The·value space· ofhexBinary is the set of finite-length sequences of binaryoctets.

3.2.15.1 Lexical Representation

hexBinary has a lexical representation whereeach binary octet is encoded as a character tuple, consisting of twohexadecimal digits ([0-9a-fA-F]) representing the octet code. For example,"0FB7" is ahex encoding for the 16-bit integer 4023(whose binary representation is 111110110111).

3.2.15.2 Canonical Representation

The canonical representation forhexBinary is definedby prohibiting certain options from theLexical Representation (§3.2.15.1). Specifically, the lower casehexadecimal digits ([a-f]) are not allowed.

3.2.15.3 Constraining facets

hexBinary has thefollowing·constraining facets·:

3.2.16 base64Binary

[Definition:]  base64Binaryrepresents Base64-encoded arbitrary binary data. The·value space· ofbase64Binary is the set of finite-length sequences of binaryoctets. Forbase64Binary data theentire binary stream is encoded using the Base64Alphabet in[RFC 2045].

The lexical forms ofbase64Binary values are limited to the 65 charactersof the Base64 Alphabet defined in[RFC 2045], i.e.,a-z,A-Z,0-9, the plus sign (+), the forward slash (/) and theequal sign (=), together with the characters defined in[XML 1.0 (Second Edition)] as white space.No other characters are allowed.

For compatibility with older mail gateways,[RFC 2045] suggests thatbase64 data should have lines limited to at most 76 characters in length. Thisline-length limitation is not mandated in the lexical forms ofbase64Binarydata and must not be enforced by XML Schema processors.

The lexical space ofbase64Binary is given by the following grammar(the notation is that used in[XML 1.0 (Second Edition)]); legal lexical forms must matchtheBase64Binary 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 lexicalform to be a multiple of four, and for equals signs to appear only at the end of thelexical form; strings which do not meet these constraints are not legal lexical formsofbase64Binary because they cannot successfully be decoded by base64decoders.

Note: The above definition of the lexical space is more restrictive than thatgiven in[RFC 2045] as regards whitespace -- this is not an issuein 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 fixedtocollapse, which means that all leading and trailing whitespacewill be stripped, and all internal whitespace collapsed to single spacecharacters,before the above grammar is enforced.

The canonical lexical form of abase64Binary data value is the base64encoding of the value which matches the Canonical-base64Binary production in the followinggrammar:

Canonical-base64Binary  ::=  (B64B64 B64 B64)*
                               ((B64 B64 B16 '=') | (B64 B04 '=='))?

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

The length of abase64Binary value is the number of octets it contains.This may be calculated from the lexical form by removing whitespace and padding charactersand 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 ofbase64Binary data in an XML entity is to be performed on theUnicode characters obtained after character encoding processing as specified by[XML 1.0 (Second Edition)]

3.2.16.1 Constraining facets

base64Binary has thefollowing·constraining facets·:

3.2.17 anyURI

[Definition:]  anyURI represents a Uniform Resource Identifier Reference(URI). AnanyURI value can be absolute or relative, and mayhave an optional fragment identifier (i.e., it may be a URI Reference). Thistype should be used to specify the intention that the value fulfillsthe role of a URI as defined by[RFC 2396], as amended by[RFC 2732].

The mapping fromanyURI values to URIs is asdefined by the URI reference escaping proceduredefined inSection 5.4Locator Attributeof[XML Linking Language] (see also Section 8Character Encoding in URI Referencesof[Character Model]). This meansthat a wide range of internationalized resource identifiers can be specifiedwhen ananyURI is called for, and still be understood asURIs per[RFC 2396], as amended by[RFC 2732],where appropriate to identify resources.

Note: Section 5.4Locator Attributeof[XML Linking Language] requires that relative URI references be absolutizedas defined in[XML Base] before use. This is an XLink-specificrequirement and is not appropriate for XML Schema, since neither the·lexical space· nor the·value space·of theanyURI type are restricted to absolute URIs. Accordinglyabsolutization must not be performed by schema processors as part of schemavalidation.
Note: Each URI scheme imposes specialized syntax rules for URIs inthat scheme, including restrictions on the syntax of allowedfragmentidentifiers. Because it isimpractical for processors to check that a value is acontext-appropriate URI reference, this specification follows thelead of[RFC 2396] (as amended by[RFC 2732])in this matter: such rules and restrictions are not part of type validityand are not checked by·minimally conforming· processors.Thus in practice the above definition imposes only very modest obligationson·minimally conforming· processors.
3.2.17.1 Lexical representation

The·lexical space· ofanyURI isfinite-length character sequences which, when the algorithm defined inSection 5.4 of[XML Linking Language] is applied to them, result in stringswhich are legal URIs according to[RFC 2396], as amended by[RFC 2732].

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

anyURI has thefollowing·constraining facets·:

3.2.18 QName

[Definition:]  QName representsXML qualified names.The·value space· ofQName is the set oftuples {namespace name,local part},wherenamespace nameis ananyURIandlocal part isanNCName.The·lexical space· ofQName is the setof strings that·match· theQName production of[Namespaces in XML].

Note: The mapping between literals in the·lexical space· andvalues in the·value space· ofQName requiresa namespace declaration to be in scope for the context in whichQNameis used.
3.2.18.1 Constraining facets

QName has thefollowing·constraining facets·:

The use of·length·,·minLength· and·maxLength·on datatypes·derived· fromQName isdeprecated. Future versions of this specification mayremove these facets for this datatype.

3.2.19 NOTATION

[Definition:]  NOTATIONrepresents theNOTATION attributetype from[XML 1.0 (Second Edition)]. The·value space·ofNOTATION is the set ofQNamesof notations declared in the current schema.The·lexical space· ofNOTATION is the setof all names ofnotationsdeclared in the current schema (in the form ofQNames).

Schema Component Constraint: enumeration facet value required for NOTATION
It is an·error· forNOTATIONto be used directly in a schema. Only datatypes that are·derived· fromNOTATION byspecifying a value for·enumeration· can be usedin a schema.

For compatibility (seeTerminology (§1.4))NOTATIONshould be used only on attributesand should only be used in schemas with notarget namespace.

3.2.19.1 Constraining facets

NOTATION has thefollowing·constraining facets·:

The use of·length·,·minLength· and·maxLength·on datatypes·derived· fromNOTATION isdeprecated. Future versions of this specification mayremove these facets for this datatype.

previous sub-section3.3 Derived datatypes

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

This section gives conceptual definitions for all·built-in· ·derived· datatypesdefined by this specification. The XML representation used to define·derived· datatypes (whether·built-in· or·user-derived·) isgiven in sectionXML Representation of Simple Type Definition Schema Components (§4.1.2) and the completedefinitions of the·built-in· ·derived· datatypes are provided in Appendix ASchema for Datatype Definitions (normative) (§A).

3.3.1 normalizedString

[Definition:]  normalizedStringrepresents white space normalized strings.The·value space· ofnormalizedString is theset of strings that do notcontain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters.The·lexical space· ofnormalizedString is theset of strings that do notcontain the carriage return (#xD),line feed (#xA)nor tab (#x9) characters.The·base type· ofnormalizedString isstring.

3.3.1.1 Constraining facets

normalizedString has thefollowing·constraining facets·:

3.3.1.2 Derived datatypes

The following·built-in·datatypes are·derived· fromnormalizedString:

3.3.2 token

[Definition:]  tokenrepresents tokenized strings.The·value space· oftoken is theset of strings that do notcontain thecarriage return (#xD),line feed (#xA) nor tab (#x9) characters, that have noleading or trailing spaces (#x20) and that have no internal sequencesof two or more spaces.The·lexical space· oftoken is theset of strings that do not contain thecarriage return (#xD),line feed (#xA) nor tab (#x9) characters, that have noleading or trailing spaces (#x20) and that have no internal sequencesof two or more spaces.The·base type· oftoken isnormalizedString.

3.3.2.1 Constraining facets

token has thefollowing·constraining facets·:

3.3.2.2 Derived datatypes

The following·built-in·datatypes are·derived· fromtoken:

3.3.3 language

[Definition:]  languagerepresents natural language identifiers as defined byby[RFC 3066].The·value space· oflanguage is theset of all strings that are valid language identifiers as defined[RFC 3066].The·lexical space· oflanguage is the set of all strings thatconform to the pattern[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*.The·base type· oflanguage istoken.

3.3.3.1 Constraining facets

language has thefollowing·constraining facets·:

3.3.4 NMTOKEN

[Definition:]  NMTOKEN representstheNMTOKEN attribute typefrom[XML 1.0 (Second Edition)]. The·value space· ofNMTOKEN is the set of tokens that·match·theNmtoken production in[XML 1.0 (Second Edition)]. The·lexical space· ofNMTOKEN is the set of strings that·match·theNmtoken production in[XML 1.0 (Second Edition)]. The·base type· ofNMTOKEN istoken.

For compatibility (seeTerminology (§1.4))NMTOKENshould be used only on attributes.

3.3.4.1 Constraining facets

NMTOKEN has thefollowing·constraining facets·:

3.3.4.2 Derived datatypes

The following·built-in·datatypes are·derived· fromNMTOKEN:

3.3.5 NMTOKENS

[Definition:]  NMTOKENSrepresents theNMTOKENS attributetype from[XML 1.0 (Second Edition)]. The·value space·ofNMTOKENS is the set of finite, non-zero-length sequences of·NMTOKEN·s. The·lexical space·ofNMTOKENS is the set of space-separated lists of tokens,of which each token is in the·lexical space· ofNMTOKEN. The·itemType· ofNMTOKENS isNMTOKEN.

For compatibility (seeTerminology (§1.4))NMTOKENS should be used only on attributes.

3.3.5.1 Constraining facets

NMTOKENS has thefollowing·constraining facets·:

3.3.6 Name

[Definition:]  NamerepresentsXML Names.The·value space· ofName isthe set of all strings which·match· theName production of[XML 1.0 (Second Edition)]. The·lexical space· ofName is the set of all strings which·match·theName production of[XML 1.0 (Second Edition)]. The·base type· ofNameistoken.

3.3.6.1 Constraining facets

Name has thefollowing·constraining facets·:

3.3.6.2 Derived datatypes

The following·built-in·datatypes are·derived· fromName:

3.3.7 NCName

[Definition:]  NCName represents XML"non-colonized" Names. The·value space· ofNCName is the set of all strings which·match·theNCName production of[Namespaces in XML]. The·lexical space· ofNCName is the set of all strings which·match·theNCName production of[Namespaces in XML]. The·base type· ofNCName isName.

3.3.7.1 Constraining facets

NCName has thefollowing·constraining facets·:

3.3.7.2 Derived datatypes

The following·built-in·datatypes are·derived· fromNCName:

3.3.8 ID

[Definition:]  ID represents theID attribute type from[XML 1.0 (Second Edition)]. The·value space· ofID is the set of all strings that·match·theNCName production in[Namespaces in XML]. The·lexical space· ofID is the set of allstrings that·match· theNCName production in[Namespaces in XML].The·base type· ofID isNCName.

For compatibility (seeTerminology (§1.4))ID should be used only on attributes.

3.3.8.1 Constraining facets

ID has thefollowing·constraining facets·:

3.3.9 IDREF

[Definition:]  IDREF represents theIDREF attribute type from[XML 1.0 (Second Edition)]. The·value space· ofIDREF is the set of all strings that·match·theNCName production in[Namespaces in XML]. The·lexical space· ofIDREF is the set ofstrings that·match· theNCName production in[Namespaces in XML].The·base type· ofIDREF isNCName.

For compatibility (seeTerminology (§1.4)) this datatypeshould be used only on attributes.

3.3.9.1 Constraining facets

IDREF has thefollowing·constraining facets·:

3.3.9.2 Derived datatypes

The following·built-in·datatypes are·derived· fromIDREF:

3.3.10 IDREFS

[Definition:]  IDREFS represents theIDREFS attribute type from[XML 1.0 (Second Edition)]. The·value space· ofIDREFS is the set of finite, non-zero-length sequences ofIDREFs.The·lexical space· ofIDREFS is theset of space-separated lists of tokens, of which each token is in the·lexical space· ofIDREF.The·itemType· ofIDREFS isIDREF.

For compatibility (seeTerminology (§1.4))IDREFSshould be used only on attributes.

3.3.10.1 Constraining facets

IDREFS has thefollowing·constraining facets·:

3.3.11 ENTITY

[Definition:]  ENTITY represents theENTITY attribute type from[XML 1.0 (Second Edition)]. The·value space· ofENTITY is the set of all strings that·match·theNCName production in[Namespaces in XML] and have been declared as anunparsed entity inadocument type definition.The·lexical space· ofENTITY is the setof all strings that·match· theNCName production in[Namespaces in XML].The·base type· ofENTITY isNCName.

Note: The·value space· ofENTITY is scopedto a specific instance document.

For compatibility (seeTerminology (§1.4))ENTITYshould be used only on attributes.

3.3.11.1 Constraining facets

ENTITY has thefollowing·constraining facets·:

3.3.11.2 Derived datatypes

The following·built-in·datatypes are·derived· fromENTITY:

3.3.12 ENTITIES

[Definition:]  ENTITIESrepresents theENTITIES attributetype from[XML 1.0 (Second Edition)]. The·value space·ofENTITIES is the set of finite, non-zero-length sequences of·ENTITY·s that have been declared asunparsed entitiesin adocument type definition.The·lexical space· ofENTITIES is theset of space-separated lists of tokens, of which each token is in the·lexical space· ofENTITY.The·itemType· ofENTITIES isENTITY.

Note: The·value space· ofENTITIES is scopedto a specific instance document.

For compatibility (seeTerminology (§1.4))ENTITIESshould be used only on attributes.

3.3.12.1 Constraining facets

ENTITIES has thefollowing·constraining facets·:

3.3.13 integer

[Definition:]  integer is·derived· fromdecimal by fixing thevalue of·fractionDigits· to be 0anddisallowing the trailing decimal point.This results in the standardmathematical concept of the integer numbers. The·value space· ofinteger is the infiniteset {...,-2,-1,0,1,2,...}. The·base type· ofinteger isdecimal.

3.3.13.1 Lexical representation

integer has a lexical representation consisting of a finite-length sequenceof 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 forinteger is definedby prohibiting certain options from theLexical representation (§3.3.13.1). Specifically, the preceding optional "+" sign is prohibited and leading zeroes are prohibited.

3.3.13.3 Constraining facets

integer has thefollowing·constraining facets·:

3.3.13.4 Derived datatypes

The following·built-in·datatypes are·derived· frominteger:

3.3.14 nonPositiveInteger

[Definition:]  nonPositiveInteger is·derived· frominteger by setting the value of·maxInclusive· to be 0. This results in thestandard mathematical concept of the non-positive integers.The·value space· ofnonPositiveIntegeris the infinite set {...,-2,-1,0}. The·base type·ofnonPositiveInteger isinteger.

3.3.14.1 Lexical representation

nonPositiveInteger has a lexical representation consisting ofan optional preceding signfollowed by a finite-length sequence of decimal digits (#x30-#x39).The sign may be "+" or may be omitted only forlexical forms denoting zero; in all other lexical forms, the negativesign ("-") must be present.For example: -1, 0, -12678967543233, -100000.

3.3.14.2 Canonical representation

The canonical representation fornonPositiveInteger is definedby prohibiting certain options from theLexical representation (§3.3.14.1).In the canonical form for zero, the sign must beomitted. Leading zeroes are prohibited.

3.3.14.3 Constraining facets

nonPositiveInteger has thefollowing·constraining facets·:

3.3.14.4 Derived datatypes

The following·built-in·datatypes are·derived· fromnonPositiveInteger:

3.3.15 negativeInteger

[Definition:]  negativeInteger is·derived· fromnonPositiveInteger by setting the value of·maxInclusive· to be -1. This results in thestandard mathematical concept of the negative integers. The·value space· ofnegativeIntegeris the infinite set {...,-2,-1}. The·base type·ofnegativeInteger isnonPositiveInteger.

3.3.15.1 Lexical representation

negativeInteger has a lexical representation consisting ofa negative sign ("-") followed by a finite-lengthsequence of decimal digits (#x30-#x39). For example: -1, -12678967543233, -100000.

3.3.15.2 Canonical representation

The canonical representation fornegativeInteger is definedby prohibiting certain options from theLexical representation (§3.3.15.1). Specifically, leading zeroes are prohibited.

3.3.15.3 Constraining facets

negativeInteger has thefollowing·constraining facets·:

3.3.16 long

[Definition:]  long is·derived· frominteger by setting thevalue of·maxInclusive· to be 9223372036854775807and·minInclusive· to be -9223372036854775808.The·base type· oflong isinteger.

3.3.16.1 Lexical representation

long has a lexical representation consistingof an optional sign followed by a finite-lengthsequence 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 forlong is definedby prohibiting certain options from theLexical representation (§3.3.16.1). Specifically, thethe optional "+" sign is prohibited and leading zeroes are prohibited.

3.3.16.3 Constraining facets

long has thefollowing·constraining facets·:

3.3.16.4 Derived datatypes

The following·built-in·datatypes are·derived· fromlong:

3.3.17 int

[Definition:]  intis·derived· fromlong by setting thevalue of·maxInclusive· to be 2147483647 and·minInclusive· to be -2147483648. The·base type· ofint islong.

3.3.17.1 Lexical representation

int has a lexical representation consistingof an optional sign followed by a finite-lengthsequence 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 forint is definedby prohibiting certain options from theLexical representation (§3.3.17.1). Specifically, thethe optional "+" sign is prohibited and leading zeroes are prohibited.

3.3.17.3 Constraining facets

int has thefollowing·constraining facets·:

3.3.17.4 Derived datatypes

The following·built-in·datatypes are·derived· fromint:

3.3.18 short

[Definition:]  short is·derived· fromint by setting thevalue of·maxInclusive· to be 32767 and·minInclusive· to be -32768. The·base type· ofshort isint.

3.3.18.1 Lexical representation

short has a lexical representation consistingof an optional sign followed by a finite-length sequence of decimaldigits (#x30-#x39). If the sign is omitted, "+" is assumed.For example: -1, 0, 12678, +10000.

3.3.18.2 Canonical representation

The canonical representation forshort is definedby prohibiting certain options from theLexical representation (§3.3.18.1). Specifically, thethe optional "+" sign is prohibited and leading zeroes are prohibited.

3.3.18.3 Constraining facets

short has thefollowing·constraining facets·:

3.3.18.4 Derived datatypes

The following·built-in·datatypes are·derived· fromshort:

3.3.19 byte

[Definition:]  byteis·derived· fromshortby setting the value of·maxInclusive· to be 127and·minInclusive· to be -128.The·base type· ofbyte isshort.

3.3.19.1 Lexical representation

byte has a lexical representation consistingof an optional sign followed by a finite-lengthsequence 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 forbyte is definedby prohibiting certain options from theLexical representation (§3.3.19.1). Specifically, thethe optional "+" sign is prohibited and leading zeroes are prohibited.

3.3.19.3 Constraining facets

byte has thefollowing·constraining facets·:

3.3.20 nonNegativeInteger

[Definition:]  nonNegativeInteger is·derived· frominteger by setting the value of·minInclusive· to be 0. This results in thestandard mathematical concept of the non-negative integers. The·value space· ofnonNegativeIntegeris the infinite set {0,1,2,...}. The·base type· ofnonNegativeInteger isinteger.

3.3.20.1 Lexical representation

nonNegativeInteger has a lexical representation consisting ofan optional sign followed by a finite-lengthsequence 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 formsdenoting 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 fornonNegativeInteger is definedby prohibiting certain options from theLexical representation (§3.3.20.1). Specifically, thethe optional "+" sign is prohibited and leading zeroes are prohibited.

3.3.20.3 Constraining facets

nonNegativeInteger has thefollowing·constraining facets·:

3.3.20.4 Derived datatypes

The following·built-in·datatypes are·derived· fromnonNegativeInteger:

3.3.21 unsignedLong

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

3.3.21.1 Lexical representation

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

3.3.21.2 Canonical representation

The canonical representation forunsignedLong is definedby prohibiting certain options from theLexical representation (§3.3.21.1). Specifically,leading zeroes are prohibited.

3.3.21.3 Constraining facets

unsignedLong has thefollowing·constraining facets·:

3.3.21.4 Derived datatypes

The following·built-in·datatypes are·derived· fromunsignedLong:

3.3.22 unsignedInt

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

3.3.22.1 Lexical representation

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

3.3.22.2 Canonical representation

The canonical representation forunsignedInt is definedby prohibiting certain options from theLexical representation (§3.3.22.1). Specifically,leading zeroes are prohibited.

3.3.22.3 Constraining facets

unsignedInt has thefollowing·constraining facets·:

3.3.22.4 Derived datatypes

The following·built-in·datatypes are·derived· fromunsignedInt:

3.3.23 unsignedShort

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

3.3.23.1 Lexical representation

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

3.3.23.2 Canonical representation

The canonical representation forunsignedShort is definedby prohibiting certain options from theLexical representation (§3.3.23.1). Specifically, theleading zeroes are prohibited.

3.3.23.3 Constraining facets

unsignedShort has thefollowing·constraining facets·:

3.3.23.4 Derived datatypes

The following·built-in·datatypes are·derived· fromunsignedShort:

3.3.24 unsignedByte

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

3.3.24.1 Lexical representation

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

3.3.24.2 Canonical representation

The canonical representation forunsignedByte is definedby prohibiting certain options from theLexical representation (§3.3.24.1). Specifically,leading zeroes are prohibited.

3.3.24.3 Constraining facets

unsignedByte has thefollowing·constraining facets·:

3.3.25 positiveInteger

[Definition:]  positiveInteger is·derived· fromnonNegativeInteger by setting the value of·minInclusive· to be 1. This results in the standardmathematical concept of the positive integer numbers.The·value space· ofpositiveIntegeris the infinite set {1,2,...}. The·base type· ofpositiveInteger isnonNegativeInteger.

3.3.25.1 Lexical representation

positiveInteger has a lexical representation consistingof an optional positive sign ("+") followed by a finite-lengthsequence of decimal digits (#x30-#x39).For example: 1, 12678967543233, +100000.

3.3.25.2 Canonical representation

The canonical representation forpositiveInteger is definedby prohibiting certain options from theLexical representation (§3.3.25.1). Specifically, theoptional "+" sign is prohibited and leading zeroes are prohibited.

3.3.25.3 Constraining facets

positiveInteger has thefollowing·constraining facets·:

4 Datatype components

The following sections provide full details on the properties andsignificance of each kind of schema component involved in datatypedefinitions. For each property, the kinds of values it is allowed to have isspecified. Any property not identified as optional is required tobe present; optional properties which are not present haveabsent 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 isnot the same asabsent.Any property value identified as a superset or a subset of some set maybe equal to that set, unless a proper superset or subset is explicitlycalled for.

For more information on the notion of datatype (schema) components,seeSchema Component Detailsof[XML Schema Part 1: Structures].

next sub-section4.1 Simple Type Definition

        4.1.1The Simple Type Definition Schema Component
        4.1.2XML Representation of Simple Type Definition Schema Components
        4.1.3Constraints on XML Representation of Simple Type Definition
        4.1.4Simple Type Definition Validation Rules
        4.1.5Constraints on Simple Type Definition Schema Components
        4.1.6Simple Type Definition for anySimpleType

Simple Type definitions provide for:

4.1.1 The Simple Type Definition Schema Component

The Simple Type Definition schema component has the following properties:

{name}
Optional. An NCName as defined by[Namespaces in XML].
{target namespace}
Eitherabsent or anamespace name, as defined in[Namespaces in XML].
{variety}
One of {atomic,list,union}. Depending on thevalue 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 ofFacets (§2.4).
{fundamental facets}
A set ofFundamental facets (§2.4.1)
{base type definition}
If the datatype has been·derived· by·restriction· then theSimple Type Definition componentfrom which it is·derived·, otherwisetheSimple Type Definition for anySimpleType (§4.1.6).
{final}
A subset of{restriction, list, union}.
{annotation}
Optional. Anannotation.

Datatypes are identified by their{name}and{target namespace}. Exceptfor anonymous datatypes (those with no{name}),datatype definitions·must· be uniquely identifiedwithin a schema.

If{variety} is·atomic·then the·value space· of the datatype defined willbe 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 willbe 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 theunion 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 definitionunioned with the possibly empty set of{facets} of{base type definition}.

The value of{fundamental facets} consists of the set of·fundamental facet·s and their values.

If{final} is the empty set then the type can be usedin deriving other types; the explicit valuesrestriction,list andunion prevent further derivationsby·restriction·,·list· and·union· respectively.

4.1.2 XML Representation of Simple Type Definition Schema Components

The XML representation for aSimple Type Definition schema componentis a<simpleType> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thename [attribute], if present,otherwisenull
{final}A set corresponding to theactual value of thefinal[attribute], if present, otherwise theactual value of thefinalDefault[attribute] of the ancestorschemaelement 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 orabsent depending on whether the string contains an equivalently namedspace-delimited substring.
Note: Although thefinalDefault[attribute] ofschema may include values other thanrestriction,list orunion, those values are ignored in the determination of{final}
{target namespace}Theactual value of thetargetNamespace[attribute]of the parentschema element information item.
{annotation}The annotation corresponding to the<annotation>element information item in the[children], if present, otherwisenull

A·derived· datatype can be·derived·from a·primitive· datatype or another·derived· datatype by one of three means:byrestriction, bylist or byunion.

4.1.2.1 Derivation by restriction

<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}Theactual value of{variety} of{base type definition}
{facets}The union of the set ofFacets (§2.4) componentsresolved to by the facet[children] merged with{facets}from{base type definition}, subject to the Facet Restriction Validconstraints specified inFacets (§2.4).
{base type definition}TheSimple Type Definition component resolved to by theactual value of thebase[attribute] or the<simpleType>[children],whichever is present.
Example
An electronic commerce schema might define a datatype calledSku (the barcode number that appears on products) from the·built-in· datatypestring bysupplying 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 isits·base type· and·pattern·is the facet.
4.1.2.2 Derivation by list

<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}TheSimple Type Definition component resolved to by theactual value of theitemType[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 offinite-length sequences of values from the·value space· of the·itemType· and whose·lexical space· iscomposed 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 thederivation method.

As mentioned inList datatypes (§2.5.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 applicableto the·atomic· datatype that serves as the·itemType· of the·list·.

For each of·length·,·maxLength·and·minLength·, theunit of length is measured in number of list items.The value of·whiteSpace·is fixed to the valuecollapse.

4.1.2.3 Derivation by union

<union
  id =ID
  memberTypes = List ofQName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?,simpleType*)
</union>

Simple Type Definition Schema Component
PropertyRepresentation
{variety}union
{member type definitions}The sequence ofSimple Type Definition components resolved to by theitems in theactual value of thememberTypes[attribute], if any,in order, followed by theSimple Type Definition components resolved to by the<simpleType>[children], if any, in order.If{variety} isunion foranySimple Type Definition components resolved to above, thentheSimple Type Definition is replaced by its{member type definitions}.

A·union· datatype can be·derived·from one or more·atomic·,·list· orother·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 withone 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 inUnion datatypes (§2.5.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 areapplicable 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
Schema Representation Constraint: itemType attribute or simpleType child
Either theitemType[attribute] or the<simpleType>[child] of the<list> elementmust be present, but not both.
Schema Representation Constraint: base attribute or simpleType child
Either thebase[attribute] or thesimpleType[child] of the<restriction>element must be present, but not both.
Schema Representation Constraint: memberTypes attribute or simpleType children
Either thememberTypes[attribute] of the<union>element must be non-empty orthere must be at least onesimpleType[child].

4.1.4 Simple Type Definition Validation Rules

Validation Rule: Facet Valid
A value in a·value space· is facet-valid withrespect 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 bepattern valid (§4.3.4.4);
1.2 if·pattern· is not a member of{facets},then
1.2.1 if{variety} is·atomic· thenthe string must·match· a literal in the·lexical space· of{base type definition}
1.2.2 if{variety} is·list· then the string mustbe 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· thenthe 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 stepis a member of the·value space· of the datatype, as determinedby it beingFacet Valid (§4.1.4)with respect to each member of{facets} (exceptfor·pattern·).

4.1.5 Constraints on Simple Type Definition Schema Components

Schema Component Constraint: applicable facets
The·constraining facet·s which are allowedto be members of{facets} are dependent on{base type definition} as specified in the following table:
{base type definition}applicable{facets}
If{variety} islist,then
[all datatypes]length,minLength,maxLength,pattern,enumeration,whiteSpace
If{variety} isunion, then
[all datatypes]pattern,enumeration
else if{variety} isatomic, 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 versionof theur-type definition presentin every schema by definition. It has the following properties:

Schema ComponentanySimpleType

previous sub-sectionnext sub-section4.2 Fundamental Facets

        4.2.1equal
        4.2.2ordered
        4.2.3bounded
        4.2.4cardinality
        4.2.5numeric

4.2.1 equal

Every·value space· supports the notion of equality,with the following rules:

On every datatype, the operation Equal is defined in terms of the equalityproperty of the·value space·: for any valuesa, b drawn from the·value space·,Equal(a,b) istrue ifa = b, and false otherwise.

Note that in consequence of the above:

Note: There is no schema component corresponding to theequal·fundamental facet·.

4.2.2 ordered

[Definition:]  Anorder relation on a·value space·is a mathematical relation that imposes a·total order· or a·partial order· on themembers of the·value space·.

[Definition:]  A·value space·, and hence a datatype, is said to beordered if there exists an·order-relation· defined for that·value space·.

[Definition:]  Apartial order is an·order-relation·that isirreflexive,asymmetric andtransitive.

A·partial order· has the following properties:

The notationa <> b is used to indicate thecase whena != b and neithera < b norb < a.For any valuesa andbfrom different·primitive· ·value space·s,a <> b.

[Definition:]  Whena <> b,a andb areincomparable,[Definition:]  otherwise they arecomparable.

[Definition:]  Atotal order is an·partial order·such that for noa andbis it the case thata <> b.

A·total order· has all of the properties specifiedabove for·partial order·, plusthe following property:

Note: The fact that this specification does not define an·order-relation· for some datatype does notmean that some other application cannot treat that datatype asbeing ordered by imposing its own order relation.

·ordered· provides for:

4.2.2.1 The ordered Schema Component
{value}
One of{false, partial, total}.

{value} depends on{variety},{facets} and{member type definitions}in theSimple Type Definition component in which a·ordered· component appears as a member of{fundamental facets}.

When{variety} is·atomic·,{value} is inherited from{value} of{base type definition}.For all·primitive· types{value}is as specifiedin the table inFundamental Facets (§C.1).

When{variety} is·list·,{value} isfalse.

When{variety} is·union·,{value} ispartial unless one of thefollowing:

4.2.3 bounded

[Definition:]  A valueu in an·ordered· ·value space· Uis said to be aninclusive upper bound of a·value space· V(whereV is a subset ofU)if for allv inV,u >=v.

[Definition:]  A valueu in an·ordered· ·value space· Uis said to be anexclusive upper bound of a·value space· V(whereV is a subset ofU)if for allv inV,u >v.

[Definition:]  A valuel in an·ordered· ·value space· Lis said to be aninclusive lower bound of a·value space· V(whereV is a subset ofL)if for allv inV,l <=v.

[Definition:]  A valuel in an·ordered· ·value space· Lis said to be anexclusive lower bound of a·value space· V(whereV is a subset ofL)if for allv inV,l <v.

[Definition:]  A datatype isboundedif its·value space· has either an·inclusive upper bound· or an·exclusive upper bound·and either an·inclusive lower bound· or an·exclusive lower bound·.

·bounded· provides for:

4.2.3.1 The bounded Schema Component

{value} depends on{variety},{facets} and{member type definitions}in theSimple Type Definition component in which a·bounded· component appears as a member of{fundamental facets}.

When{variety} is·atomic·,if one of·minInclusive· or·minExclusive·and one of·maxInclusive· or·maxExclusive·are among{facets} , then{value} istrue; else{value} isfalse.

When{variety} is·list·,if·length· or both of·minLength· and·maxLength·are among{facets}, then{value} istrue; else{value} isfalse.

When{variety} is·union·,if{value} istruefor every member of{member type definitions}and all members of{member type definitions} share a commonancestor, then{value} istrue;else{value} isfalse.

4.2.4 cardinality

[Definition:]  Every·value space· has associated with it the concept ofcardinality. Some·value space·sare finite, some are countably infinite while still others couldconceivably be uncountably infinite (although no·value space·defined by this specification is uncountable infinite). A datatype issaid to have the cardinality of its·value space·.

Itis sometimes useful to categorize·value space·s(and hence, datatypes) as to their cardinality. There are twosignificant cases:

·cardinality· provides for:

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

{value} depends on{variety},{facets} and{member type definitions}in theSimple Type Definition component in which a·cardinality· component appears as a member of{fundamental facets}.

When{variety} is·atomic· and{value} of{base type definition}isfinite, then{value} isfinite.

When{variety} is·atomic· and{value} of{base type definition}iscountably infinite andeither of the followingconditions are true, then{value} isfinite; else{value}iscountably infinite:

  1. one of·length·,·maxLength·,·totalDigits· is among{facets},
  2. all of the following are true:
    1. one of·minInclusive· or·minExclusive·is among{facets}
    2. one of·maxInclusive· or·maxExclusive·is among{facets}
    3. either of the following are true:
      1. ·fractionDigits· is among{facets}
      2. {base type definition} is one ofdate,gYearMonth,gYear,gMonthDay,gDay orgMonth or any type·derived·from them

When{variety} is·list·,if·length· or both of·minLength· and·maxLength·are among{facets}, then{value} isfinite; else{value} iscountably infinite.

When{variety} is·union·,if{value} isfinitefor every member of{member type definitions}, then{value} isfinite;else{value} iscountably infinite.

4.2.5 numeric

[Definition:]  A datatype is said to benumeric if its values are conceptually quantities (in somemathematical number system).

[Definition:]  A datatype whose valuesare not·numeric· is said to benon-numeric.

·numeric· provides for:

4.2.5.1 The numeric Schema Component

{value} depends on{variety},{facets},{base type definition} and{member type definitions} in theSimple Type Definition componentin which a·cardinality· component appears as a member of{fundamental facets}.

When{variety} is·atomic·,{value} is inherited from{value} of{base type definition}.For all·primitive· types{value}is as specifiedin the table inFundamental Facets (§C.1).

When{variety} is·list·,{value} isfalse.

When{variety} is·union·,if{value} istruefor every member of{member type definitions}, then{value} istrue;else{value} isfalse.

previous sub-section4.3 Constraining Facets

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

4.3.1 length

[Definition:]  length is the numberofunits of length, whereunits of lengthvaries depending on the type that is being·derived· from.The value oflength ·must· be anonNegativeInteger.

Forstring and datatypes·derived· fromstring,length is measured in units ofcharacters as defined in[XML 1.0 (Second Edition)].ForanyURI,length is measured in units ofcharacters (as forstring).ForhexBinary andbase64Binary 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: Forstring and datatypes·derived· fromstring,length will not always coincide with "string length" as perceivedby some users or with the number of storage units in some digital representation.Therefore, care should be taken when specifying a value forlengthand in attempting to infer storage requirements from a given value forlength.

·length· provides for:

Example
The following is the definition of a·user-derived·datatype to represent product codes which must beexactly 8 characters in length. By fixing the value of thelength facet we ensure that types derived from productCode canchange or set the values of other facets, such aspattern, butcannot change the length.
<simpleType name='productCode'>   <restriction base='string'>     <length value='8' fixed='true'/>   </restriction></simpleType>
4.3.1.1 The length Schema Component

If{fixed} istrue, then types for whichthe current type is the{base type definition} cannot specify avalue forlength other than{value}.

4.3.1.2 XML Representation of length Schema Components

The XML representation for alength schemacomponent is a<length> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{fixed}Theactual value of thefixed[attribute], if present, otherwise false
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.1.3 length Validation Rules
Validation Rule: Length Valid
A value in a·value space· is facet-valid withrespect to·length·, determined as follows:
1 if the{variety} is·atomic· then
1.1 if{primitive type definition} isstring oranyURI, then thelength of the value, as measured incharacters·must· be equal to{value};
1.2 if{primitive type definition} ishexBinary orbase64Binary, then thelength of the value, as measured in octets of the binary data,·must· be equal to{value};
1.3 if{primitive type definition} isQName orNOTATION, thenany{value} is facet-valid.
2 if the{variety} is·list·,then the length of the value, as measuredin list items,·must· be equal to{value}

The use of·length·on datatypes·derived· fromQName andNOTATIONis deprecated. Future versions of thisspecification may remove this facet for these datatypes.

4.3.1.4 Constraints on length Schema Components
Schema Component Constraint: length and minLength or maxLength
Iflength is a member of{facets} then
1 It is an error forminLength to be a member of{facets} unless
1.1 the{value} ofminLength <= the{value} oflength and
1.2 there is type definition from which this one is derived by one or more restriction steps in whichminLength has the same{value} andlength is not specified.
2 It is an error formaxLength to be a member of{facets} unless
2.1 the{value} oflength <= the{value} ofmaxLength and
2.2 there is type definition from which this one is derived by one or more restriction steps in whichmaxLength has the same{value} andlength is not specified.

4.3.2 minLength

[Definition:]  minLength isthe minimum number ofunits of length, whereunits of length varies depending on the type that is being·derived· from.The value ofminLength ·must· be anonNegativeInteger.

Forstring and datatypes·derived· fromstring,minLength is measured in units ofcharacters as defined in[XML 1.0 (Second Edition)].ForhexBinary andbase64Binary 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: Forstring and datatypes·derived· fromstring,minLength will not always coincide with "string length" as perceivedby some users or with the number of storage units in some digital representation.Therefore, care should be taken when specifying a value forminLengthand in attempting to infer storage requirements from a given value forminLength.

·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.3.2.1 The minLength Schema Component

If{fixed} istrue, then types for whichthe current type is the{base type definition} cannot specify avalue forminLength other than{value}.

4.3.2.2 XML Representation of minLength Schema Component

The XML representation for aminLength schemacomponent is a<minLength> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{fixed}Theactual value of thefixed[attribute], if present, otherwise false
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.2.3 minLength Validation Rules
Validation Rule: minLength Valid
A value in a·value space· is facet-valid withrespect to·minLength·, determined as follows:
1 if the{variety} is·atomic· then
1.1 if{primitive type definition} isstring oranyURI, then thelength of the value, as measured incharacters·must· be greater than or equal to{value};
1.2 if{primitive type definition} ishexBinary orbase64Binary, then thelength 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} isQName orNOTATION, thenany{value} is facet-valid.
2 if the{variety} is·list·,then the length of the value, as measuredin list items,·must· be greater than or equalto{value}

The use of·minLength·on datatypes·derived· fromQName andNOTATIONis deprecated. Future versions of thisspecification may remove this facet for these datatypes.

4.3.2.4 Constraints on minLength Schema Components

4.3.3 maxLength

[Definition:]  maxLength isthe maximum number ofunits of length, whereunits of length variesdepending on the type that is being·derived· from.The value ofmaxLength ·must· be anonNegativeInteger.

Forstring and datatypes·derived· fromstring,maxLength is measured in units ofcharacters as defined in[XML 1.0 (Second Edition)].ForhexBinary andbase64Binary 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: Forstring and datatypes·derived· fromstring,maxLength will not always coincide with "string length" as perceivedby some users or with the number of storage units in some digital representation.Therefore, care should be taken when specifying a value formaxLengthand in attempting to infer storage requirements from a given value formaxLength.

·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 limitto the number of characters that are acceptable.
<simpleType name='form-input'>  <restriction base='string'>    <maxLength value='50'/>  </restriction></simpleType>
4.3.3.1 The maxLength Schema Component

If{fixed} istrue, then types for whichthe current type is the{base type definition} cannot specify avalue formaxLength other than{value}.

4.3.3.2 XML Representation of maxLength Schema Components

The XML representation for amaxLength schemacomponent is a<maxLength> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{fixed}Theactual value of thefixed[attribute], if present, otherwise false
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.3.3 maxLength Validation Rules
Validation Rule: maxLength Valid
A value in a·value space· is facet-valid withrespect to·maxLength·, determined as follows:
1 if the{variety} is·atomic· then
1.1 if{primitive type definition} isstring oranyURI, then thelength of the value, as measured incharacters·must· be less than or equal to{value};
1.2 if{primitive type definition} ishexBinary orbase64Binary, then thelength 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} isQName orNOTATION, thenany{value} is facet-valid.
2 if the{variety} is·list·,then the length of the value, as measuredin list items,·must· be less than or equal to{value}

The use of·maxLength·on datatypes·derived· fromQName andNOTATIONis deprecated. Future versions of thisspecification may remove this facet for these datatypes.

4.3.3.4 Constraints on maxLength Schema Components

4.3.4 pattern

[Definition:]  pattern is a constraint on the·value space· of a datatype which is achieved byconstraining the·lexical space· to literalswhich match a specific pattern. The value ofpattern ·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 theUnited States, by limiting strings to those which are matched bya specific·regular expression·.
<simpleType name='better-us-zipcode'>  <restriction base='string'>    <pattern value='[0-9]{5}(-[0-9]{4})?'/>  </restriction></simpleType>
4.3.4.1 The pattern Schema Component
4.3.4.2 XML Representation of pattern Schema Components

The XML representation for apattern schemacomponent is a<pattern> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.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 shouldbe combined as if they appeared in a single·regular expression· as separate·branch·es.
Note: It is a consequence of the schema representation constraintMultiple patterns (§4.3.4.3) and of the rules for·restriction· that·pattern·facets specified on thesame step in a typederivation areORed together, while·pattern·facets specified ondifferent steps of a type derivationareANDed together.

Thus, to impose two·pattern· constraints simultaneously,schema authors may either write a single·pattern· whichexpresses the intersection of the two·pattern·s they wish toimpose, or define each·pattern· on a separate type derivationstep.

4.3.4.4 pattern Validation Rules
Validation Rule: pattern valid
A literal in a·lexical space· is facet-valid withrespect to·pattern· if:
1 the literal is among the set of character sequences denoted bythe·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 valuesof dates to the three US holidays enumerated. This datatypedefinition would appear in a schema authored by an "end-user" andshows how to define a datatype by enumerating the values in its·value space·. The enumerated values must betype-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.3.5.1 The enumeration Schema Component
4.3.5.2 XML Representation of enumeration Schema Components

The XML representation for anenumeration schemacomponent is an<enumeration> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.5.3 Constraints on XML Representation of enumeration
Schema Representation Constraint: Multiple enumerations
If multiple<enumeration> element information items appearas[children] of a<simpleType> the{value} of theenumerationcomponent should be the set of all such[value]s.
4.3.5.4 enumeration Validation Rules
Validation Rule: enumeration valid
A value in a·value space· is facet-valid withrespect to·enumeration· ifthe value is one of the values specified in{value}
4.3.5.5 Constraints on enumeration Schema Components

4.3.6 whiteSpace

[Definition:]  whiteSpace constrains the·value space·of types·derived· fromstring such thatthe various behaviorsspecified inAttribute Value Normalizationin[XML 1.0 (Second Edition)] are realized. The value ofwhiteSpace must be one of {preserve, replace, collapse}.

preserve
No normalization is done, the value is not changed (this is thebehavior required by[XML 1.0 (Second Edition)] 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 byreplace, contiguoussequences of #x20's are collapsed to a single #x20, and leading andtrailing #x20's are removed.
Note: The notation #xA used here (and elsewhere in this specification) representsthe Universal Character Set (UCS) code pointhexadecimal A (line feed), which is denoted byU+000A. This notation is to be distinguished from&#xA;,which is the XMLcharacter referenceto that same UCS code point.

whiteSpace is applicable to all·atomic· and·list· datatypes. For all·atomic·datatypes other thanstring (and types·derived·by·restriction· from it) the value ofwhiteSpace iscollapse and cannot be changed by a schema author; forstring the value ofwhiteSpace ispreserve; for any type·derived· by·restriction· fromstring the value ofwhiteSpace canbe any of the three legal values. For all datatypes·derived· by·list· thevalue ofwhiteSpace iscollapse and cannotbe changed by a schema author. For all datatypes·derived· by·union· whiteSpace does not apply directly; however, thenormalization behavior of·union· types is controlled bythe value ofwhiteSpace on that one of the·memberTypes· against which the·union·is successfully validated.

Note: For more information onwhiteSpace, see thediscussion on white space normalization inSchema Component Detailsin[XML Schema Part 1: Structures].

·whiteSpace· provides for:

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

If{fixed} istrue, then types for whichthe current type is the{base type definition} cannot specify avalue forwhiteSpace other than{value}.

4.3.6.2 XML Representation of whiteSpace Schema Components

The XML representation for awhiteSpace schemacomponent is a<whiteSpace> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{fixed}Theactual value of thefixed[attribute], if present, otherwise false
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.6.3 whiteSpace Validation Rules
Note: There are no·Validation Rule·s associated·whiteSpace·.For more information, see thediscussion on white space normalization inSchema Component Detailsin[XML Schema Part 1: Structures].
4.3.6.4 Constraints on whiteSpace Schema Components
Schema Component Constraint: whiteSpace valid restriction
It is an·error· ifwhiteSpaceis among the members of{facets} of{base type definition} and any of the following conditions istrue:
1{value} isreplace orpreserveand the{value} of the parentwhiteSpace iscollapse
2{value} ispreserveand the{value} of the parentwhiteSpace isreplace

4.3.7 maxInclusive

[Definition:]  maxInclusive is the·inclusive upper bound·of the·value space· for a datatype with the·ordered· property. The value ofmaxInclusive ·must· bein 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 to100, using·maxInclusive·.
<simpleType name='one-hundred-or-less'>  <restriction base='integer'>    <maxInclusive value='100'/>  </restriction></simpleType>
4.3.7.1 The maxInclusive Schema Component

If{fixed} istrue, then types for whichthe current type is the{base type definition} cannot specify avalue formaxInclusive other than{value}.

4.3.7.2 XML Representation of maxInclusive Schema Components

The XML representation for amaxInclusive schemacomponent is a<maxInclusive> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{fixed}Theactual value of thefixed[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.3.7.3 maxInclusive Validation Rules
Validation Rule: maxInclusive Valid
A value in an·ordered· ·value space·is facet-valid with respect to·maxInclusive·, determined asfollows:
1 if the·numeric· property in{fundamental facets} istrue, then the value·must· be numerically less than orequal to{value};
2 if the·numeric· property in{fundamental facets} isfalse (i.e.,{base type definition} is one of the date and time relateddatatypes), then the value·must· be chronologicallyless than or equal to{value};
4.3.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 valuespecified for·maxInclusive· for the same datatype.
Schema Component Constraint: maxInclusive valid restriction
It is an·error· if any of the following conditionsis true:
1maxInclusive is among the members of{facets} of{base type definition}and{value} isgreater than the{value} of the parentmaxInclusive
2maxExclusive is among the members of{facets} of{base type definition}and{value} isgreater than or equal to the{value} of the parentmaxExclusive
3minInclusive is among the members of{facets} of{base type definition}and{value} isless than the{value} of the parentminInclusive
4minExclusive is among the members of{facets} of{base type definition}and{value} isless than or equal to the{value} of the parentminExclusive

4.3.8 maxExclusive

[Definition:]  maxExclusive is the·exclusive upper bound·of the·value space· for a datatype with the·ordered· property. The value ofmaxExclusive ·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 to100, 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 tothe previous one (named 'one-hundred-or-less').
4.3.8.1 The maxExclusive Schema Component

If{fixed} istrue, then types for whichthe current type is the{base type definition} cannot specify avalue formaxExclusive other than{value}.

4.3.8.2 XML Representation of maxExclusive Schema Components

The XML representation for amaxExclusive schemacomponent is a<maxExclusive> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{fixed}Theactual value of thefixed[attribute], if present, otherwise false
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.8.3 maxExclusive Validation Rules
Validation Rule: maxExclusive Valid
A value in an·ordered· ·value space·is facet-valid with respect to·maxExclusive·, determinedas follows:
1 if the·numeric· property in{fundamental facets} istrue, then thevalue·must· be numerically less than{value};
2 if the·numeric· property in{fundamental facets} isfalse (i.e.,{base type definition} is one of the date and time relateddatatypes), then the value·must· be chronologicallyless than{value};
4.3.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 valuespecified for·maxExclusive· for the same datatype.
Schema Component Constraint: maxExclusive valid restriction
It is an·error· if any of the following conditionsis true:
1maxExclusive is among the members of{facets} of{base type definition}and{value} isgreater than the{value} of the parentmaxExclusive
2maxInclusive is among the members of{facets} of{base type definition}and{value} isgreater than the{value} of the parentmaxInclusive
3minInclusive is among the members of{facets} of{base type definition}and{value} isless than or equal to the{value} of the parentminInclusive
4minExclusive is among the members of{facets} of{base type definition}and{value} isless than or equal to the{value} of the parentminExclusive

4.3.9 minExclusive

[Definition:]  minExclusive is the·exclusive lower bound·of the·value space· for a datatype with the·ordered· property.The value ofminExclusive ·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 to100, 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 tothe previous one (named 'one-hundred-or-more').
4.3.9.1 The minExclusive Schema Component

If{fixed} istrue, then types for whichthe current type is the{base type definition} cannot specify avalue forminExclusive other than{value}.

4.3.9.2 XML Representation of minExclusive Schema Components

The XML representation for aminExclusive schemacomponent is a<minExclusive> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{fixed}Theactual value of thefixed[attribute], if present, otherwise false
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.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{fundamental facets} istrue, then thevalue·must· be numerically greater than{value};
2 if the·numeric· property in{fundamental facets} isfalse (i.e.,{base type definition} is one of the date and time relateddatatypes), then the value·must· be chronologicallygreater than{value};
4.3.9.4 Constraints on minExclusive Schema Components
Schema Component Constraint: minExclusive < maxInclusive
It is an·error· for the value specified for·minExclusive· to be greater than or equal to the valuespecified for·maxInclusive· for the same datatype.
Schema Component Constraint: minExclusive valid restriction
It is an·error· if any of the following conditionsis true:
1minExclusive is among the members of{facets} of{base type definition}and{value} isless than the{value} of the parentminExclusive
2maxInclusive is among the members of{facets} of{base type definition}and{value} isgreater the{value} of the parentmaxInclusive
3minInclusive is among the members of{facets} of{base type definition}and{value} isless than the{value} of the parentminInclusive
4maxExclusive is among the members of{facets} of{base type definition}and{value} isgreater than or equal to the{value} of the parentmaxExclusive

4.3.10 minInclusive

[Definition:]  minInclusive is the·inclusive lower bound·of the·value space· for a datatype with the·ordered· property. The value ofminInclusive ·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 to100, using·minInclusive·.
<simpleType name='one-hundred-or-more'>  <restriction base='integer'>    <minInclusive value='100'/>  </restriction></simpleType>
4.3.10.1 The minInclusive Schema Component

If{fixed} istrue, then types for whichthe current type is the{base type definition} cannot specify avalue forminInclusive other than{value}.

4.3.10.2 XML Representation of minInclusive Schema Components

The XML representation for aminInclusive schemacomponent is a<minInclusive> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{fixed}Theactual value of thefixed[attribute], if present, otherwise false
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.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{fundamental facets} istrue, then thevalue·must· be numerically greater than or equal to{value};
2 if the·numeric· property in{fundamental facets} isfalse (i.e.,{base type definition} is one of the date and time relateddatatypes), then the value·must· be chronologicallygreater than or equal to{value};
4.3.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 valuespecified for·maxExclusive· for the same datatype.
Schema Component Constraint: minInclusive valid restriction
It is an·error· if any of the following conditionsis true:
1minInclusive is among the members of{facets} of{base type definition}and{value} isless than the{value} of the parentminInclusive
2maxInclusive is among the members of{facets} of{base type definition}and{value} isgreater the{value} of the parentmaxInclusive
3minExclusive is among the members of{facets} of{base type definition}and{value} isless than or equal to the{value} of the parentminExclusive
4maxExclusive is among the members of{facets} of{base type definition}and{value} isgreater than or equal to the{value} of the parentmaxExclusive

4.3.11 totalDigits

[Definition:]  totalDigitscontrols the maximum number of values inthe·value space·of datatypes·derived· fromdecimal,by restricting it to numbers that are expressible asi × 10^-n whereiandn are integers such that|i| < 10^totalDigits and0 <= n <= totalDigits.The value oftotalDigits ·must· be apositiveInteger.

The termtotalDigits is chosen to reflect the fact that itrestricts the·value space· to those values that canbe represented lexically using at mosttotalDigitsdigits. Note that it does not restrict the·lexical space·directly; a lexical representation that addsadditional leading zero digits or trailing fractional zero digits isstill permitted.

4.3.11.1 The totalDigits Schema Component

If{fixed} istrue, then types for whichthe current type is the{base type definition} cannot specify avalue fortotalDigits other than{value}.

4.3.11.2 XML Representation of totalDigits Schema Components

The XML representation for atotalDigits schemacomponent is a<totalDigits> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{fixed}Theactual value of thefixed[attribute], if present, otherwise false
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.11.3 totalDigits Validation Rules
Validation Rule: totalDigits Valid
A value in a·value space· is facet-valid withrespect to·totalDigits· if:
1 that value is expressible asi × 10^-n wherei andn are integers such that|i| < 10^{value} and0 <= n <={value}.
4.3.11.4 Constraints on totalDigits Schema Components

4.3.12 fractionDigits

[Definition:]  fractionDigitscontrols the size of the minimum differencebetween valuesin the·value space· of datatypes·derived·fromdecimal,by restricting the·value space· to numbers that areexpressible asi × 10^-n wherei andnare integers and0 <= n <= fractionDigits.The value offractionDigits ·must·be anonNegativeInteger.

The termfractionDigits is chosen to reflect the fact that itrestricts the·value space· to those values that can berepresented lexically using at mostfractionDigitsto the right of the decimal point. Note that it does not restrict the·lexical space· directly; anon-·canonical lexical representation· that adds additionalleading 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 magnitudeof 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 whichconstrain 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.3.12.1 The fractionDigits Schema Component

If{fixed} istrue, then types for whichthe current type is the{base type definition} cannot specify avalue forfractionDigits other than{value}.

4.3.12.2 XML Representation of fractionDigits Schema Components

The XML representation for afractionDigits schemacomponent is a<fractionDigits> element information item. Thecorrespondences between the properties of the information item andproperties 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}Theactual value of thevalue[attribute]
{fixed}Theactual value of thefixed[attribute], if present, otherwise false
{annotation}The annotations corresponding to all the<annotation>element information items in the[children], if any.
4.3.12.3 fractionDigits Validation Rules
Validation Rule: fractionDigits Valid
A value in a·value space· is facet-valid withrespect to·fractionDigits· if:
1 that value is expressible asi × 10^-n wherei andnare integers and0 <= n <={value}.
4.3.12.4 Constraints on fractionDigits Schema Components

5 Conformance

This specification describes two levels of conformance fordatatype processors. The first isrequired of all processors. Support for the other will depend on theapplication 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 describedinXML Representation of Simple Type Definition Schema Components (§4.1.2) (and other relevant portions ofDatatype components (§4)) are additionally said to provideconformance to the XML Representation of Schemas,and·must·, when processing schema documents, completely andcorrectly implement all·Schema Representation Constraint·sin this specification, and·must· adhere exactly to thespecifications inXML Representation of Simple Type Definition Schema Components (§4.1.2) (and other relevant portions ofDatatype components (§4)) for mappingthe contents of suchdocuments toschema componentsfor use in validation.

Note: By separating the conformance requirements relating to the concretesyntax of XML schema documents, this specification admits processorswhich validate using schemas stored in optimized binary representations,dynamically created schemas represented as programming language datastructures, or implementations in which particular schemas are compiledinto executable code such as C or Java. Such processors can be said tobe·minimally conforming·but not necessarily in·conformance tothe 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>        ]><?xml version='1.0'?><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-with-errata.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 Datatypes and Facets

C.1 Fundamental Facets

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

 Datatypeorderedboundedcardinalitynumeric
primitivestringfalsefalsecountably infinitefalse
booleanfalsefalsefinitefalse
floatpartialtruefinitetrue
doublepartialtruefinitetrue
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

D ISO 8601 Date and Time Formats

next sub-sectionD.1 ISO 8601 Conventions

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

[ISO 8601] "specifies the representation of dates in theproleptic Gregorian calendar and times and representations of periods of time".The proleptic Gregorian calendar includes dates prior to 1582 (the year it cameinto use as an ecclesiastical calendar).It should be pointed out that the datatypes described in thisspecification do not cover all the types of data covered by[ISO 8601], nor do they support all the lexicalrepresentations 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 datatypesdateTime,time,date,gYearMonth,gMonthDay,gDay,gMonth andgYear.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 arefrom 0 to 9.
  • Y -- represents a digit used in the tens and units components of the timeelement "year". Legal values are from 0 to 9.
  • M -- represents a digit used in the time element "month". The twodigits in a MM format can have values from 1 to 12.
  • D -- represents a digit used in the time element "day". The two digitsin 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 30if the month value equals 4, 6, 9 or 11, and 1 to 31 if the month valueequals 1, 3, 5, 7, 8, 10 or 12.
  • h -- represents a digit used in the time element "hour". The two digitsin a hh format can have values from 0 to24.If the value of the hour element is 24 then the values of the minuteselement and the seconds element must be 00 and 00.
  • m -- represents a digit used in the time element "minute". The two digitsin a mm format can have values from 0 to 59.
  • s -- represents a digit used in the time element "second". The twodigits in a ss format can have values from 0 to 60. In the formatsdescribed 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 isallowed only in the case of leap seconds.

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

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

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

  • T -- is used as time designator to indicate the start of therepresentation of the time of day indateTime.
  • Z -- is used as time-zone designator, immediately (without a space)following a data element expressing the time of day in CoordinatedUniversal Time (UTC) indateTime,time,date,gYearMonth,gMonthDay,gDay,gMonth, andgYear.

In the lexical format forduration the followingcharacters are also used as designators and appear as themselves inlexical formats:

  • P -- is used as the time duration designator, preceding a data elementrepresenting 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 theYear, Month, Day, Hour and Minutes components are not restricted butallow an arbitrary integer. Similarly, the value of the Seconds componentallows an arbitrary decimal. Thus, the lexical format forduration and datatypes derived from itdoes not follow the alternativeformat of § 5.5.3.2.1 of[ISO 8601].

previous sub-sectionnext sub-sectionD.2 Truncated and Reduced Formats

[ISO 8601] supports a variety of "truncated" formats inwhich some of the characters on the left of specific formats, for example,thecentury, can be omitted.Truncated formats are, ingeneral, not permitted for the datatypes defined in this specificationwith three exceptions. Thetime datatype usesa truncated format fordateTimewhich represents an instant of time that recurs every day.Similarly, thegMonthDay andgDaydatatypes use left-truncated formats fordate.The datatypegMonth uses a right and left truncated format fordate.

[ISO 8601] also supports a variety of "reduced" or right-truncatedformats in which some of the characters to the right of specific formats,such as thetime specification, can be omitted. Right truncated formats are also, ingeneral,not permitted for the datatypes defined in this specificationwith the following exceptions:right-truncated representations ofdateTime are used aslexical representations fordate,gMonth,gYear.

previous sub-sectionD.3 Deviations from ISO 8601 Formats

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

D.3.1 Sign Allowed

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

D.3.2 No Year Zero

The year "0000" is an illegal year value.

D.3.3 More Than 9999 Years

To accommodate year values greater than 9999, more than four digits areallowed in the year representations ofdateTime,date,gYearMonth, andgYear.This follows[ISO 8601:2000 Second Edition].

D.3.4 Time zone permitted

The lexical representations for the datatypesdate,gYearMonth,gMonthDay,gDay,gMonth andgYear permit an optionaltrailing time zone specificiation.

E Adding durations to dateTimes

Given adateTime S and aduration D, thisappendix specifies how to compute adateTime E where E is theend of the time period with start S and duration D i.e. E = S + D. Suchcomputations are used, for example, to determine whether adateTimeis within a specific time period. This appendix also addresses the addition ofdurations to the datatypesdate,gYearMonth,gYear,gDay andgMonth, which can be viewed as a set ofdateTimes.In such cases, the addition is made to the first or startingdateTime in the set.

This is a logical explanation of the process.Actual implementations are free to optimize as long as they produce the sameresults. The calculation uses the notation S[year] to represent the yearfield of S, S[month] to represent the month field, and so on. It also depends onthe 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-sectionE.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 ispinned to be within range. Thus April31 turns into April 30. Then the <day,hour,minute,second> is added. Thislatter 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 60seconds in S is treated as if it were a duration of 60 seconds added to S(with a zero seconds field). All calculationsthereafter use 60 seconds per minute.

Thus the addition of either PT1M or PT60S to any dateTime will alwaysproduce the same result. This is a special definition of addition whichis designed to match common practice, and -- most importantly -- be stableover time.

A definition that attempted to take leap-seconds into account would need tobe constantly updated, and could not predict the results of futureimplementation's additions. The decision to introduce a leap second in UTCis the responsibility of the[International Earth Rotation Service (IERS)]. They make periodicannouncements as to whenleap seconds are to be added, but this is not known more than a year inadvance. 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 inthe same order. If a field in D is not specified, it is treated as if it werezero. If a field in S is not specified, it is treated in the calculation as ifit were the minimum allowed value in that field, however, after the calculationis 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
      • IFE[day] < 1
        • E[day] := E[day] + maximumDayInMonthFor(E[year], E[month] - 1)
        • carry := -1
      • ELSE IFE[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-sectionE.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 instantsis 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

F Regular Expressions

A·regular expression· R is a sequence ofcharacters that denote aset of strings L(R).When used to constrain a·lexical space·, aregular expression R asserts that only stringsinL(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· fromstring suchthat all values must begin with the characterA (#x41) and end with the characterZ (#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 willachieve the desired results. For example, a datatype·derived· from string such that all values must contain at least 3 consecutiveA (#x41) characters somewhere within the value could be defined as follows:

<simpleType name='myString'> <restriction base='string'>  <pattern value='.*AAA.*'/> </restriction></simpleType>

[Definition:]  Aregular expression is composed from zero or more·branch·es, separated by| characters.

[1]   regExp   ::=   branch( '|'branch )*

For all·branch·esS, and for all·regular expression·sT, valid·regular expression·sR are:Denoting the set of stringsL(R) containing:
(empty string)the set containing just the empty string
Sall strings inL(S)
S|Tall strings inL(S) and all strings inL(T)

[Definition:]  Abranch consistsof zero or more·piece·s, concatenated together.

[2]   branch   ::=   piece*

For all·piece·sS, and for all·branch·esT, valid·branch·esR are:Denoting the set of stringsL(R) containing:
Sall strings inL(S)
STall stringsst withs inL(S) andt inL(T)

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

[3]   piece   ::=   atom quantifier?

For all·atom·sS and non-negativeintegersn,m such thatn <= m, valid·piece·sR are:Denoting the set of stringsL(R) containing:
Sall strings inL(S)
S?the empty string, and all strings inL(S).
S* All strings inL(S?) and all stringsst withs inL(S*) andt inL(S).( all concatenations of zero or more strings from L(S) )
S+ All stringsst withs inL(S) andt inL(S*).( all concatenations of one or more strings from L(S) )
S{n,m} All stringsst withs inL(S) andt inL(S{n-1,m-1}).( Allsequences of at least n, and at most m, strings from L(S) )
S{n} All strings inL(S{n,n}).( Allsequences of exactly n strings from L(S) )
S{n,} All strings in L(S{n}S*)( Allsequences of at least n, strings from L(S) )
S{0,m} All stringsst withs inL(S?) andt inL(S{0,m-1}).( Allsequences 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 formS{,m}, since it is logically equivalent toS{0,m}.We have, therefore, left this logical possibility out of the regularexpression language defined by this specification.

[Definition:]  Aquantifieris one of?,*,+,{n,m} or{n,}, which have the meaningsdefined in the table above.

[4]   quantifier   ::=   [?*+] | ( '{'quantity '}' )
[5]   quantity   ::=   quantRange |quantMin |QuantExact
[6]   quantRange   ::=   QuantExact ','QuantExact
[7]   quantMin   ::=   QuantExact ','
[8]   QuantExact   ::=   [0-9]+

[Definition:]  Anatom is either a·normal character·, a·character class·, ora parenthesized·regular expression·.

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

For all·normal character·sc,·character class·esC, and·regular expression·sS, valid·atom·sR are:Denoting the set of stringsL(R) containing:
cthe single string consisting only ofc
Call strings inL(C)
(S)all strings inL(S)

[Definition:]  Ametacharacteris either.,\,?,*,+,{,}(,),[ or].These characters have special meanings in·regular expression·s,but can be escaped to form·atom·s that denote thesets of strings containing only themselves, i.e., an escaped·metacharacter· behaves like a·normal character·.

[Definition:]  Anormal character is any XML character that is not ametacharacter. In·regular expression·s, a normal character is anatom that denotes the singleton set of strings containing only itself.

[10]   Char   ::=   [^.\?*+()|#x5B#x5D]

Note that a·normal character· can be represented either asitself, or with acharacterreference.

F.1 Character Classes

[Definition:]  Acharacter class is an·atom· R that identifies aset of characters C(R). The set of stringsL(R) denoted by acharacter classR contains one single-character string"c" for each characterc inC(R).

[11]   charClass   ::=   charClassEsc |charClassExpr |WildcardEsc

A character class is either a·character class escape· or a·character class expression·.

[Definition:]  Acharacter class expression is a·character group· surroundedby[ and] characters. For all charactergroupsG, [G] is a validcharacter classexpression, identifying the set of charactersC([G]) =C(G).

[12]   charClassExpr   ::=   '['charGroup ']'

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

[13]   charGroup   ::=   posCharGroup |negCharGroup |charClassSub

[Definition:]  Apositive character group consists of one or more·character range·s or·character class escape·s, concatenatedtogether. Apositive character group identifies the set ofcharacters containing all of the characters in all of the sets identifiedby its constituent ranges or escapes.

[14]   posCharGroup   ::=   (charRange |charClassEsc)+

For all·character range·sR, all·character class escape·sE, and all·positive character group·sP, valid·positive character group·sG are:Identifying the set of charactersC(G) containing:
Rall characters inC(R).
Eall characters inC(E).
RPall characters inC(R) and all characters inC(P).
EPall characters inC(E) and all characters inC(P).

[Definition:]  Anegative character group is a·positive character group· preceded by the^ character.For all·positive character group·sP, ^Pis a validnegative character group, andC(^P)contains all XML characters that arenot inC(P).

[15]   negCharGroup   ::=   '^'posCharGroup

[Definition:]  Acharacter class subtraction is a·character class expression·subtracted from a·positive character group· or·negative character group·, using the- character.

[16]   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 inC(G) that are not also inC(C).

[Definition:]  Acharacter range R identifies a set ofcharactersC(R) containing all XML characters with UCScode points in a specified range.

[17]   charRange   ::=   seRange |XmlCharIncDash
[18]   seRange   ::=   charOrEsc '-'charOrEsc
[20]   charOrEsc   ::=   XmlChar |SingleCharEsc
[21]   XmlChar   ::=   [^\#x2D#x5B#x5D]
[22]   XmlCharIncDash   ::=   [^\#x5B#x5D]

A single XML character is a·character range· that identifiesthe set of characters containing only itself. All XML characters are validcharacter ranges, except as follows:

Note: The grammar for·character range· asgiven above is ambiguous, but the second and third bullets abovetogether remove the ambiguity.

A·character range· ·may· also be writtenin the forms-e, identifying the set that contains all XML characterswith UCS code points greater than or equal to the code pointofs, but not greater than the code point ofe.

s-e is a valid character range iff:

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

F.1.1 Character Class Escapes

[Definition:]  Acharacter class escape is a short sequence of charactersthat identifies predefined character class. The valid characterclass escapes are the·single character escape·s, the·multi-character escape·s, and the·category escape·s (includingthe·block escape·s).

[23]   charClassEsc   ::=   (SingleCharEsc |MultiCharEsc |catEsc |complEsc)

[Definition:]  Asingle character escape identifies a set containing a onlyone character -- usually because that character is difficult orimpossible to write directly into a·regular expression·.

[24]   SingleCharEsc   ::=   '\' [nrt\|.?*+(){}#x2D#x5B#x5D#x5E]

The valid·single character escape·s are:Identifying the set of charactersC(R) containing:
\nthe newline character (#xA)
\rthe return character (#xD)
\tthe tab character (#x9)
\\\
\||
\..
\--
\^^
\??
\**
\++
\{{
\}}
\((
\))
\[[
\]]

[Definition:]  [Unicode Database] specifies a number of possiblevalues for the "General Category" propertyand provides mappings from code points to specific character properties.The set containing all characters that have propertyX,can be identified with acategory escape\p{X}.The complement of this set is specified with thecategory escape\P{X}.([\P{X}] =[^\p{X}]).

[25]   catEsc   ::=   '\p{'charProp '}'
[26]   complEsc   ::=   '\P{'charProp '}'
[27]   charProp   ::=   IsCategory |IsBlock
Note: [Unicode Database] is subject to future revision. For example, themapping 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 W3CRecommendation. However, implementors are encouraged to support thecharacter 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
[28]   IsCategory   ::=   Letters |Marks |Numbers |Punctuation |Separators |Symbols |Others
[29]   Letters   ::=   'L' [ultmo]?
[30]   Marks   ::=   'M' [nce]?
[31]   Numbers   ::=   'N' [dlo]?
[32]   Punctuation   ::=   'P' [cdseifo]?
[33]   Separators   ::=   'Z' [slp]?
[34]   Symbols   ::=   'S' [mcko]?
[35]   Others   ::=   'C' [cfon]?
Note: The properties mentioned above exclude theCs property.TheCs property identifies "surrogate" characters, which do notoccur at the level of the "character abstraction" that XML instance documentsoperate on.

[Definition:]  [Unicode Database] groups code points into a number of blockssuch as Basic Latin (i.e., ASCII), Latin-1 Supplement, Hangul Jamo,CJK Compatibility, etc.The set containing all characters that have block nameX(with all white space stripped out),can be identified with ablock escape\p{IsX}.The complement of this set is specified with theblock escape\P{IsX}.([\P{IsX}] =[^\p{IsX}]).

[36]   IsBlock   ::=   'Is' [a-zA-Z0-9#x2D]+

The following table specifies the recognized block names (for moreinformation, 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 theHighSurrogates,LowSurrogates andHighPrivateUseSurrogates blocks.These blocks identify "surrogate" characters, which do notoccur at the level of the "character abstraction" that XML instance documentsoperate on.
Note: [Unicode Database] is subject to future revision.For example, thegrouping 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 W3CRecommendation. However, implementors are encouraged to support theblocks defined in any future version of the Unicode Standard.

For example, the·block escape· for identifying theASCII characters is\p{IsBasicLatin}.

[Definition:]  Amulti-character escape provides a simple way to identifya commonly used set of characters:

[37]   MultiCharEsc   ::=   '\' [sSiIcCdDwW]
[37a]   WildcardEsc   ::=   '.'

Character sequenceEquivalent·character class·
.[^\n\r]
\s[#x20\t\n\r]
\S[^\s]
\ithe set of initial name characters, those·match·ed byLetter | '_' | ':'
\I[^\i]
\cthe set of name characters, those·match·ed byNameChar
\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 notattempt to provide a general solution to "regular expressions" overUCS character sequences. In particular, it does not easily providefor 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 thisspecification will provide support for "Level 2" features.

G Glossary (non-normative)

The listing below is for the benefit of readers of a printed version of thisdocument: it collects together all the definitions which appear in thedocument above.

atomic
Atomic datatypesare those having values which are regarded by this specification asbeing indivisible.
base type
Everydatatype that is·derived· byrestrictionis defined in terms of an existing datatype, referred to as itsbase type.base types can be either·primitive· or·derived·.
bounded
A datatype isboundedif 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-indatatypes are those which are defined in this specification,and can be either·primitive· or·derived·;
canonical lexical representation
Acanonical lexical representationis a set of literals from among the valid set of literalsfor a datatype such that there is a one-to-one mapping between literalsin thecanonical lexical representation andvalues in the·value space·.
cardinality
Every·value space· has associated with it the concept ofcardinality. Some·value space·sare finite, some are countably infinite while still others couldconceivably be uncountably infinite (although no·value space·defined by this specification is uncountable infinite). A datatype issaid to have the cardinality of its·value space·.
comparable
otherwise they arecomparable.
conformance to the XML Representation of Schemas
Processors which accept schemas in the form of XML documents as describedinXML Representation of Simple Type Definition Schema Components (§4.1.2) (and other relevant portions ofDatatype components (§4)) are additionally said to provideconformance to the XML Representation of Schemas,and·must·, when processing schema documents, completely andcorrectly implement all·Schema Representation Constraint·sin this specification, and·must· adhere exactly to thespecifications inXML Representation of Simple Type Definition Schema Components (§4.1.2) (and other relevant portions ofDatatype components (§4)) for mappingthe contents of suchdocuments toschema componentsfor use in validation.
constraining facet
Aconstraining facet is an optional property that can beapplied to a datatype to constrain its·value space·.
Constraint on Schemas
Constraint on Schemas
datatype
In this specification,adatatype is a 3-tuple, consisting ofa) 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·sthat characterize properties of the·value space·,individual values or lexical items.
derived
Deriveddatatypes are those that are defined in terms of other datatypes.
error
error
exclusive lower bound
A valuel in an·ordered· ·value space· Lis said to be anexclusive lower bound of a·value space· V(whereV is a subset ofL)if for allv inV,l <v.
exclusive upper bound
A valueu in an·ordered· ·value space· Uis said to be anexclusive upper bound of a·value space· V(whereV is a subset ofU)if for allv inV,u >v.
facet
Afacet is a singledefining aspect of a·value space·. Generallyspeaking, each facet characterizes a·value space·along independent axes or dimensions.
for compatibility
for compatibility
fundamental facet
Afundamental facet is an abstract property whichserves to semantically characterize the values in a·value space·.
inclusive lower bound
A valuel in an·ordered· ·value space· Lis said to be aninclusive lower bound of a·value space· V(whereV is a subset ofL)if for allv inV,l <=v.
inclusive upper bound
A valueu in an·ordered· ·value space· Uis said to be aninclusive upper bound of a·value space· V(whereV is a subset ofU)if for allv inV,u >=v.
incomparable
Whena <> b,a andb areincomparable,
itemType
The·atomic· or·union·datatype that participates in the definition of a·list· datatypeis known as theitemType of that·list· datatype.
lexical space
Alexical space is the set of validliteralsfor a datatype.
list
Listdatatypes are those having values each of which consists of afinite-length (possibly empty) sequence of values of an·atomic· datatype.
match
match
may
may
memberTypes
The datatypes that participate in thedefinition of a·union· datatype are known as thememberTypes of that·union· datatype.
minimally conforming
Minimally conforming processors·must·completely and correctly implement the·Constraint on Schemas· and·Validation Rule·.
must
must
non-numeric
A datatype whose valuesare not·numeric· is said to benon-numeric.
numeric
A datatype is said to benumeric if its values are conceptually quantities (in somemathematical number system).
order-relation
Anorder relation on a·value space·is a mathematical relation that imposes a·total order· or a·partial order· on themembers of the·value space·.
ordered
A·value space·, and hence a datatype, is said to beordered if there exists an·order-relation· defined for that·value space·.
partial order
Apartial order is an·order-relation·that isirreflexive,asymmetric andtransitive.
primitive
Primitivedatatypes are those that are not defined in terms of other datatypes;they existab initio.
regular expression
Aregular expression is composed from zero or more·branch·es, separated by| characters.
restriction
A datatype is said to be·derived· byrestriction from another datatypewhen values for zero or more·constraining facet·s are specifiedthat 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
total order
Atotal order is an·partial order·such that for noa andbis it the case thata <> b.
union
Uniondatatypes are those whose·value space·s and·lexical space·s are the union ofthe·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.
Validation Rule
Validation Rule
value space
Avaluespace is the set of values for a given datatype.Each value in thevalue space of a datatype is denoted byone or more literals in its·lexical space·.

H References

next sub-sectionH.1 Normative

Clinger, WD (1990)
William D Clinger.How to Read Floating Point Numbers Accurately.InProceedings of Conference on Programming Language Design andImplementation, 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.Seehttp://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/1999/REC-xml-names-19990114/
RFC 1766
H. Alvestrand, ed.RFC 1766: Tags for the Identification of Languages1995. Available at:http://www.ietf.org/rfc/rfc1766.txt
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
RFC2732: 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 Languages1995. 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 1.0 (Second Edition)
World Wide Web Consortium.Extensible Markup Language (XML) 1.0, SecondEdition.Available at:http://www.w3.org/TR/2000/WD-xml-2e-20000814
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 inSection 5.4 is normatively referenced.
XML Schema Part 1: Structures
XML Schema Part 1: Structures. Available at:http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html
XML Schema Requirements
World Wide Web Consortium. XML Schema Requirements. Available at:http://www.w3.org/TR/1999/NOTE-xml-schema-req-19990215

previous sub-sectionH.2 Non-normative

Character Model
Martin J. Dürst and François Yergeau, eds.Character Model for the World Wide Web. World Wide Web ConsortiumWorking Draft. 2001.Available at:http://www.w3.org/TR/2001/WD-charmod-20010126/
Gay, DM (1990)
David M. Gay.Correctly Rounded Binary-Decimal andDecimal-Binary Conversions. AT&T Bell Laboratories NumericalAnalysis 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 Identifiers2002. Available at:http://www.w3.org/International/iri-edit/draft-duerst-iri-04.txt
International Earth Rotation Service (IERS)
International Earth Rotation Service (IERS).Seehttp://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. Seehttp://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/WD-ruby-20010216/
SQL
ISO (International Organization for Standardization).ISO/IEC9075-2:1999, Information technology --- Database languages ---SQL --- Part 2: Foundation (SQL/Foundation).[Geneva]: International Organization for Standardization, 1999.Seehttp://www.iso.ch/cate/d26197.html
U.S. Naval Observatory Time Service Department
Information about Leap SecondsAvailable 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/REC-xmlschema-0-20041028/primer.html
XSL
World Wide Web Consortium.Extensible Stylesheet Language (XSL).Available at:http://www.w3.org/TR/2000/CR-xsl-20001121/

I Acknowledgements (non-normative)

The following have contributed material to the first edition of this specification:

Asir S. Vedamuthu, webMethods, Inc
Mark Davis, IBM

Co-editor Ashok Malhotra's work on this specification from March 1999 untilFebruary 2001 was supported by IBM. From February 2001 until May 2004 itwas supported by Microsoft.

The editors acknowledge the members of the XML Schema Working Group, the members of other W3C Working Groups, and industry experts in otherforums who have contributed directly or indirectly to the process or content ofcreating this document. The Working Group is particularly grateful to LotusDevelopment Corp. and IBM for providing teleconferencing facilities.

At the time the first edition of thisspecification was published, the members of the XML Schema Working Group were:

The XML Schema Working Group has benefited in its work from theparticipation and contributions of a number of people not currentlymembers of the Working Group, includingin particular those named below. Affiliations given are those current atthe time of their work with the WG.

The lists given above pertain to the first edition.At the time work on this second edition was completed,the membership of the Working Group was:

We note with sadness the accidental death of Mario Jeckleshortly after the completion of work on this document. In addition to those named above, severalpeople served on the Working Group during the developmentof this second edition:


[8]
ページ先頭

©2009-2025 Movatter.jp