W3C

XML Schema Part 2: Datatypes

W3C Candidate Recommendation 24 October 2000

This version:
http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/
(in XML and HTML, with a schema and DTD including datatype definitions, as well as a schema for built-in datatypes only, in a separate namespace.)
Latest version:
http://www.w3.org/TR/xmlschema-2/
Previous version:
http://www.w3.org/TR/2000/WD-xmlschema-2-20000922/
Editors:
Paul V. Biron (Kaiser Permanente, for Health Level Seven) <Paul.V.Biron@kp.org>
Ashok Malhotra (IBM) <petsa@us.ibm.com>

Copyright ©1999-2000 W3C® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply.


Abstract

XML Schema: Datatypes is part 2 of the specification of the XML Schema language. It defines facilities for defining datatypes to be used specifications. The datatype language, which is itself represented in XML 1.0, provides a superset of the capabilities found in XML 1.0 document type definitions (DTDs) for specifying datatypes on elements and attributes.

Status of this document

This specification of the XML Schema language is a Candidate Recommendation of the World Wide Web Consortium. This means that the XML Schema Working Groupconsiders the specification to be stable and encourages implementation and comment on the specification during this period. The Candidate Recommendation review period ends on 15 December 2000. Please send review comments before the review period ends to www-xml-schema-comments@w3.org (public mailing list archive).

During the Candidate Recommendation phase, although feedback based on any aspect of implementation experience is welcome, there are certain aspects of the design presented herein for which the Working Group is particularly interested in feedback. These are designated priority feedback aspects of the design, and identified as such in editorial notes throughout this draft.

Should this specification prove very difficult or impossible to implement, the Working Group will return the document to Working Draft status and make necessary changes. Otherwise, the Working Group anticipates asking the W3C Director to advance this document to Proposed Recommendation.

This document has been produced as part of the W3C XML Activity. The authors of this document are the XML Schema WG members. Different parts of this specification have different editors.

A list of current W3C working drafts can be found at http://www.w3.org/TR/. They may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress".

Several "note types" are used throughout this draft:

issue [Issue (issue-name): ]
something on which the editors are seeking comment.
editorial note [Ed. Note: ]
something the editors wish to call to the attention of the reader. To be removed prior to the recommendation becoming final.
note [Note: ]
something the editors wish to call to the attention of the reader. To remain in the final recommendation as non-normative text.

Table of contents

1 Introduction
    1.1 Purpose
    1.2 Requirements
    1.3 Scope
    1.4 Terminology
    1.5 Constraints and Contributions
2 Type System
    2.1 Datatype
    2.2 Value space
    2.3 Lexical space
        2.3.1 Canonical Lexical Representation
    2.4 Facets
        2.4.1 Fundamental facets
        2.4.2 Constraining or Non-fundamental facets
    2.5 Datatype dichotomies
        2.5.1 Atomic vs. list vs. union datatypes
        2.5.2 Primitive vs. derived datatypes
        2.5.3 Built-in vs. user-derived datatypes
3 Built-in datatypes
    3.1 Namespace considerations
    3.2 Primitive datatypes
        3.2.1 string
        3.2.2 boolean
        3.2.3 float
        3.2.4 double
        3.2.5 decimal
        3.2.6 timeDuration
        3.2.7 recurringDuration
        3.2.8 binary
        3.2.9 uriReference
        3.2.10 ID
        3.2.11 IDREF
        3.2.12 ENTITY
        3.2.13 QName
    3.3 Derived datatypes
        3.3.1 CDATA
        3.3.2 token
        3.3.3 language
        3.3.4 IDREFS
        3.3.5 ENTITIES
        3.3.6 NMTOKEN
        3.3.7 NMTOKENS
        3.3.8 Name
        3.3.9 NCName
        3.3.10 NOTATION
        3.3.11 integer
        3.3.12 nonPositiveInteger
        3.3.13 negativeInteger
        3.3.14 long
        3.3.15 int
        3.3.16 short
        3.3.17 byte
        3.3.18 nonNegativeInteger
        3.3.19 unsignedLong
        3.3.20 unsignedInt
        3.3.21 unsignedShort
        3.3.22 unsignedByte
        3.3.23 positiveInteger
        3.3.24 timeInstant
        3.3.25 time
        3.3.26 timePeriod
        3.3.27 date
        3.3.28 month
        3.3.29 year
        3.3.30 century
        3.3.31 recurringDate
        3.3.32 recurringDay
4 Datatype components
    4.1 Datatype definition
    4.2 Constraining facets
        4.2.1 length
        4.2.2 minLength
        4.2.3 maxLength
        4.2.4 pattern
        4.2.5 enumeration
        4.2.6 whiteSpace
        4.2.7 maxInclusive
        4.2.8 maxExclusive
        4.2.9 minExclusive
        4.2.10 minInclusive
        4.2.11 precision
        4.2.12 scale
        4.2.13 encoding
        4.2.14 duration
        4.2.15 period
5 XML representation of datatype definitions
    5.1 XML representation of datatype definitions
        5.1.1 Derivation by restriction
        5.1.2 Derivation by list
        5.1.3 Derivation by union
    5.2 Constraining facets
        5.2.1 length
        5.2.2 minLength
        5.2.3 maxLength
        5.2.4 pattern
        5.2.5 enumeration
        5.2.6 whiteSpace
        5.2.7 maxInclusive
        5.2.8 maxExclusive
        5.2.9 minInclusive
        5.2.10 minExclusive
        5.2.11 precision
        5.2.12 scale
        5.2.13 encoding
        5.2.14 duration
        5.2.15 period
6 Conformance

Appendices

A Schema for Datatype Definitions (normative)
B DTD for Datatype Definitions (non-normative)
C Datatypes and Facets
    C.1 Fundamental Facets
    C.2 Constraining Facets
D ISO 8601 Date and Time Formats
    D.1 ISO 8601 Conventions
    D.2 Truncated and Reduced Formats
    D.3 Deviations from ISO 8601 Formats
        D.3.1 Sign Allowed
        D.3.2 No Year Zero
        D.3.3 More Than 9999 Years
E Regular Expressions
    E.1 Character Classes
        E.1.1 Character Class Escapes
F References
    F.1 Normative
    F.2 Non-normative
G Acknowledgements (non-normative)
H Revisions from Previous Draft

1 Introduction

1.1 Purpose

The [XML 1.0 Recommendation (Second Edition)] specification defines limited facilities for applying datatypes to document content in that documents may contain or refer to DTDs that assign types to elements and attributes. However, document authors, including authors of traditional documents and those transporting data in XML, often require a higher degree of type checking to ensure robustness in document understanding and data interchange.

The table below offers two typical examples of XML instances in which datatypes are implicit: the instance on the left represents a billing invoice, the instance on the right a memo or perhaps an email message in XML.

Data orientedDocument oriented
<invoice>
   <orderDate>1999-01-21</orderDate>
   <shipDate>1999-01-25</shipDate>
   <billingAddress>
      <name>Ashok Malhotra</name>
      <street>123 IBM Ave.</street>
      <city>Hawthorne</city>
      <state>NY</state>
      <zip>10532-0000</zip>
   </billingAddress>
   <voice>555-1234</voice>
   <fax>555-4321</fax>
</invoice>
<memo importance='high'
      date='1999-03-23'>
   <from>Paul V. Biron</from>
   <to>Ashok Malhotra</to>
   <subject>Latest draft</subject>
   <body>
      We need to discuss the latest
      draft <emph>immediately</emph>.
      Either email me at <email>
      mailto:paul.v.biron@kp.org</email>
      or call <phone>555-9876</phone>
   </body>
</memo>

The invoice contains several dates and telephone numbers, the postal abbreviation for a state (which comes from an enumerated list of sanctioned values), and a ZIP code (which takes a definable regular form). The memo contains many of the same types of information: a date, telephone number, email address and an "importance" value (from an enumerated list, such as "low", "medium" or "high"). Applications which process invoices and memos need to raise exceptions if something that was supposed to be a date or telephone number does not conform to the rules for valid dates or telephone numbers.

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

1.2 Requirements

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

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

1.3 Scope

This portion of the XML Schema Language discusses datatypes that can be used in an XML Schema. These datatypes can be specified for element content that would be specified as #PCDATA and attribute values of various types in a DTD. It is the intention of this specification that it be usable outside of the context of XML Schemas for a wide range of other XML-related activities such as [XSL] and [RDF Schema].

1.4 Terminology

The terminology used to describe XML Schema Datatypes is defined in the body of this specification. The terms defined in the following list are used in building those definitions and in describing the actions of a datatype processor:

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

1.5 Constraints and Contributions

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

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

2 Type System

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

The datatypes discussed in this specification are computer representations of well known abstract concepts such as integer and date. It is not the place of this specification to define these abstract concepts; many other publications provide excellent definitions.

2.1 Datatype

[Definition:]  In this specification, a datatype is a 3-tuple, consisting of a) a set of distinct values, called its value space, b) a set of lexical representations, called its lexical space, and c) a set of facets that characterize properties of the value space, individual values or lexical items.

2.2 Value space

[Definition:]  A value space is the set of values for a given datatype. Each value in the value space of a datatype is denoted by one or more literals in its lexical space.

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

value spaces have certain properties. For example, they always have the property of cardinality, some definition of equality and might be ordered, by which individual values within the value space can be compared to one another. The properties of value spaces that are recognized by this specification are defined in Fundamental facets (§2.4.1).

2.3 Lexical space

In addition to its value space, each datatype also has a lexical space.

[Definition:]  A lexical space is the set of valid literals for a datatype.

For example, "100" and "1.0E2" are two different literals from the lexical space of float which both denote the same value. The type system defined in this specification provides a mechanism for schema designers to control the set of values and the corresponding set of acceptable literals of those values for a datatype.

NOTE: The literals in the lexical spaces defined in this specification have the following characteristics:
Interoperability:
The number of literals for each value has been kept small; for many datatypes 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 will be required on both the originator and the recipient side, both for computer 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 common programming 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. The example in the previous section showed two literals for the datatype float which denote the same value. Similarly, there may be several literals for one of the date or time datatypes that denote the same value using different timezone indicators.

[Definition:]  A canonical lexical representation is a set of literals from among the valid set of literals for a datatype such that there is a one-to-one mapping between literals in the canonical lexical representation and values in the value space.

2.4 Facets

[Definition:]  A facet is a single defining aspect of a value space. Generally speaking, each facet characterizes a value space along independent axes or dimensions.

The facets of a datatype serve to distinguish those aspects of one datatype which differ from other datatypes. Rather than being defined solely in terms of a prose description the datatypes in this specification are defined in terms of the synthesis of facet values which together determine the value space and properties of the datatype.

Facets are of two types: fundamental facets that define the datatype and non-fundamental or constraining facets that constrain the permitted values of a datatype.

2.4.1 Fundamental facets

[Definition:]   A fundamental facet is an abstract property which serves to semantically characterize the values in a value space.

These properties are discussed in this section.

2.4.1.1 Equal

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

  • for any two instances of values from the value space(a,b), either a is equal to b, denoted a = b, or a is not equal to b, denoted a != b;
  • there is no pair of instances (a, b) of values from the value space such that both a = b and a != b;
  • for every value a from the value space, a = a;
  • for any two instances (a, b) of values from the value space, a = b if and only if b = a;
  • for any three instances (a, b, c) of values from the value space, if a = b and b = c, then a = c.

On every datatype, the operation Equal is defined in terms of the equality property of the value space: for any values a, b drawn from the value space, Equal(a,b) is true if a = b, and false otherwise.

By definition, given value space  A and value space  B where A and B are not related by restriction, for every pair of values a from A and b from B, a != b.

2.4.1.2 Order

[Definition:]  An order relation on a value space is a mathematical relation which imposes a total order on the members of the value space.

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

order relations have the following rules:

  • for every pair (a, b) from the value space, either a < b or b < a, or a = b;
  • for every triple (a, b, c) from the value space, if a < b and b < c, then a < c.
NOTE: The fact that this specification does not define an order-relation for some datatype does not mean that some other application cannot treat that datatype as being ordered.
2.4.1.3 Bounds

[Definition:]   A value space is bounded above if there exists a unique value U in the value space such that, for all values v in the value space, v <= U. [Definition:]   The value U is said to be an upper bound of the value space.

[Definition:]  A value space is bounded below if there exists a unique value L in the space such that, for all values v in the value space, L <= v. [Definition:]   The value L is then said to be a lower bound of the value space.

[Definition:]  A datatype is bounded if its value space has both an upper bound and a lower bound.

2.4.1.4 Cardinality

[Definition:]  Every value space has associated with it the concept of cardinality. Some value spaces are finite, some are countably infinite while still others are uncountably infinite. A datatype is said to have the cardinality of its value space.

It is sometimes useful to categorize value spaces (and hence, datatypes) as to their cardinality. There are two significant cases:

2.4.1.5 Numeric

[Definition:]  A datatype is said to be numeric if its values are conceptually quantities (in some mathematical number system).

[Definition:]  A datatype whose values are not numeric is said to be non-numeric.

2.4.2 Constraining or Non-fundamental facets

[Definition:]  A constraining facet is an optional property that can be applied to a datatype to constrain its value space.

Constraining the value space consequently constrains the lexical space. Adding constraining facets to a base type is described in Derivation by restriction (§5.1.1).

In this section we define all constraining facets that are available for use when defining derived datatypes.

2.4.2.1 length

[Definition:]  length is the number of units of length, where units of length varies depending on the type that is being derived from. The value of length must be a nonNegativeInteger.

For string and datatypes derived from string, length is measured in units of characters as defined in [XML 1.0 Recommendation (Second Edition)]. For binary and datatypes derived from binary, length is measured in octets (8 bits) of binary data. For datatypes derived by list, length is measured in list items.

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

[Definition:]  minLength is the minimum number of units of length, where units of length varies depending on the type that is being derived from. The value of minLength  must be a nonNegativeInteger.

For string and datatypes derived from string, minLength is measured in units of characters as defined in [XML 1.0 Recommendation (Second Edition)]. For binary and datatypes derived from binary, minLength is measured in octets (8 bits) of binary data. For datatypes derived by list, minLength is measured in list items.

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

[Definition:]  maxLength is the maximum number of units of length, where units of length varies depending on the type that is being derived from. The value of maxLength  must be a nonNegativeInteger.

For string and datatypes derived from string, maxLength is measured in units of characters as defined in [XML 1.0 Recommendation (Second Edition)]. For binary and datatypes derived from binary, maxLength is measured in octets (8 bits) of binary data. For datatypes derived by list, maxLength is measured in list items.

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

[Definition:]  pattern is a constraint on the value space of a datatype which is achieved by constraining the lexical space to literals which match a specific pattern. The value of pattern  must be a regular expression.

2.4.2.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 that from which it is derived.

2.4.2.6 whiteSpace

[Definition:]  whiteSpace constrains the value space of types derived from string such that the various behaviors specified in Attribute Value Normalization in [XML 1.0 Recommendation (Second Edition)] are realized. The value of whiteSpace must be one of {preserve, replace, collapse}.

preserve
No normalization is done, the value is not changed (this is the behavior required by [XML 1.0 Recommendation (Second Edition)] for element content)
replace
All occurrences of #x9 (tab), #xA (linefeed) and #xD (carriage return) are replaced with #x20 (space)
collapse
After the processing implied by replace, contiguous sequences of #x20's are collapsed to a single #x20, and leading and trailing #x20's are removed.
NOTE: The notation #xA used here (and elsewhere in this specification) represents the Universal Code Set (UCS) code point hexidecimal A (linefeed), which is denoted by U+000A in [Unicode3]. This notation is to be distinguished from &#xA;, which is the XML character reference to that same UCS code point.

whiteSpace is applicable to all atomic and list datatypes. For all atomic datatypes other than string (and types derived by restriction from it) the value of whiteSpace is collapse and cannot be changed by a schema author; for string the value of whiteSpace is preserve; for any type derived by restriction from string the value of whiteSpace can be any of the three legal values. For all datatypes derived by list the value of whiteSpace is collapse and cannot be changed by a schema author. For all datatypes derived by union  whiteSpace does not apply directly; however, the normalization behavior of union types is controlled by the value of whiteSpace on that one of the memberTypes against which the union is successfully validated.

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

[Definition:]  maxInclusive is the upper bound of the value space for a datatype with the ordered property. The value is inclusive in the sense that the value is itself included in the value space. The value of maxInclusive must be of the same type as the base type.

2.4.2.8 maxExclusive

[Definition:]  maxExclusive is the upper bound of the value space for a datatype with the ordered property. The value is exclusive in the sense that the value is itself excluded from the value space. The value of maxExclusive must be of the same type as the base type.

2.4.2.9 minInclusive

[Definition:]  minInclusive is the lower bound of the value space for a datatype with the ordered property. The value is inclusive in the sense that the value is itself included in the value space. The value of minInclusive must be of the same type as the base type.

2.4.2.10 minExclusive

[Definition:]  minExclusive is the lower bound of the value space for a datatype with the ordered property. The value is exclusive in the sense that the value is itself excluded from the value space for the datatype. The value of minExclusive must be of the same type as the base type.

2.4.2.11 precision

[Definition:]  precision is the maximum number of decimal digits in values of datatypes derived from decimal. The value of precision must be a positiveInteger.

2.4.2.12 scale

[Definition:]  scale is the maximum number of decimal digits in the fractional part of values of datatypes derived from decimal. The value of scale  must be a nonNegativeInteger .

2.4.2.13 encoding

[Definition:]  encoding is the encoded form of the lexical space of datatypes derived from binary. The value of encoding must be one of {hex, base64}.

If the value of encoding is hex then each binary octet is encoded as a character tuple, consisting the two hexadecimal digits ([0-9a-fA-F]) representing the octet code. For example, "0FB7" is the hex encoding for the 16-bit integer 4023 (whose binary representation is 111110110111).

If the value of encoding is base64 then the entire binary stream is encoding using the Base64 Content-Transfer-Encoding defined in Section 6.8 [RFC 2045].

2.4.2.14 duration

[Definition:]  duration is the duration of values for the datatype recurringDuration and datatypes derived from recurringDuration. The value of duration  must be a timeDuration.

2.4.2.15 period

[Definition:]  period is the frequency of recurrence for values for the datatype recurringDuration and datatypes derived from recurringDuration. The value of period  must be timeDuration.

2.5 Datatype dichotomies

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

2.5.1 Atomic vs. list vs. union datatypes

Ed. Note: I know, now this is a trichotomy and not a dichotomy...hopefully no one will be picky enough to complain

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

For example, a single token which matches Nmtoken from [XML 1.0 Recommendation (Second Edition)] could be the value of an atomic datatype (NMTOKEN); while a sequence of such tokens could be the value of a list datatype (NMTOKENS).

2.5.1.1 Atomic datatypes

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

2.5.1.2 List datatypes

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

list datatypes are always derived. The value space of a list datatype is a set of finite-length sequences of atomic values. The lexical space of a list datatype is a set of literals whose internal structure is a whitespace separated sequence of literals of the atomic datatype of the items in the list (where whitespace matches S in [XML 1.0 Recommendation (Second Edition)]).

[Definition:]   The atomic datatype that participates in the definition of a list datatype is known as the itemType of that list datatype.

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

A list datatype can be derived from an atomic datatype whose lexical space allows whitespace. In such a case, regardless of the input, list items will be separated at whitespace boundaries.

Example
<simpleType name='listOfString'>
  <list itemType='string'/>
</simpleType>
<someElement xsi:type='listOfString'>
this is not list item 1
this is not list item 2
this is not list item 3
</someElement>
In the above example, the value of the someElement element is not a list of length 3; rather, it is a list of length 18.

When a datatype is derived from a list datatype, the following constraining facets can be used:

For each of the above facets, the unit of length is measured in number of list items.

The canonical-lexical-representation for the list datatype is defined as the lexical form in which each item in the list has the canonical lexical representation of its itemType.

2.5.1.3 Union datatypes

The value space and lexical space of a union datatype are the union of the value spaces and lexical spaces of its memberTypes. union datatypes are always derived. Currently, there are no built-in union datatypes.

Example
A prototypical example of a union type is the maxOccurs attribute on the element element in XML Schema itself: it is a union of nonNegativeInteger and an enumeration with the single member, the string "unbounded", as shown below.
  <attributeGroup name="occurs">
    <attribute name="minOccurs" type="nonNegativeInteger" use="default" value="1"/>
    <attribute name="maxOccurs">
      <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 listdatatypes can participate in a union type.

[Definition:]   The datatypes that participate in the definition of a union datatype are known as the memberTypes of that union datatype.

The order in which the memberTypes are specified in the definition (that is, the order of the <simpleType> children of the <union> element, or the order of the QNames in the memberTypes attribute) is significant. During validation, an element or attribute's value is validated against the memberTypes in the order in which they appear in the definition until a match is found. The evaluation order can be overridden with the use of xsi:type. See Datatype definition (§4.1) and XML representation of datatype definitions (§5) for more details.

Ed. Note: (PVB) Do we want to make the restriction that there has to be more than one type in a union? It was in the proposal, but I don't think it should be an error if only one appears.

Example
For example, given the definition below, the first instance of the <size> element validates correctly as an integer (§3.3.11), the second and third as string (§3.2.1).
  <xsd:element name='size'>
    <xsd:simpleType>
      <xsd:union>
        <xsd:simpleType>
          <xsd:restriction base='integer'/>
        </xsd:simpleType>
        <xsd:simpleType>
          <xsd:restriction base='string'/>
        </xsd:simpleType>
      </xsd:union>
    </xsd:simpleType>
  </xsd:element>
  <size>1</size>
  <size>large</size>
  <size xsi:type='xsd:string'>1</size>

The canonical-lexical-representation for a union datatype is defined as the lexical form in which the values have the canonical lexical representation of the appropriate memberTypes.

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

2.5.2 Primitive vs. derived datatypes

Next, we distinguish between primitive and derived datatypes.

  • [Definition:]  Primitive datatypes are those that are not defined in terms of other datatypes; they exist ab initio.
  • [Definition:]  Derived datatypes are those that are defined in terms of other datatypes.

For example, in this specification, float is a well-defined mathematical concept that cannot be defined in terms of other datatypes, while a date is a special case of the more general datatype recurringDuration.

The datatypes defined by this specification fall into both the primitive and derived categories. It is felt that a judiciously chosen set of primitive datatypes will serve the widest possible audience by providing a set of convenient datatypes that can be used as is, as well as providing a rich enough base from which the variety of datatypes needed by schema designers can be derived.

In the example above, date is derived from recurringDuration.

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

2.5.3 Built-in vs. user-derived datatypes

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

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

3 Built-in datatypes

3.1 Namespace considerations

The built-in datatypes defined by this specification are designed to be used with the XML Schema definition language as well as other XML specifications. To facilitate such usage the built-in datatypes in this specification have the namespace URI:

This applies to both built-inprimitive and built-inderived datatypes.

Each user-derived datatype is also associated with a unique namespace. However, user-derived datatypes do not come from the namespace defined by this specification; rather, they come from the namespace of the schema in which they are defined (see XML Representation of Schemas in [XML Schema Part 1: Structures]).

As described in more detail in XML representation of datatype definitions (§5.1), each user-derived datatype must be defined in terms of another datatype in one of three ways: 1) by assigning constraining facets which serve to restrict the value space of the user-derived datatype to a subset of the base type; 2) by creating a list datatype whose value space consists of finite-length sequences of values of its itemType; or 3) by creating a union datatype whose value space consists of the union of the value space its memberTypes.

3.2 Primitive datatypes

The primitive datatypes defined by this specification are described below. For each datatype, the value space and lexical space are defined, constraining facets which apply to the datatype are listed and any datatypes derived from this datatype are specified.

primitive datatypes can only be added by revisions to this specification.

3.2.1 string

[Definition:]  The string datatype represents character strings in XML. The value space of string is the set of finite-length sequences of characters (as defined in [XML 1.0 Recommendation (Second Edition)]) that match the Char production from [XML 1.0 Recommendation (Second Edition)]. A character is an atomic unit of communication; it is not further specified except to note that every character has a corresponding Universal Code Set code point ([ISO 10646], [Unicode] and [Unicode3]), which is an integer.

NOTE: As noted in Order (§2.4.1.2), the fact that this specification does not specify an order-relation for string does not preclude other applications from treating strings as being ordered.
3.2.1.1 Constraining facets

string has the following constraining facets:

3.2.1.2 Derived datatypes

The following built-in datatypes are derived from string:

3.2.2 boolean

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

3.2.2.1 Lexical Representation

An instance of a datatype that is defined as boolean can have the following legal lexical values {true, false}.

3.2.2.2 Constraining facets

boolean has the following constraining facets:

3.2.3 float

[Definition:]  float corresponds to the IEEE single-precision 32-bit floating point type [IEEE 754-1985]. The basic value space of float consists of the values m × 2^e, where m is an integer whose absolute value is less than 2^24, and e is an integer between -149 and 104, inclusive. In addition to the basic value space described above, the value space of float also contains the following special values: positive and negative zero, positive negative infinity and not-a-number. The order-relation on float is: x < y iff y - x is positive.

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

3.2.3.1 Lexical representation

float values have a lexical representation consisting of a mantissa followed, optionally, by the character "E" or "e", followed by an exponent. The exponent must be an integer. The mantissa must be a decimal number. The representations for exponent and mantissa must follow the lexical rules for integer and decimal. If the "E" or "e" and the following exponent are omitted, an exponent value of 0 is assumed.

The special values positive and negative zero, positive and negative infinity and not-a-number have 0, -0, INF, -INF and NaN, respectively.

For example, -1E4, 1267.43233E12, 12.78e-2, 12 and INF are all legal literals for float.

3.2.3.2 Canonical representation

The canonical representation for float is defined by prohibiting certain options from the Lexical representation (§3.2.3.1). Specifically, the preceding optional "+" sign is prohibited from the mantissa. The exponent must be indicated by "E" and number representations must be normalized such that for non-zero numbers there is a single non-zero digit to the left of the decimal point. Leading and trailing zeroes are disallowed in the mantissa and leading zeroes are disallowed in the exponent.

3.2.4 double

[Definition:]  The double datatype corresponds to IEEE double-precision 64-bit floating point type [IEEE 754-1985]. The basic value space of double consists of the values m × 2^e, where m is an integer whose absolute value is less than 2^53, and e is an integer between -1075 and 970, inclusive. In addition to the basic value space described above, the value space of double also contains the following special values: positive and negative zero, positive negative infinity and not-a-number. The order-relation on double is: x < y iff y - x is positive.

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

3.2.4.1 Lexical representation

double values have a lexical representation consisting of a mantissa followed, optionally, by the character "E" or "e", followed by an exponent. The exponent must be an integer. The mantissa must be a decimal number. The representations for exponent and mantissa must follow the lexical rules for integer and decimal. If the "E" or "e" and the following exponent are omitted, an exponent value of 0 is assumed.

The special values positive and negative zero, positive and negative infinity and not-a-number have 0, -0, INF, -INF and NaN, respectively.

For example, -1E4, 1267.43233E12, 12.78e-2, 12 and INF are all legal literals for double.

3.2.4.2 Canonical representation

The canonical representation for double is defined by prohibiting certain options from the Lexical representation (§3.2.4.1). Specifically, the preceding optional "+" sign is prohibited from the mantissa. The exponent must be indicated by "E" and number representations must be normalized such that for non-zero numbers there is a single non-zero digit to the left of the decimal point. Leading and trailing zeroes are disallowed in the mantissa and leading zeroes are disallowed in the exponent.

3.2.5 decimal

[Definition:]  decimal represents arbitrary precision decimal numbers. The value space of decimal is the set of the values i × 10^-n, where i and n are integers such that n >= 0. The order-relation on decimal is: x < y iff y - x is positive.

[Definition:]   The value space of types derived from decimal with a value for precision of p is the set of values i × 10^-n, where n and i are integers such that p >= n >= 0 and the number of significant decimal digits in i is less than or equal to p.

[Definition:]   The value space of types derived from decimal with a value for scale of s is the set of values i × 10^-n, where i and n are integers such that 0 <= n <= s.

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

Ed. Note: Priority Feedback Request
As in all such cases, the minimum number of decimal digits that all minimally conforming processors must support is too small for some applications and, perhaps, too large for others. We welcome further input from implementors whether the minimum value of 18 is acceptable.

3.2.5.1 Lexical representation

decimal has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39) separated by a period as a decimal indicator, in accordance with the scale and precision facets, with an optional leading sign. If the sign is omitted, "+" is assumed. Leading and trailing zeroes are optional. If the fractional part is zero, the period and following zero(es) can be omitted. For example: -1.23, 12678967.543233, +100000.00.

3.2.5.2 Canonical representation

The canonical representation for decimal is defined by prohibiting certain options from the Lexical representation (§3.2.5.1). Specifically, the preceding optional "+" sign is prohibited. Leading zeroes are prohibited. Trailing zeroes to the right of the decimal point are also prohibited.

3.2.5.4 Derived datatypes

The following built-in datatypes are derived from decimal:

3.2.6 timeDuration

[Definition:]  timeDuration represents a duration of time. The value space of timeDuration is a six-dimensional space where the coordinates designate the Gregorian year, month, day, hour, minute, and second components defined in § 5.5.3.2 of [ISO 8601], respectively. These components are ordered in their significance by their order of appearance i.e. as year, month, day, hour, minute, and second. The order-relation on timeDuration is defined as follows. For timeDuration t and starting timeInstant s, compute an end timeInstant t[s] whose components CCYY, MM, DD, etc. are computed by adding to those components of s the corresponding components of t and handling the carry-overs correctly. Then, the order-relation of two timeDuration values x and y is x > y iff x[s] > y[s] for any starting instant s, x < y iff x[s] < y[s] for any s and x = y iff x[s] = y[s] for any s.

Note that the order-relation on timeDuration holds for some s but not for all s. In such cases the the order relation in said to be indeterminate. For example, while P1M25D > P50D and P1M10D < P50 the order relation between P1M20D and P50D is indeterminate.

Ed. Note: Priority Feedback Request
The complexity of real world durations of time introduces difficulties into any design that attempts to support them. The XML Schema Working Group acknowledges the undesirability of an order-relation that specifies a partial (as opposed to a total) order; however, it has found no other solution that garnered consensus. Therefore, the XML Schema Working Group welcomes feedback from implementors and schema authors on alternative designs. Specifically, we are interested in knowing whether timeDuration needs to be ordered at all and in hearing how other implemented systems which provide a total order for durations of time have defined that total order.

3.2.6.1 Lexical representation

The lexical representation for timeDuration is the [ISO 8601] extended format PnYn MnDTnH nMnS, where nY represents the number of years, nM the number of months, nD the number of days, 'T' is the date/time separator, nH the number of hours, nM the number of minutes and nS the number of seconds. The number of seconds can include decimal digits to arbitrary precision.

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

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

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

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

  • The lowest order items may be omitted. If omitted their value is assumed to be zero.
  • The lowest order item may have a decimal fraction.
  • If the number of years, months, days, hours, minutes, or seconds in any expression equals zero, the number and its corresponding designator may be omitted. However, at least one number and its designator must be present.
  • The designator 'T' shall be absent 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 Constraining facets

timeDuration has the following constraining facets:

3.2.7 recurringDuration

[Definition:]  recurringDuration represents a specific period of time that recurs with a specific frequency, starting from a specific point in time. The value that appears in an instance document is interpreted as the point in time when the recurrence begins. The value space of recurringDuration is the set of sets of timeDurations that recur with a specific timeDuration starting from a specific timeInstant. The order-relation on recurringDuration is: x < y iff y - x is positive where x and y are starting timeInstants. recurringDurations which have different values for the duration and period cannot be compared.

recurringDuration has two constraining facets duration and period whose values must be specified when the datatype is defined. These facets specify the length of the duration and after what duration it recurs. The lexical format used to specify these facet values is the lexical format for timeDuration. A value of 0 for the facet period means that the duration does not recur i.e. there is but a single occurrence. A value of 0 for the facet duration means that the duration is, in fact, a single instant of time.

recurringDuration is a conceptual datatype which serves as a base type from which the other date and time datatypes are derived. It can also be used as a base type for user-derived datatypes. A user-derived datatype can be derived from recurringDuration by specifying values for duration and period.

NOTE: While recurringDuration is capable of serving as the base type of datatypes used in many different date and time related applications beyond those supplied by its use as the base type of the built-in datatypes derived from it, recurringDuration is not intended as a general-purpose solution to calendaring and scheduling applications.

Ed. Note: Priority Feedback Request
The XML Schema Working Group is particularly interested in feedback from implementors and schema authors as to how timeDuration, recurringDuration and the other date and time related datatypes derived from recurringDuration interoperate with other date and time related systems.

Constraint on Schemas: duration and period required for recurringDuration
It is an error for recurringDuration to be used directly in a schema. Only datatypes that are derived from recurringDuration by specifying a value for duration and period can be used in a schema.
3.2.7.1 Lexical representation

A single lexical representation, which is a subset of the lexical representations allowed by [ISO 8601], is allowed for recurringDuration. This lexical representation is the [ISO 8601] extended format CCYY-MM-DDThh:mm:ss.sss where "CC" represents the century, "YY" the year, "MM" the month and "DD" the day, preceded by an optional leading sign to indicate a negative number. If the sign is omitted, "+" is assumed. The letter "T" is the date/time separator and "hh", "mm", "ss.sss" represent hour, minute and second respectively. Additional digits can be used to increase the precision of fractional seconds if desired. To accommodate year values greater than 9999 additional digits can be added to the left of this representation. The year 0000 is prohibited.

This representation can be immediately followed by a "Z" to indicate Coordinated Universal Time (UTC). To indicate the time zone, i.e. the difference between the local time and Coordinated Universal Time, the difference immediately follows the time and consists of a sign, + or -, followed by hh:mm. See also ISO 8601 Date and Time Formats (§D).

The derived datatype timeInstant uses the same lexical representation. Other derived datatypes date, time, timePeriod and recurringDate use truncated versions of this lexical representation.

3.2.7.2 Canonical representation

The canonical representation for recurringDuration is defined by prohibiting certain options from the Lexical representation (§3.2.7.1). Specifically, the preceding optional "+" sign is prohibited and the time zone must be Coordinated Universal Time (UTC) and be indicated by a "Z".

3.2.7.3 Constraining facets

recurringDuration has the following constraining facets:

3.2.7.4 Derived datatypes

The following built-in datatypes are derived from recurringDuration:

3.2.8 binary

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

Constraint on Schemas: encoding required for binary
It is an error for binary to be used directly in a schema. Only datatypes that are derived from binary by minimally specifying a value for encoding can be used in a schema.
3.2.8.1 Constraining facets

binary has the following constraining facets:

3.2.9 uriReference

[Definition:]  uriReference represents a Uniform Resource Identifier (URI) Reference as defined in Section 4 of [RFC 2396], as amended by [RFC 2732]. A uriReference can be an absolute uriReference or a relative uriReference, and may have an optional fragment identifier.

NOTE: URI References require certain ASCII characters and all non-ASCII characters be hex encoded, sometimes called URI-escaping (see Section 2 of [RFC 2396], as amended by Section 3 of [RFC 2732]). Therefore, schema authors need to exercise caution in the use of uriReference. Specifically, schema authors should avoid uriReference in cases where literals should be allowed to directly contain characters that [RFC 2396], as amended by [RFC 2732], require to be hex encoded.

Ed. Note: Priority Feedback Request
There is ongoing discussion about how to treat URI References that might contain non-ASCII characters. It is extremely important that all W3C specifications that deal with such URI References (at least this specification, [Character Model], [XML 1.0 Recommendation (Second Edition)] and [XPointer], probably others) be aligned; however, it is not clear how best to achieve that alignment with this specification. In addition to the current design, where both the lexical space and value space of uriReference are considered to be hex encoded, there are at least 3 alternative designs that could be considered: 1) have 2 types, the current type and another type (not strictly speaking, a URI Reference) where both the lexical space and value space where allowed to contain non-ASCII characters; 2) a single type whose lexical space is allowed to contain non-ASCII characters, but whose value space was the set of hex-encoded literals; 3) a single type whose lexical space was hex-encoded, but whose value space was allowed to contain non-ASCII characters (i.e., the set of hex-decoded literals). The XML Schema Working Group welcomes feedback from implementors and schema authors on how to further harmonize the effected specifications; in particular, we seek advice on which of the above alternatives (or some other alternative not yet considered) is most desirable. Changes resulting from such further harmonization might result in additional changes to the XML Schema Language in cases where uriReference in used (e.g., xsi:schemaLocation in [XML Schema Part 1: Structures]).

[Definition:]   An absolute uriReference refers to a resource in a manner which is independent of the context in which the uriReference occurs.

[Definition:]   A relative uriReference refers to a resource by describing the difference within a hierarchy of resources between the context in which the relative uriReference occurs and the absolute uriReference of the resource.

3.2.9.1 Lexical representation

The lexical space of uriReference is the set of strings that match the URI-reference production in Section 4 of [RFC 2396].

3.2.9.2 Constraining facets

uriReference has the following constraining facets:

3.2.10 ID

[Definition:]  ID represents the ID attribute type from [XML 1.0 Recommendation (Second Edition)]. The value space of ID is the set of all strings that match the NCName production in [Namespaces in XML] and have been used in an XML document. The lexical space of ID is the set of all strings that match the NCName production in [Namespaces in XML].

NOTE: The value space of ID is scoped to a specific instance document.

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

Constraint: ID Unique
An ID must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them.

3.2.11 IDREF

[Definition:]  IDREF represents the IDREF attribute type from [XML 1.0 Recommendation (Second Edition)]. The value space of IDREF is the set of all strings that match the NCName production in [Namespaces in XML] and have been used in an XML document as the value of an element or attribute of type ID. The lexical space of IDREF is the set of strings that match the NCName production in [Namespaces in XML].

NOTE: The value space of IDREF is scoped to a specific instance document.

For compatibility (see Terminology (§1.4)) this datatype should be used only on attributes.

Constraint: IDREF
An IDREF must match the value of an ID in the XML document in which it occurs.
3.2.11.2 Derived datatypes

The following built-in datatypes are derived from IDREF:

3.2.12 ENTITY

[Definition:]  ENTITY represents the ENTITY attribute type from [XML 1.0 Recommendation (Second Edition)]. The value space of ENTITY is the set of all strings that match the NCName production in [Namespaces in XML] and have been declared as an unparsed entity in a document type definition. The lexical space of ENTITY is the set of all strings that match the NCName production in [Namespaces in XML].

NOTE: The value space of ENTITY is scoped to a specific instance document.
Constraint: ENTITY declared
ENTITY values must match an unparsed entity name that is declared in the schema.

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

3.2.12.2 Derived datatypes

The following built-in datatypes are derived from ENTITY:

3.2.13 QName

[Definition:]  QName represents XML qualified names. The value space of QName is the set of tuples {namespace name, local part}, where namespace name is a uriReference and local part is an NCName. The lexical space of QName is the set of strings that match the QName production of [Namespaces in XML].

3.2.13.2 Derived datatypes

The following built-in datatypes are derived from QName:

3.3 Derived datatypes

This section gives conceptual definitions for all built-in derived datatypes defined by this specification. The XML Representation used to define derived datatypes (whether built-in or user-derived) is given in section XML representation of datatype definitions (§5.1) and the complete definitions of the built-in  derived datatypes are provided in Appendix Schema for Datatype Definitions (normative) (§A).

3.3.1 CDATA

[Definition:]  CDATA represents white space normalized strings. The value space of CDATA is the set of strings that do not contain the carriage-return (#xD), line-feed (#xA) nor tab (#x9) characters. The lexical space of CDATA is the set of strings that do not contain the newline (#xD) nor tab (#x9) characters. The base type of CDATA is string.

3.3.1.1 Constraining facets

CDATA has the following constraining facets:

3.3.1.2 Derived datatypes

The following built-in datatypes are derived from CDATA:

3.3.2 token

[Definition:]  token represents tokenized strings. The value space of token is the set of strings that do not contain the line-feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces. The lexical space of token is the set of strings that do not contain the line-feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces. The base type of token is CDATA.

3.3.2.1 Constraining facets

token has the following constraining facets:

3.3.2.2 Derived datatypes

The following built-in datatypes are derived from token:

3.3.3 language

[Definition:]  language represents natural language identifiers as defined by [RFC 1766]. The value space of language is the set of all strings that are valid language identifiers as defined in the language identification section of [XML 1.0 Recommendation (Second Edition)]. The lexical space of language is the set of all strings that are valid language identifiers as defined in the language identification section of [XML 1.0 Recommendation (Second Edition)]. The base type of language is token.

3.3.3.1 Constraining facets

language has the following constraining facets:

3.3.4 IDREFS

[Definition:]  IDREFS represents the IDREFS attribute type from [XML 1.0 Recommendation (Second Edition)]. The value space of IDREFS is the set of finite-length sequences of IDREFs that have been used in an XML document. The lexical space of IDREFS is the set of whitespace separated tokens, each of which is in the lexical space of IDREF. The itemType of IDREFS is IDREF.

NOTE: The value space of IDREFS is scoped to a specific instance document.

For compatibility (see Terminology (§1.4)) IDREFS should be used only on attributes.

3.3.4.1 Constraining facets

IDREFS has the following constraining facets:

3.3.5 ENTITIES

[Definition:]  ENTITIES represents the ENTITIES attribute type from [XML 1.0 Recommendation (Second Edition)]. The value space of ENTITIES is the set of finite-length sequences of ENTITYs that have been declared as unparsed entities in a document type definition. The lexical space of ENTITIES is the set of white space separated tokens, each of which is in the lexical space of NMTOKEN. The itemType of ENTITIES is ENTITY.

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

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

3.3.5.1 Constraining facets

ENTITIES has the following constraining facets:

3.3.6 NMTOKEN

[Definition:]  NMTOKEN represents the NMTOKEN attribute type from [XML 1.0 Recommendation (Second Edition)]. The value space of NMTOKEN is the set of tokens that match the Nmtoken production in [XML 1.0 Recommendation (Second Edition)]. The lexical space of NMTOKEN is the set of strings that match the Nmtoken production in [XML 1.0 Recommendation (Second Edition)]. The base type of NMTOKEN is token.

For compatibility (see Terminology (§1.4)) NMTOKEN should be used only on attributes.

3.3.6.1 Constraining facets

NMTOKEN has the following