Copyright ©1999-2000 W3C® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply.
XML Schema: Datatypes is part 2 of the specification of the XML Schema language. It defines facilities for defining datatypes to be used 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.
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:
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 oriented | Document oriented | ||
---|---|---|---|
|
|
The invoice contains several dates and telephone numbers, the postal abbreviation for a state (which comes from an enumerated list of sanctioned values), and a ZIP code (which takes a definable regular form). The memo contains many of the same types of information: a date, telephone number, email address and an "importance" value (from an enumerated list, such as "low", "medium" or "high"). Applications which process invoices and memos need to raise exceptions if something that was supposed to be a date or telephone number does not conform to the rules for valid dates or telephone numbers.
In both cases, validity constraints exist on the content of the instances that are not expressible in XML DTDs. The limited datatyping facilities in XML have prevented validating XML processors from supplying the rigorous type checking required in these situations. The result has been that individual applications writers have had to implement type checking in an ad hoc manner. This specification addresses the need of both document authors and applications writers for a robust, extensible datatype system for XML which could be incorporated into XML processors. As discussed below, these datatypes could be used in other XML-related standards as well.
The [XML Schema Requirements] document spells out concrete requirements to be fulfilled by this specification, which state that the XML Schema Language must:
This portion of the XML Schema Language discusses datatypes that can be used in an XML Schema. These datatypes can be specified for element content that would be specified as #PCDATA and attribute values of various types in a DTD. It is the intention of this specification that it be usable outside of the context of XML Schemas for a wide range of other XML-related activities such as [XSL] and [RDF Schema].
The terminology used to describe XML Schema Datatypes is defined in the body of this specification. The terms defined in the following list are used in building those definitions and in describing the actions of a datatype processor:
This specification provides three different kinds of normative statements about schema components, their representations in XML and their contribution to the schema-validation of information items:
This section describes the conceptual framework behind the 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.
[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.
[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).
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.
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.
[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.
[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.
Every value space supports the notion of equality, with the following rules:
On every datatype, the operation Equal is defined in terms of the equality property of the value space: for any values a, b drawn from the value space, Equal(a,b) is true if a = b, and false otherwise.
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.
[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:
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.
[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.
[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:
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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}.
NOTE: The notation #xA used here (and elsewhere in this specification) represents the Universal Code Set (UCS) code pointhexidecimal A
(linefeed), which is denoted by U+000A in [Unicode3]. This notation is to be distinguished from

, which is the XML character reference to that same UCS code point.
whiteSpace is applicable to all atomic and
list datatypes. For all atomic
datatypes other than string (and types derived
by restriction from it) the value of whiteSpace is
collapse
and cannot be changed by a schema author; for
string the value of whiteSpace is
preserve
; for any type derived by restriction from
string the value of whiteSpace can
be any of the three legal values. For all datatypes
derived by list the
value of whiteSpace is collapse
and cannot
be changed by a schema author. For all datatypes
derived by union
whiteSpace does not apply directly; however, the
normalization behavior of union types is controlled by
the value of whiteSpace on that one of the
memberTypes against which the union
is successfully validated.
NOTE: For more information on whiteSpace, see the discussion on white space normalization in Schema Component Details in [XML Schema Part 1: Structures].
[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.
[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.
[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.
[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.
[Definition:] precision is the maximum number of decimal digits in values of datatypes derived from decimal. The value of precision must be a positiveInteger.
[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 .
[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].
[Definition:] duration is the duration of values for the datatype recurringDuration and datatypes derived from recurringDuration. The value of duration must be a timeDuration.
[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.
It is useful to categorize the datatypes defined in this specification along various dimensions, forming a set of characterization dichotomies.
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).
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.
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.
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.
Next, we distinguish between primitive and derived datatypes.
For example, in this specification, float is a well-defined mathematical concept that cannot be defined in terms of other datatypes, while a 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.
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.
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.
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.
[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.
string has the following constraining facets:
[Definition:] boolean has the value space required to support the mathematical concept of binary-valued logic: {true, false}.
An instance of a datatype that is defined as boolean can have the following legal lexical values {true, false}.
[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].
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.
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.
float has the following constraining facets:
[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].
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.
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.
double has the following constraining facets:
[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.
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
.
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.
decimal has the following constraining facets:
[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.
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:
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.
timeDuration has the following constraining facets:
[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.
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.
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".
recurringDuration has the following constraining facets:
[Definition:] binary represents arbitrary binary data. The value space of binary is the set of finite-length sequences of binary octets.
binary has the following constraining facets:
[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.
The lexical space of uriReference is the set of strings that match the URI-reference production in Section 4 of [RFC 2396].
uriReference has the following constraining facets:
[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.
|
ID has the following constraining facets:
[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.
IDREF has the following constraining facets:
[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.
For compatibility (see Terminology (§1.4)) ENTITY should be used only on attributes.
ENTITY has the following constraining facets:
[Definition:] QName represents XML qualified names. The value space of QName is the set of tuples {namespace name, local part}, where namespace name is 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].
QName has the following constraining facets:
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).
[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.
CDATA has the following constraining facets:
[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.
token has the following constraining facets:
[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.
language has the following constraining facets:
[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.
IDREFS has the following constraining facets:
[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.
ENTITIES has the following constraining facets:
[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.
NMTOKEN has the following constraining facets:
[Definition:] NMTOKENS represents the NMTOKENS attribute type from [XML 1.0 Recommendation (Second Edition)]. The value space of NMTOKENS is the set of finite-length sequences of NMTOKENs. The lexical space of NMTOKENS is the set of white space separated tokens, each of which is in the lexical space of NMTOKEN. The itemType of NMTOKENS is NMTOKEN.
For compatibility (see Terminology (§1.4)) NMTOKENS should be used only on attributes.
NMTOKENS has the following constraining facets:
[Definition:] Name represents XML Names. The value space of Name is the set of all strings which match the Name production of [XML 1.0 Recommendation (Second Edition)]. The lexical space of Name is the set of all strings which match the Name production of [XML 1.0 Recommendation (Second Edition)]. The base type of Name is token.
Name has the following constraining facets:
[Definition:] NCName represents XML "non-colonized" Names. The value space of NCName is the set of all strings which match the NCName production of [Namespaces in XML]. The lexical space of NCName is the set of all strings which match the NCName production of [Namespaces in XML]. The base type of NCName is Name.
NCName has the following constraining facets:
[Definition:] NOTATION represents the NOTATION attribute type from [XML 1.0 Recommendation (Second Edition)]. The value space of NOTATION is the set of all names of notations declared in the current schema. The lexical space of NOTATIONis the set of all names of notations declared in the current schema. The base type of NOTATION is QName.
Constraint on Schemas: enumeration facet value required for NOTATION |
It is an error for NOTATION
to be used directly in a schema. Only datatypes that are
derived from NOTATION by
specifying a value for enumeration can be used
in a schema. Furthermore, the value of all enumeration
facets must match the name of a
notation
declared in the current schema.
|
NOTE: The value space of NOTATION is scoped to a specific schema, given the requirement that all values of the enumeration facet must be the name of a declared notation.
For compatibility (see Terminology (§1.4)) NOTATION should be used only on attributes.
NOTATION has the following constraining facets:
[Definition:] integer is derived from decimal by fixing the value of scale to be 0. This results in the standard mathematical concept of the integer numbers. The value space of integer is the infinite set {...,-2,-1,0,1,2,...}. The base type of integer is decimal.
integer has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39) with an optional leading sign. If the sign is omitted, "+" is assumed. For example: -1, 0, 12678967543233, +100000.
The canonical representation for integer is defined by prohibiting certain options from the Lexical representation (§3.3.11.1). Specifically, the preceding optional "+" sign is prohibited and leading zeroes are prohibited.
integer has the following constraining facets:
[Definition:] nonPositiveInteger is derived from integer by setting the value of maxInclusive to be 0. This results in the standard mathematical concept of the non-positive integers. The value space of nonPositiveInteger is the infinite set {...,-2,-1,0}. The base type of nonPositiveInteger is integer.
nonPositiveInteger has a lexical representation consisting of a negative sign ("-") followed by a finite-length sequence of decimal digits (#x30-#x39). If the sequence of digits consists of all zeros then the sign is optional. For example: -1, 0, -12678967543233, -100000.
The canonical representation for nonPositiveInteger is defined by prohibiting certain options from the Lexical representation (§3.3.12.1). Specifically, the negative sign ("-") is required with the token "0" and leading zeroes are prohibited.
nonPositiveInteger has the following constraining facets:
[Definition:] negativeInteger is derived from nonPositiveInteger by setting the value of maxInclusive to be -1. This results in the standard mathematical concept of the negative integers. The value space of negativeInteger is the infinite set {...,-2,-1}. The base type of negativeInteger is nonPositiveInteger.
negativeInteger has a lexical representation consisting of a negative sign ("-") followed by a finite-length sequence of decimal digits (#x30-#x39). For example: -1, -12678967543233, -100000.
The canonical representation for negativeInteger is defined by prohibiting certain options from the Lexical representation (§3.3.13.1). Specifically, leading zeroes are prohibited.
negativeInteger has the following constraining facets:
[Definition:] long is derived from integer by setting the value of maxInclusive to be 9223372036854775807 and minInclusive to be -9223372036854775808. The base type of long is integer.
long has a lexical representation consisting of an optional sign followed by a finite-length sequence of decimal digits (#x30-#x39). If the sign is omitted, "+" is assumed. For example: -1, 0, 12678967543233, +100000.
The canonical representation for long is defined by prohibiting certain options from the Lexical representation (§3.3.14.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
long has the following constraining facets:
[Definition:] int is derived from long by setting the value of maxInclusive to be 2147483647 and minInclusive to be -2147483648. The base type of int is long.
int has a lexical representation consisting of an optional sign followed by a finite-length sequence of decimal digits (#x30-#x39). If the sign is omitted, "+" is assumed. For example: -1, 0, 126789675, +100000.
The canonical representation for int is defined by prohibiting certain options from the Lexical representation (§3.3.15.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
int has the following constraining facets:
[Definition:] short is derived from int by setting the value of maxInclusive to be 32767 and minInclusive to be -32768. The base type of short is int.
short has a lexical representation consisting of an optional sign followed by a finite-length sequence of decimal digits (#x30-#x39). If the sign is omitted, "+" is assumed. For example: -1, 0, 12678, +10000.
The canonical representation for short is defined by prohibiting certain options from the Lexical representation (§3.3.16.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
short has the following constraining facets:
[Definition:] byte is derived from short by setting the value of maxInclusive to be 127 and minInclusive to be -128. The base type of byte is short.
byte has a lexical representation consisting of an optional sign followed by a finite-length sequence of decimal digits (#x30-#x39). If the sign is omitted, "+" is assumed. For example: -1, 0, 126, +100.
The canonical representation for byte is defined by prohibiting certain options from the Lexical representation (§3.3.17.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
byte has the following constraining facets:
[Definition:] nonNegativeInteger is derived from integer by setting the value of minInclusive to be 0. This results in the standard mathematical concept of the non-negative integers. The value space of nonNegativeInteger is the infinite set {0,1,2,...}. The base type of nonNegativeInteger is integer.
nonNegativeInteger has a lexical representation consisting of an optional sign followed by a finite-length sequence of decimal digits (#x30-#x39). If the sign is omitted, "+" is assumed. For example: 1, 0, 12678967543233, +100000.
The canonical representation for nonNegativeInteger is defined by prohibiting certain options from the Lexical representation (§3.3.18.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
nonNegativeInteger has the following constraining facets:
[Definition:] unsignedLong is derived from nonNegativeInteger by setting the value of maxInclusive to be 18446744073709551615. The base type of unsignedLong is nonNegativeInteger.
unsignedLong has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 12678967543233, 100000.
The canonical representation for unsignedLong is defined by prohibiting certain options from the Lexical representation (§3.3.19.1). Specifically, leading zeroes are prohibited.
unsignedLong has the following constraining facets:
[Definition:] unsignedInt is derived from unsignedLong by setting the value of maxInclusive to be 4294967295. The base type of unsignedInt is unsignedLong.
unsignedInt has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 1267896754, 100000.
The canonical representation for unsignedInt is defined by prohibiting certain options from the Lexical representation (§3.3.20.1). Specifically, leading zeroes are prohibited.
unsignedInt has the following constraining facets:
[Definition:] unsignedShort is derived from unsignedInt by setting the value of maxInclusive to be 65535. The base type of unsignedShort is unsignedInt.
unsignedShort has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 12678, 10000.
The canonical representation for unsignedShort is defined by prohibiting certain options from the Lexical representation (§3.3.21.1). Specifically, the leading zeroes are prohibited.
unsignedShort has the following constraining facets:
[Definition:] unsignedByte is derived from unsignedShort by setting the value of maxInclusive to be 255. The base type of unsignedByte is unsignedShort.
unsignedByte has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39). For example: 0, 126, 100.
The canonical representation for unsignedByte is defined by prohibiting certain options from the Lexical representation (§3.3.22.1). Specifically, leading zeroes are prohibited.
unsignedByte has the following constraining facets:
[Definition:] positiveInteger is derived from nonNegativeInteger by setting the value of minInclusive to be 1. This results in the standard mathematical concept of the positive integer numbers. The value space of positiveInteger is the infinite set {1,2,...}. The base type of positiveInteger is nonNegativeInteger.
positiveInteger has a lexical representation consisting of an optional positive sign ("+") followed by a finite-length sequence of decimal digits (#x30-#x39). For example: 1, 12678967543233, +100000.
The canonical representation for positiveInteger is defined by prohibiting certain options from the Lexical representation (§3.3.23.1). Specifically, the the optional "+" sign is prohibited and leading zeroes are prohibited.
positiveInteger has the following constraining facets:
[Definition:] timeInstant represents a specific instant of time. The value space of timeInstant is the space of Combinations of date and time of day values as defined in § 5.4 of [ISO 8601]. The base type of timeInstant is recurringDuration. timeInstant is generated from recurringDuration by fixing the value of the duration facet equal to "P0Y" and the value of the period facet equal to "P0Y" (no recurrence).
A single lexical representation, which is a subset of the lexical representations allowed by [ISO 8601], and is the same lexical representation as its basetype recurringDuration is allowed for timeInstant.
For example, to indicate 1:20 pm on May the 31st, 1999 for Eastern
Standard Time which is 5 hours behind Coordinated Universal Time (UTC), one
would write: 1999-05-31T13:20:00-05:00
.
The canonical representation for timeInstant is defined by prohibiting certain options from the Lexical representation (§3.3.24.1). Specifically, the preceding optional "+" sign is prohibited and the time zone must be Coordinated Universal Time (UTC) and be indicated by a "Z".
timeInstant has the following constraining facets:
[Definition:] time represents an instant of time that recurs every day. The value space of time is the space of time of day values as defined in § 5.3 of [ISO 8601]. Specifically, it is a set of zero-duration daily instances e.g. lexical 12:30:24 to represent T12:30:24 on any day. The base type of time is recurringDuration. time is generated from recurringDuration by fixing the value of the duration facet equal to "P0Y" and the value of the period facet equal to "P1D".
The lexical representation for time is the left truncated lexical representation for timeInstant: hh:mm:ss.sss with optional following time zone indicator. For example, to indicate 1:20 pm for Eastern Standard Time which is 5 hours behind Coordinated Universal Time (UTC), one would write: 13:20:00-05:00. See also ISO 8601 Date and Time Formats (§D).
The canonical representation for time is defined by prohibiting certain options from the Lexical representation (§3.3.25.1). Specifically, the preceding optional "+" sign is prohibited and the time zone must be Coordinated Universal Time (UTC) and be indicated by a "Z".
time has the following constraining facets:
[Definition:] timePeriod represents a specific period of time with a given start and end. The value space of timePeriod is the value space of Periods of time as defined in § 5.5 of [ISO 8601]. The base type of timePeriod is recurringDuration. timePeriod is generated from recurringDuration by fixing the value of the period facet equal to "P0Y" (no recurrence).
The value in the instance specifies the start of the time period while the value of duration facet, specified when subtypes are defined, gives the duration of the time period.
The lexical representation for timePeriod is the same as that of its basetype, recurringDuration.
The canonical representation for timePeriod is defined by prohibiting certain options from the Lexical representation (§3.3.26.1). Specifically, the preceding optional "+" sign is prohibited and the time zone must be Coordinated Universal Time (UTC) and be indicated by a "Z".
timePeriod has the following constraining facets:
[Definition:] date represents a timePeriod that starts at midnight of a specified day and lasts until midnight the following day. The value space of date is the set of Gregorian calendar dates as defined in § 5.2.1 of [ISO 8601]. Specifically, it is a set of one-day long, non-periodic instances e.g. lexical 1999-10-26 to represent the whole day of 1999-10-26, independent of how many hours this day has. The base type of date is timePeriod. date is generated from timePeriod by fixing the value of the duration facet equal to "P1D".
The lexical representation for date is the reduced (right truncated) lexical representation for timePeriod: CCYY-MM-DD. No left truncation is allowed. An optional following time zone qualifier is allowed as for timePeriod. To accommodate year values outside the range from 0001 to 9999, additional digits can be added to the left of this representation and a preceding "-" is allowed.
For example, to indicate May the 31st, 1999, one would write: 1999-05-31. See also ISO 8601 Date and Time Formats (§D).
The canonical representation for date is defined by prohibiting certain options from the Lexical representation (§3.3.27.1). Specifically, the preceding optional "+" sign is prohibited and the time zone must be Coordinated Universal Time (UTC) and be indicated by a "Z".
date has the following constraining facets:
[Definition:] month represents a timePeriod that starts at midnight on the first day of the month and lasts until the midnight that ends the last day of the month. The value space of month is the set of Gregorian calendar months as defined in § 5.2.1 of [ISO 8601]. Specifically, it is a set of one-month long, non-periodic instances e.g. 1999-10 to represent the whole month of 1999-10, independent of how many days this month has. The base type of month is timePeriod. month is generated from timePeriod by fixing the value of the duration facet equal to "P1M".
The lexical representation for month is the reduced (right truncated) lexical representation for timePeriod: CCYY-MM. No left truncation is allowed. An optional following time zone qualifier is allowed as for timePeriod. To accommodate year values outside the range from 0001 to 9999, additional digits can be added to the left of this representation and a preceding "-" is allowed.
For example, to indicate the month of May 1999, one would write: 1999-05. See also ISO 8601 Date and Time Formats (§D).
The canonical representation for month is defined by prohibiting certain options from the Lexical representation (§3.3.28.1). Specifically, the preceding optional "+" sign is prohibited and the time zone must be Coordinated Universal Time (UTC) and be indicated by a "Z".
month has the following constraining facets:
[Definition:] year represents a timePeriod that starts at the midnight that starts the first day of the year and ends at the midnight that ends the last day of the year. The value space of year is the set of Gregorian calendar years as defined in § 5.2.1 of [ISO 8601]. Specifically, it is a set of one-year long, non-periodic instances e.g. lexical 1999 to represent the whole year 1999, independent of how many months and days this year has. The base type of year is timePeriod. year is generated from timePeriod by fixing the value of the duration facet equal to "P1Y".
The lexical representation for year is the reduced (right truncated) lexical representation for timePeriod: CCYY. No left truncation is allowed. An optional following time zone qualifier is allowed as for timePeriod. To accommodate year values outside the range from 0001 to 9999, additional digits can be added to the left of this representation and a preceding "-" is allowed.
For example, to indicate 1999, one would write: 1999. See also ISO 8601 Date and Time Formats (§D).
The canonical representation for year is defined by prohibiting certain options from the Lexical representation (§3.3.29.1). Specifically, the preceding optional "+" sign is prohibited and the time zone must be Coordinated Universal Time (UTC) and be indicated by a "Z".
year has the following constraining facets:
[Definition:] century represents a timePeriod that starts at the midnight that starts the first day of the century and ends at the midnight that ends that last day of the century. The value space of century is the set of Gregorian calendar centuries as defined in § 5.2.1 of [ISO 8601]. Specifically, it is a set of one-century long, non-periodic instances e.g. literal 19 to represent the whole of the 20th century. The base type of century is timePeriod. century is generated from timePeriod by fixing the value of the duration facet equal to "P100Y".
The lexical representation for century is the reduced (right truncated) lexical representation for timePeriod: CC. No left truncation is allowed. An optional following time zone qualifier is allowed as for timePeriod. To accommodate year values outside the range from 0001 to 9999, additional digits can be added to the left of this representation and a preceding "-" is allowed.
For example, to indicate the 20th century, one would write: 19. See also ISO 8601 Date and Time Formats (§D).
The canonical representation for century is defined by prohibiting certain options from the Lexical representation (§3.3.30.1). Specifically, the preceding optional "+" sign is prohibited and the time zone must be Coordinated Universal Time (UTC) and be indicated by a "Z".
century has the following constraining facets:
[Definition:] recurringDate is a date that recurs, specifically a day of the year such as the third of May. Arbitrary recurring dates are not supported by this datatype. The value space of recurringDate is the set of calendar dates, as defined in § 3 of [ISO 8601]. Specifically, it is a set of one-day long, annually periodic instances. The base type of recurringDate is recurringDuration. recurringDate is generated from recurringDuration by fixing the value of the duration facet equal to "P1D" and the value of the period facet to "P1Y" (one year).
The lexical representation for recurringDate is the left truncated lexical representation for date: --MM-DD. No other formats are allowed. See also ISO 8601 Date and Time Formats (§D).
The canonical representation for recurringDate is defined by prohibiting certain options from the Lexical representation (§3.3.31.1). Specifically, the preceding optional "+" sign is prohibited and the time zone must be Coordinated Universal Time (UTC) and be indicated by a "Z".
recurringDate has the following constraining facets:
[Definition:] recurringDay is a day that recurs, specifically a day of the month such as the 5th of the month. Arbitrary recurring days are not supported by this datatype. The value space of recurringDay is the space of a set of calendar dates as defined in § 3 of [ISO 8601]. Specifically, it is a set of one-day long, monthly periodic instances. The base type of recurringDay is recurringDuration. recurringDay is generated from recurringDuration by fixing the value of the duration facet equal to "P1D" and the value of the period facet to "P1M".
The lexical representation for recurringDay is the left truncated lexical representation for date: ---DD . No other formats are allowed. See also ISO 8601 Date and Time Formats (§D).
The canonical representation for recurringDay is defined by prohibiting certain options from the Lexical representation (§3.3.32.1). Specifically, the preceding optional "+" sign is prohibited and the time zone must be Coordinated Universal Time (UTC) and be indicated by a "Z".
recurringDay has the following constraining facets:
The following sections provide full details on the properties and significance of each kind of schema component involved in datatype definitions. For each property, the kinds of values it is allowed to have is specified. Any property not identified as optional is required to be present; optional properties which are absent are taken to have the null value.
Throughout the following sections, the [value] of an attribute information item means a string composed of, in order, the [character code] of each character information item in the [children] of that attribute information item.
For more information on the notion of datatype (schema) components, see Schema Component Details of [XML Schema Part 1: Structures].
NOTE: Readers whose primary interest is in the XML representation of datatype definitions might wish to skip this section on the first reading, concentrating instead on XML representation of datatype definitions (§5).
Datatype definitions provide for:
The datatype definition schema component has the following properties:
Schema Component: Datatype Definition
- [name]
- Optional. An NCName as defined by [Namespaces in XML].
- [target namespace]
- Either null or a namespace URI, as defined in [Namespaces in XML].
- [variety]
- One of {atomic, list, union}. Depending on the value of {variety}, further properties are defined as follows:
- atomic
- [primitive type definition]
- A built-in primitive datatype definition (or the simple ur-type definition).
- list
- [itemType definition]
- An atomic or union datatype definition.
- union
- [memberType definitions]
- A non-empty sequence of simple type definitions.
- [facets]
- A possibly empty set of Constraining facets (§4.2).
- [fundamental facets]
- A set of Fundamental facets (§2.4.1)
- [base type definition]
- Optional. If the datatype has been derived by restriction then the datatype definition from which it is derived, otherwise absent.
- [annotation]
- Optional. An annotation.
Datatypes are identified by their {name} and {target namespace}. Except for anonymous datatypes (those with no {name}), datatype definitions must be uniquely identified within an schema.
If {variety} is atomic then the value space of the datatype defined will be a subset of the value space of {base type definition} (which is a subset of the value space of {primitive type definition}). If {variety} is list then the value space of the datatype defined will be the set of finite-length sequence of values from the value space of {itemType definition}. If {variety} is union then the value space of the datatype defined will be the union of the value spaces of each datatype in {memberType definitions}.
If {variety} is atomic then the {variety} of {base type definition} must be atomic. If {variety} is list then the {variety} of {itemType definition} must be either atomic or union. If {variety} is union then {memberType definitions} must be a list of datatype definitions.
The value of {facets} consists of the set of facets specified directly in the datatype definition unioned with the possibly empty set of {facets} of {base type definition}.
The value of {fundamental facets} consists of the set of fundamental facets and their values.
If {variety} is atomic then bounded is true and cardinality is finite if one of minInclusive or minExclusive and one of maxInclusive or maxExclusive are among {facets}, otherwise bounded is false and cardinality is countably infinite, numeric and ordered are inherited from {base type definition}.
If {variety} is list then bounded is true and cardinality is finite if length or both of minLength and maxLength are among {facets}, otherwise bounded is false and cardinality is countably infinite, numeric and ordered are false.
If {variety} is union then bounded is true if every member of {memberType definitions} is bounded and all members of {memberType definitions} share a common ancestor and is false otherwise, cardinality is finite if the cardinality of every member of {memberType definitions} is finite and is countably infinite otherwise, ordered is true if every member of {memberType definitions} is ordered and all members of {memberType definitions} share a common ancestor and is false otherwise, numeric are true if every member of {memberType definitions} is numeric and is false otherwise.
Validation Rule: Datatype Valid |
A string is datatype-valid with respect to a datatype definition if:
|
This section provides the details of each constraining facet component.
constraining facets provide for:
Validation Rule: Facet Valid |
A value in a value space is facet-valid with
respect to a constraining facet component if:
|
length provides for:
Schema Component: length
- [value]
- A nonNegativeInteger.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for length other than {value}.
Validation Rule: Length Valid |
A value in a value space is facet-valid with
respect to length, determined as follows:
|
minLength provides for:
Schema Component: minLength
- [value]
- A nonNegativeInteger.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for minLength other than {value}.
Validation Rule: minLength Valid |
A value in a value space is facet-valid with
respect to minLength, determined as follows:
|
maxLength provides for:
Schema Component: maxLength
- [value]
- A nonNegativeInteger.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for maxLength other than {value}.
Validation Rule: maxLength Valid |
A value in a value space is facet-valid with
respect to maxLength, determined as follows:
|
pattern provides for:
Schema Component: pattern
- [value]
- A regular expression.
- [annotation]
- Optional. An annotation.
Validation Rule: pattern valid |
A value in a value space is facet-valid with
respect to pattern if:
|
enumeration provides for:
Schema Component: enumeration
- [value]
- A set of values from the value space of the {base type definition}.
- [annotation]
- Optional. An annotation.
Validation Rule: enumeration valid |
A value in a value space is facet-valid with
respect to enumeration if:
|
whiteSpace provides for:
Schema Component: whiteSpace
- [value]
- One of
{preserve, replace, collapse}
.- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for whiteSpace other than {value}.
NOTE: There are no Validation Rules associated whiteSpace. For more information, see the discussion on white space normalization in Schema Component Details in [XML Schema Part 1: Structures].
maxInclusive provides for:
Schema Component: maxInclusive
- [value]
- A value from the value space of the {base type definition}.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for maxInclusive other than {value}.
Constraint on Schemas: minInclusive <= maxInclusive |
It is an error for the value specified for
minInclusive to be greater than the value
specified for maxInclusive for the same datatype.
|
Validation Rule: maxInclusive Valid |
A value in an ordered value space
is facet-valid with respect to maxInclusive, determined as
follows:
|
maxExclusive provides for:
Schema Component: maxExclusive
- [value]
- A value from the value space of the {base type definition}.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for maxExclusive other than {value}.
Constraint on Schemas: minExclusive <= maxExclusive |
It is an error for the value specified for
minExclusive to be greater than the value
specified for maxExclusive for the same datatype.
|
Validation Rule: maxExclusive Valid |
A value in an ordered value space
is facet-valid with respect to maxExclusive, determined
as follows:
|
minExclusive provides for:
Schema Component: minExclusive
- [value]
- A value from the value space of the {base type definition}.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for minExclusive other than {value}.
Validation Rule: minExclusive Valid |
A value in an ordered value space
is facet-valid with respect to minExclusive if:
|
minInclusive provides for:
Schema Component: minInclusive
- [value]
- A value from the value space of the {base type definition}.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for minInclusive other than {value}.
Validation Rule: minInclusive Valid |
A value in an ordered value space
is facet-valid with respect to minInclusive if:
|
precision provides for:
Schema Component: precision
- [value]
- A positiveInteger.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for precision other than {value}.
Validation Rule: precision Valid |
A value in a value space is facet-valid with
respect to precision if:
|
scale provides for:
Schema Component: scale
- [value]
- A nonNegativeInteger.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for scale other than {value}.
Validation Rule: scale Valid |
A value in a value space is facet-valid with
respect to scale if:
|
encoding provides for:
Schema Component: encoding
- [value]
- One of {hex, base64}.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for encoding other than {value}.
NOTE: There are no Validation Rules associated with encoding. encoding determines the lexical space of datatypes derived from binary without constraining the value space.
duration provides for:
Schema Component: duration
- [value]
- A timeDuration.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for duration other than {value}.
NOTE: There are no Validation Rules associated duration.
period provides for:
Schema Component: period
- [value]
- A timeDuration.
- [fixed]
- A boolean.
- [annotation]
- Optional. An annotation.
If {fixed} is true, then types for which the current type is the {base type definition} cannot specify a value for period other than {value}.
NOTE: There are no Validation Rules associated period.
The sections below define correspondences between element information
items and datatype definition components. All the element information
items in the XML representation of a datatype definition are in the
XML Schema namespace, that is their
[
namespace URI] is http://www.w3.org/2000/10/XMLSchema
.
Throughout the following sections, the [value] of an attribute information item or the [children] of an element information item means a string composed of, in order, the [character code] of each character information item in the [children] of that attribute information item or in the [children] of that element information item respectively.
The XML representation for a Datatype definition schema component is a simpleType element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: simpleType
Element Information Item<simpleType
id = ID
name = NCName
{any attributes with non-schema namespace. . .}>
Content: (annotation? , (restriction | list | union))
</simpleType>
Datatype Definition Schema Component
Property Representation {name} The value of the name
[attribute], if present, otherwise null{target namespace} The value of the targetNamespace
[attribute] of the parentschema
element information item.{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
A derived datatype can be derived from a primitive datatype or another derived datatype by one of three means: by restriction, by list or by union.
XML Representation Summary: restriction
Element Information Item<restriction
id = ID
base = QName
{any attributes with non-schema namespace. . .}>
Content: (annotation? , (simpleType? , (minExclusive | minInclusive | maxExclusive | maxInclusive | precision | scale | length | minLength | maxLength | encoding | period | duration | enumeration | pattern)*))
</restriction>
Datatype Definition Schema Component
Property Representation {variety} The value of {variety} of {base type definition} {facets} The union of the set of facet components corresponding to the facet [children]. {base type definition} Either the base
[attribute] or thesimpleType
[children], whichever is present.
One datatype can be derived from another datatype by restricting its value space and, consequently, its lexical space. Restriction of the value space is accomplished through the specification of values for one or more constraining facets.
[Definition:] Every datatype that is derived by restriction is defined in terms of an existing datatype, referred to as its base type. base types can be either primitive or derived.
Example
An electronic commerce schema might define a datatype called Sku (the barcode number that appears on products) from the built-in datatype string by supplying a value for the pattern facet.
<simpleType name='Sku'> <restriction base='string'> <pattern value='\d{3}-[A-Z]{2}'/> </restriction> </simpleType>In this case, Sku is the name of the new user-derived datatype, string is its base type and pattern is the facet.
XML Representation Summary: list
Element Information Item<list
id = ID
itemType = QName
{any attributes with non-schema namespace. . .}>
Content: (annotation? , simpleType?)
</list>
Datatype Definition Schema Component
Property Representation {variety} list {itemType definition} The value of the itemType
[attribute]
A list datatype must be derived from an atomic or a list datatype, known as the itemType of the list datatype. This yields a datatype whose value space is composed of finite sequences of values from the value space of the itemType and whose lexical space is composed of white space separated lists of literals of the itemType.
Example
A system might want to store lists of floating point values.
<simpleType name='listOfFloat'> <list itemType='float'/> </simpleType>In this case, listOfFloat is the name of the new user-derived datatype, float is its itemType and list is the derivation method.
As mentioned in List datatypes (§2.5.1.2), when a datatype is derived from a list datatype, the following constraining facets can be used:
regardless of the constraining facets that are applicable to the atomic datatype that serves as the itemType of the list.
For each of the above facets, the unit of length is measured in number of list items.
XML Representation Summary: union
Element Information Item<union
memberTypes = list of QName
id = ID
{any attributes with non-schema namespace. . .}>
Content: (annotation? , simpleType*)
</union>
Datatype Definition Schema Component
Property Representation {variety} union {memberType definitions} The type definitions resolved to by the items in the value of the memberTypes
[attribute], if any, in order, followed by the type definitions corresponding to thesimpleType
[children], if any, in order.
Schema Representation Constraint: memberTypes attribute or simpleType children |
Either the
memberTypes [attribute] must be non-empty or
there must be at least one simpleType [child].
|
A union datatype can be derived from two or more atomic, list or other union datatypes, known as the memberTypes of that union datatype.
Example
An example, taken from a typical display oriented text markup language, might want to express font sizes as an integer between 8 and 72, or with one of the tokens "small", "medium" or "large". The union type definition below would accomplish that.
<xsd:attribute name="size"> <xsd:simpleType> <xsd:union> <xsd:simpleType> <xsd:restriction base="xsd:positiveInteger"> <xsd:minInclusive value="8"/> <xsd:maxInclusive value="72"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType> <xsd:restriction base="xsd:NMTOKEN"> <xsd:enumeration value="small"/> <xsd:enumeration value="medium"/> <xsd:enumeration value="large"/> </xsd:restriction> </xsd:simpleType> </xsd:union> </xsd:simpleType> </xsd:attribute>
<p> <font size='large'>A header</font> </p> <p> <font size='12'>this is a test</font> </p>
As mentioned in Union datatypes (§2.5.1.3), when a datatype is derived from a union datatype, the only following constraining facets can be used:
regardless of the constraining facets that are applicable to the datatypes that participate in the union
This section discusses the details of the XML Representation for specifying constraining facets in a datatype definition.
The XML representation for a length schema component is a length element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: length
Element Information Item<length
id = ID
value = nonNegativeInteger
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</length>
length Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
The following is the definition of a user-derived datatype to represent product codes which must be exactly 8 characters in length. By fixing the value of the length facet we ensure that types derived from productCode can change or set the values of other facets, such as pattern, but cannot change the length.
<simpleType name='productCode'> <restriction base='string'> <length value='8' fixed='true'/> </restriction> </simpleType>
The XML representation for a minLength schema component is a minLength element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: minLength
Element Information Item<minLength
id = ID
value = nonNegativeInteger
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</minLength>
minLength Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
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>
The XML representation for a maxLength schema component is a maxLength element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: maxLength
Element Information Item<maxLength
id = ID
value = nonNegativeInteger
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</maxLength>
maxLength Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
The following is the definition of a user-derived datatype which might be used to accept form input with an upper limit to the number of characters that are acceptable.
<simpleType name='form-input'> <restriction base='string'> <maxLength value='50'/> </restriction> </simpleType>
The XML representation for a pattern schema component is a pattern element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: pattern
Element Information Item<pattern
id = ID
value = string
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</pattern>{value} must be a valid regular expression.
pattern Schema Component
Property Representation {value} The value of the value
[attribute]{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Schema Representation Constraint: Multiple patterns |
If multiple pattern element information items appear as
[children] of a simpleType, the [value]s should
be combined as if they appeared in a single
regular expression as separate
branches.
|
Example
The following is the definition of a user-derived datatype which is a better representation of postal codes in the United States, by limiting strings to those which are matched by a specific regular expression.
<simpleType name='better-us-zipcode'> <restriction base='string'> <pattern value='[0-9]{5}(-[0-9]{4})?'/> </restriction> </simpleType>
The XML representation for a enumeration schema component is a enumeration element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: enumeration
Element Information Item<enumeration
id = ID
value = string
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</enumeration>{value} must be a valid value of the {base type definition}.
enumeration Schema Component
Property Representation {value} The value of the value
[attribute]{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Schema Representation Constraint: Multiple enumerations |
If multiple enumeration element information items appear
as [children] of a simpleType the
{value} of the enumeration
component should be the set of all such [value]s.
|
Example
The following example is a datatype definition for a user-derived datatype which limits the values of dates to the three US holidays enumerated. This datatype definition would appear in a schema authored by an "end-user" and shows how to define a datatype by enumerating the values in its value space. The enumerated values must be type-valid literals for the base type.
<simpleType name='holidays'> <annotation> <documentation>some US holidays</documentation> </annotation> <restriction base='recurringDate'> <enumeration value='--01-01'> <annotation> <documentation>New Year's day</documentation> </annotation> </enumeration> <enumeration value='--07-04'> <annotation> <documentation>4th of July</documentation> </annotation> </enumeration> <enumeration value='--12-25'> <annotation> <documentation>Christmas</documentation> </annotation> </enumeration> </restriction> </simpleType>
The XML representation for a whiteSpace schema component is a whiteSpace element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: whiteSpace
Element Information Item<whiteSpace
id = ID
value = preserve | replace | collapse
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</whiteSpace>{value} must be a valid value of the {base type definition}.
whiteSpace Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
The following example is the datatype definition for the token built-in derived datatype.
<simpleType name='token'> <restriction base='CDATA'> <whiteSpace value='collapse'/> </restriction> </simpleType>
The XML representation for a maxInclusive schema component is a maxInclusive element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: maxInclusive
Element Information Item<maxInclusive
id = ID
value = string
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</maxInclusive>{value} must be a valid value of the {base type definition}.
maxInclusive Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false, if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
The following is the definition of a user-derived datatype which limits values to integers less than or equal to 100, using maxInclusive.
<simpleType name='one-hundred-or-less'> <restriction base='integer'> <maxInclusive value='100'/> </restriction> </simpleType>
The XML representation for a maxExclusive schema component is a maxExclusive element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: maxExclusive
Element Information Item<maxExclusive
id = ID
value = string
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</maxExclusive>{value} must be a valid value of the {base type definition}.
maxExclusive Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
The following is the definition of a user-derived datatype which limits values to integers less than or equal to 100, using maxExclusive.
<simpleType name='less-than-one-hundred-and-one'> <restriction base='integer'> <maxExclusive value='101'/> </restriction> </simpleType>Note that the value space of this datatype is identical to the previous one (named 'one-hundred-or-less').
The XML representation for a minInclusive schema component is a minInclusive element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: minInclusive
Element Information Item<minInclusive
id = ID
value = string
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</minInclusive>{value} must be a valid value of the {base type definition}.
minInclusive Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
The following is the definition of a user-derived datatype which limits values to integers greater than or equal to 100, using minInclusive.
<simpleType name='one-hundred-or-more'> <restriction base='integer'> <minInclusive value='100'/> </restriction> </simpleType>
The XML representation for a minExclusive schema component is a minExclusive element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: minExclusive
Element Information Item<minExclusive
id = ID
value = string
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</minExclusive>{value} must be a valid value of the {base type definition}.
minExclusive Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
The following is the definition of a user-derived datatype which limits values to integers greater than or equal to 100, using minExclusive.
<simpleType name='more-than-ninety-nine'> <restriction base='integer'> <minExclusive value='99'/> </restriction> </simpleType>Note that the value space of this datatype is identical to the previous one (named 'one-hundred-or-more').
The XML representation for a precision schema component is a precision element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: precision
Element Information Item<precision
id = ID
value = nonNegativeInteger
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</precision>
precision Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
The following is the definition of a user-derived datatype which could be used to represent monetary amounts, such as in a financial management application which does not have figures of $1M or more and only allows whole cents. This definition would appear in a schema authored by an "end-user" and shows how to define a datatype by specifying facet values which constrain the range of the base type in a manner specific to the base type (different than specifying max/min values as before).
<simpleType name='amount'> <restriction base='decimal'> <precision value='8'/> <scale value='2' fixed='true'/> </restriction> </simpleType>
The XML representation for a scale schema component is a scale element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: scale
Element Information Item<scale
id = ID
value = nonNegativeInteger
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</scale>
scale Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
The following is the definition of a user-derived datatype which could be used to represent the magnitude of a person's body temperature on the Celsius scale. This definition would appear in a schema authored by an "end-user" and shows how to define a datatype by specifying facet values which constrain the range of the base type.
<simpleType name='celsiusBodyTemp'> <restriction base='decimal'> <precision value='4'/> <scale value='1'/> <minInclusive value='36.4'/> <maxInclusive value='40.5'/> </restriction> </simpleType>
The XML representation for a encoding schema component is an encoding element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: encoding
Element Information Item<encoding
id = ID
value = hex | base64
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</encoding>
encoding Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
The following example is a datatype definition for a user-derived datatype whose value space is the set of binary streams of length 4 octets (32 bits) and whose lexical space is the set of base64 encodings of such binary streams. This datatype definition would appear in a schema authored by an "end-user" and shows how to define a datatype by specifying multiple constraining facets.
<simpleType name='myBinary'> <restriction base='binary'> <length value='4'/> <encoding value='base64'/> </restriction> </simpleType>
The XML representation for a duration schema component is a duration element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: duration
Element Information Item<duration
id = ID
value = timeDuration
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</duration>
duration Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
Suppose an health insurance company wanted to define the length of a hospital stay permitted for the birth of a baby as two days. They might want to define a datatype as below.
<simpleType name='birthingStay'> <restriction base='timePeriod'> <duration value='P2D'/> </restriction> </simpleType>
The XML representation for a period schema component is a period element information item. The correspondences between the properties of the information item and properties of the component are as follows:
XML Representation Summary: period
Element Information Item<period
id = ID
value = timeDuration
fixed = boolean : false
{any attributes with non-schema namespace. . .}>
Content: (annotation?)
</period>
period Schema Component
Property Representation {value} The value of the value
[attribute]{fixed} The value of the fixed
[attribute], if present, otherwise false{annotation} The annotation corresponding to the annotation element information item in the [children], if present, otherwise null
Example
Suppose we wanted to define a day of the week i.e. a duration of one day that recurs every 7 days. This could be done as follows:
<simpleType name='dayOfWeek'> <restriction base='recurringDuration'> <duration value='P1D'/> <period value='P7D'/> </restriction> </simpleType>
This specification describes two levels of conformance for datatype processors. The first is required of all processors. Support for the other will depend on the application environments for which the processor is intended.
[Definition:] Minimally conforming processors must completely and correctly implement the Constraint on Schemas and Validation Rule .
[Definition:] Processors which accept schemas in the form of XML documents as described in XML representation of datatype definitions (§5.1) are additionally said to provide conformance to the XML Representation of Schemas, and must, when processing schema documents, completely and correctly implement all Schema Representation Constraints in this specification, and must adhere exactly to the specifications in XML representation of datatype definitions (§5.1) for mapping the contents of such documents to schema components for use in validation.
NOTE: By separating the conformance requirements relating to the concrete syntax of XML schema documents, this specification admits processors which validate using schemas stored in optimised binary representations, dynamically created schemas represented as programming language data structures, or implementations in which particular schemas are compiled into executable code such as C or Java. Such processors can be said to be minimally conforming but not necessarily in conformance to the XML Representation of Schemas.
<?xml version='1.0'?> <!-- XML Schema schema for XML Schemas: Part 2: Datatypes --> <!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 200010//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 simpleType id ID #IMPLIED> <!ATTLIST maxExclusive id ID #IMPLIED> <!ATTLIST minExclusive id ID #IMPLIED> <!ATTLIST maxInclusive id ID #IMPLIED> <!ATTLIST minInclusive id ID #IMPLIED> <!ATTLIST precision id ID #IMPLIED> <!ATTLIST scale id ID #IMPLIED> <!ATTLIST length id ID #IMPLIED> <!ATTLIST minLength id ID #IMPLIED> <!ATTLIST maxLength id ID #IMPLIED> <!ATTLIST enumeration id ID #IMPLIED> <!ATTLIST pattern id ID #IMPLIED> <!ATTLIST encoding id ID #IMPLIED> <!ATTLIST period id ID #IMPLIED> <!ATTLIST duration id ID #IMPLIED> <!ATTLIST appinfo id ID #IMPLIED> <!ATTLIST documentation id ID #IMPLIED> <!ATTLIST list id ID #IMPLIED> <!ATTLIST union id ID #IMPLIED> ]> <schema xmlns="http://www.w3.org/2000/10/XMLSchema" targetNamespace="http://www.w3.org/2000/10/XMLSchema" version="Id: datatypes.xsd,v 1.30 2000/10/24 08:04:50 ht Exp " xmlns:hfp="http://www.w3.org/2000/10/XMLSchema-hasFacetAndProperty" elementFormDefault="qualified"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes"> The schema corresponding to this document is normative, with respect to the syntactic constraints it expresses in the XML Schema language. The documentation (within <documentation> elements) below, is not normative, but rather highlights important aspects of the W3C Recommendation of which this is a part </documentation> </annotation> <annotation> <documentation xml:lang="en"> First the builtin primitive datatypes. These definitions are for information only, the real builtin definitions are magic. Note in particular that there is no type named 'anySimpleType'. The primitives should really be derived from no type at all, and anySimpleType should be derived as a union of all the primitives. </documentation> <documentation xml:lang="en"> 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 an XPointer that identifies the name of the datatype, as an ID For example, to address the date datatype, the URI is: http://www.w3.org/2000/10/XMLSchema#xpointer(id("date")) 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 an XPointer that identifies the name of the facet, as an ID For example, to address the period facet, the URI is: http://www.w3.org/2000/10/XMLSchema#xpointer(id("period")) 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 an XPointer that identifies the name of the datatype, followed by a period (".") followed by the name of the facet, as an ID For example, to address the usage of the period facet in the definition of date, the URI is: http://www.w3.org/2000/10/XMLSchema#xpointer(id("date.period")) </documentation> </annotation> <simpleType name="string" id="string"> <annotation> <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"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#string"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="preserve"/> </restriction> </simpleType> <simpleType name="boolean" id="boolean"> <annotation> <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"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#boolean"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="float" id="float"> <annotation> <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="true"/> <hfp:hasProperty name="bounded" value="true"/> <hfp:hasProperty name="cardinality" value="finite"/> <hfp:hasProperty name="numeric" value="true"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#float"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="double" id="double"> <annotation> <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="true"/> <hfp:hasProperty name="bounded" value="true"/> <hfp:hasProperty name="cardinality" value="finite"/> <hfp:hasProperty name="numeric" value="true"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#double"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="decimal" id="decimal"> <annotation> <appinfo> <hfp:hasFacet name="precision"/> <hfp:hasFacet name="scale"/> <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="true"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="true"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#decimal"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="timeDuration" id="timeDuration"> <annotation> <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="true"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#timeDuration"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="recurringDuration" id="recurringDuration"> <annotation> <appinfo> <hfp:hasFacet name="duration"/> <hfp:hasFacet name="period"/> <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="true"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#recurringDuration"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="binary" id="binary"> <annotation> <appinfo> <hfp:hasFacet name="encoding"/> <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"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#binary"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="uriReference" id="uriReference"> <annotation> <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"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#uriReference"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="ID" id="ID"> <annotation> <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:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="true"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#ID"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="IDREF" id="IDREF"> <annotation> <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:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="true"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#IDREF"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="ENTITY" id="ENTITY"> <annotation> <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:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="true"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="QName" id="QName"> <annotation> <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:hasFacet name="maxInclusive"/> <hfp:hasFacet name="maxExclusive"/> <hfp:hasFacet name="minInclusive"/> <hfp:hasFacet name="minExclusive"/> <hfp:hasProperty name="ordered" value="true"/> <hfp:hasProperty name="bounded" value="false"/> <hfp:hasProperty name="cardinality" value="countably infinite"/> <hfp:hasProperty name="numeric" value="false"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#QName"/> </annotation> <restriction base="anySimpleType"> <whiteSpace value="collapse"/> </restriction> </simpleType> <annotation> <documentation xml:lang="en"> Now the derived primitive types </documentation> </annotation> <simpleType name="CDATA" id="CDATA"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#CDATA"/> </annotation> <restriction base="string"> <whiteSpace value="replace"/> </restriction> </simpleType> <simpleType name="token" id="token"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#token"/> </annotation> <restriction base="CDATA"> <whiteSpace value="collapse"/> </restriction> </simpleType> <simpleType name="language" id="language"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#language"/> </annotation> <restriction base="token"> <pattern value="([a-zA-Z]{2}|[iI]-[a-zA-Z]+|[xX]-[a-zA-Z]+)(-[a-zA-Z]+)*" id="language.pattern"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/REC-xml#NT-LanguageID"> pattern matches production 33 from the XML spec </documentation> </annotation> </pattern> </restriction> </simpleType> <simpleType name="IDREFS" id="IDREFS"> <annotation> <appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <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"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/> </annotation> <list itemType="IDREF"/> </simpleType> <simpleType name="ENTITIES" id="ENTITIES"> <annotation> <appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <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"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/> </annotation> <list itemType="ENTITY"/> </simpleType> <simpleType name="NMTOKEN" id="NMTOKEN"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/> </annotation> <restriction base="token"> <pattern value="\c+" id="NMTOKEN.pattern"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/REC-xml#NT-Nmtoken"> pattern matches production 7 from the XML spec </documentation> </annotation> </pattern> </restriction> </simpleType> <simpleType name="NMTOKENS" id="NMTOKENS"> <annotation> <appinfo> <hfp:hasFacet name="length"/> <hfp:hasFacet name="minLength"/> <hfp:hasFacet name="maxLength"/> <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"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/> </annotation> <list itemType="NMTOKEN"/> </simpleType> <simpleType name="Name" id="Name"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#Name"/> </annotation> <restriction base="token"> <pattern value="\i\c*" id="Name.pattern"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/REC-xml#NT-Name"> pattern matches production 5 from the XML spec </documentation> </annotation> </pattern> </restriction> </simpleType> <simpleType name="NCName" id="NCName"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#NCName"/> </annotation> <restriction base="Name"> <pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/REC-xml-names/#NT-NCName"> pattern matches production 4 from the Namespaces in XML spec </documentation> </annotation> </pattern> </restriction> </simpleType> <simpleType name="NOTATION" id="NOTATION"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/> <documentation xml:lang="en"> 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. </documentation> <documentation xml:lang="en"> the value/lexical spaces of NOTATION are not the full value/lexical spaces of NOTATION even though there are no additional constraining facets. The true value/lexical spaces are limited to the set of names of NOTATIONs declared in the schema. </documentation> </annotation> <restriction base="QName"/> </simpleType> <simpleType name="integer" id="integer"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#integer"/> </annotation> <restriction base="decimal"> <scale value="0" fixed="true" id="integer.scale"/> </restriction> </simpleType> <simpleType name="nonPositiveInteger" id="nonPositiveInteger"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/> </annotation> <restriction base="integer"> <maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/> </restriction> </simpleType> <simpleType name="negativeInteger" id="negativeInteger"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/> </annotation> <restriction base="nonPositiveInteger"> <maxInclusive value="-1" id="negativeInteger.maxInclusive"/> </restriction> </simpleType> <simpleType name="long" id="long"> <annotation> <appinfo> <hfp:hasProperty name="bounded" value="true"/> <hfp:hasProperty name="cardinality" value="finite"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#long"/> </annotation> <restriction base="integer"> <minInclusive value="-9223372036854775808" id="long.minInclusive"/> <maxInclusive value="9223372036854775807" id="long.maxInclusive"/> </restriction> </simpleType> <simpleType name="int" id="int"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#int"/> </annotation> <restriction base="long"> <minInclusive value="-2147483648" id="int.minInclusive"/> <maxInclusive value="2147483647" id="int.maxInclusive"/> </restriction> </simpleType> <simpleType name="short" id="short"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#short"/> </annotation> <restriction base="int"> <minInclusive value="-32768" id="short.minInclusive"/> <maxInclusive value="32767" id="short.maxInclusive"/> </restriction> </simpleType> <simpleType name="byte" id="byte"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#byte"/> </annotation> <restriction base="short"> <minInclusive value="-128" id="byte.minInclusive"/> <maxInclusive value="127" id="byte.maxInclusive"/> </restriction> </simpleType> <simpleType name="nonNegativeInteger" id="nonNegativeInteger"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/> </annotation> <restriction base="integer"> <minInclusive value="0" id="nonNegativeInteger.minInclusive"/> </restriction> </simpleType> <simpleType name="unsignedLong" id="unsignedLong"> <annotation> <appinfo> <hfp:hasProperty name="bounded" value="true"/> <hfp:hasProperty name="cardinality" value="finite"/> </appinfo> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/> </annotation> <restriction base="nonNegativeInteger"> <maxInclusive value="18446744073709551615" id="unsignedLong.maxInclusive"/> </restriction> </simpleType> <simpleType name="unsignedInt" id="unsignedInt"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/> </annotation> <restriction base="unsignedLong"> <maxInclusive value="4294967295" id="unsignedInt.maxInclusive"/> </restriction> </simpleType> <simpleType name="unsignedShort" id="unsignedShort"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/> </annotation> <restriction base="unsignedInt"> <maxInclusive value="65535" id="unsignedShort.maxInclusive"/> </restriction> </simpleType> <simpleType name="unsignedByte" id="unsignedBtype"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/> </annotation> <restriction base="unsignedShort"> <maxInclusive value="255" id="unsignedByte.maxInclusive"/> </restriction> </simpleType> <simpleType name="positiveInteger" id="positiveInteger"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/> </annotation> <restriction base="nonNegativeInteger"> <minInclusive value="1" id="positiveInteger.minInclusive"/> </restriction> </simpleType> <simpleType name="timeInstant" id="timeInstant"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#timeInstant"/> </annotation> <restriction base="recurringDuration"> <period value="P0Y" fixed="true" id="timeInstant.period"/> <duration value="P0Y" fixed="true" id="timeInstant.duration"/> </restriction> </simpleType> <simpleType name="time" id="time"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#time"/> </annotation> <restriction base="recurringDuration"> <period value="PT24H" fixed="true" id="time.period"/> <duration value="P0Y" fixed="true" id="time.duration"/> </restriction> </simpleType> <simpleType name="timePeriod" id="timePeriod"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#timePeriod"/> </annotation> <restriction base="recurringDuration"> <period value="P0Y" fixed="true" id="timePeriod.period"/> </restriction> </simpleType> <simpleType name="date" id="date"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#date"/> </annotation> <restriction base="timePeriod"> <duration value="PT24H" fixed="true" id="date.duration"/> </restriction> </simpleType> <simpleType name="month" id="month"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#month"/> </annotation> <restriction base="timePeriod"> <duration value="P1M" fixed="true" id="month.duration"/> </restriction> </simpleType> <simpleType name="year" id="year"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#year"/> </annotation> <restriction base="timePeriod"> <duration value="P1Y" fixed="true" id="year.duration"/> </restriction> </simpleType> <simpleType name="century" id="century"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#century"/> </annotation> <restriction base="timePeriod"> <period value="P100Y" fixed="true" id="century.period"/> </restriction> </simpleType> <simpleType name="recurringDate" id="recurringDate"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#recurringDate"/> </annotation> <restriction base="recurringDuration"> <period value="P1Y" fixed="true" id="recurringDate.period"/> <duration value="P24H" fixed="true" id="recurringDate.duration"/> </restriction> </simpleType> <simpleType name="recurringDay" id="recurringDay"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#recurringDay"/> </annotation> <restriction base="recurringDuration"> <period value="P1M" fixed="true" id="recurringDay.period"/> <duration value="P24H" fixed="true" id="recurringDay.duration"/> </restriction> </simpleType> <complexType name="simpleType" abstract="true"> <complexContent> <extension base="annotated"> <sequence> <element ref="simpleDerivation"/> </sequence> <attribute name="name" type="NCName"> <annotation> <documentation xml:lang="en"> Can be restricted to required or forbidden </documentation> </annotation> </attribute> </extension> </complexContent> </complexType> <complexType name="topLevelSimpleType"> <complexContent> <restriction base="simpleType"> <sequence> <element ref="annotation" minOccurs="0"/> <element ref="simpleDerivation"/> </sequence> <attribute name="name" use="required" type="NCName"> <annotation> <documentation xml:lang="en"> Required at the top level </documentation> </annotation> </attribute> </restriction> </complexContent> </complexType> <complexType name="localSimpleType"> <complexContent> <restriction base="simpleType"> <sequence> <element ref="annotation" minOccurs="0"/> <element ref="simpleDerivation"/> </sequence> <attribute name="name" use="prohibited"> <annotation> <documentation xml:lang="en"> Forbidden when nested </documentation> </annotation> </attribute> </restriction> </complexContent> </complexType> <element name="simpleType" substitutionGroup="redefinable" type="topLevelSimpleType" id="simpleType"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/> </annotation> </element> <element name="simpleDerivation" abstract="true" type="annotated"/> <group name="simpleRestrictionModel"> <sequence> <element name="simpleType" type="localSimpleType" minOccurs="0"/> <element ref="facet" minOccurs="0" maxOccurs="unbounded"/> </sequence> </group> <element name="restriction" substitutionGroup="simpleDerivation" id="restriction"> <complexType> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-restriction"> base attribute and simpleType child are mutually exclusive, but one or other is required </documentation> </annotation> <complexContent> <extension base="annotated"> <group ref="simpleRestrictionModel"/> <attribute name="base" type="QName" use="optional"/> </extension> </complexContent> </complexType> </element> <element name="list" substitutionGroup="simpleDerivation" id="list"> <complexType> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-list"> itemType attribute and simpleType child are mutually exclusive, but one or other is required </documentation> </annotation> <complexContent> <extension base="annotated"> <sequence> <element name="simpleType" type="localSimpleType" minOccurs="0"/> </sequence> <attribute name="itemType" type="QName" use="optional"/> </extension> </complexContent> </complexType> </element> <element name="union" substitutionGroup="simpleDerivation" id="union"> <complexType> <annotation> <documentation xml:lang="en" 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 </documentation> </annotation> <complexContent> <extension base="annotated"> <sequence> <element name="simpleType" type="localSimpleType" minOccurs="0" maxOccurs="unbounded"/> </sequence> <attribute name="memberTypes" use="optional"> <simpleType> <list itemType="QName"/> </simpleType> </attribute> </extension> </complexContent> </complexType> </element> <complexType name="facet"> <complexContent> <extension base="annotated"> <attribute name="value" use="required"/> <attribute name="fixed" type="boolean" use="optional"/> </extension> </complexContent> </complexType> <element name="facet" type="facet" abstract="true"/> <element name="minBound" abstract="true" substitutionGroup="facet"/> <element name="minExclusive" id="minExclusive" substitutionGroup="minBound"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/> </annotation> </element> <element name="minInclusive" id="minInclusive" substitutionGroup="minBound"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/> </annotation> </element> <element name="maxBound" abstract="true" substitutionGroup="facet"/> <element name="maxExclusive" id="maxExclusive" substitutionGroup="maxBound"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/> </annotation> </element> <element name="maxInclusive" id="maxInclusive" substitutionGroup="maxBound"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/> </annotation> </element> <complexType name="numFacet"> <complexContent> <restriction base="facet"> <sequence> <element ref="annotation" minOccurs="0"/> </sequence> <attribute name="value" type="nonNegativeInteger"/> </restriction> </complexContent> </complexType> <element name="precision" id="precision" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-precision"/> </annotation> <complexType> <complexContent> <restriction base="numFacet"> <sequence> <element ref="annotation" minOccurs="0"/> </sequence> <attribute name="value" type="positiveInteger"/> </restriction> </complexContent> </complexType> </element> <element name="scale" id="scale" type="numFacet" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-scale"/> </annotation> </element> <element name="length" id="length" type="numFacet" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-length"/> </annotation> </element> <element name="minLength" id="minLength" type="numFacet" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/> </annotation> </element> <element name="maxLength" id="maxLength" type="numFacet" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/> </annotation> </element> <element name="encoding" id="encoding" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-encoding"/> </annotation> <complexType> <complexContent> <restriction base="facet"> <sequence> <element ref="annotation" minOccurs="0"/> </sequence> <attribute name="value"> <simpleType> <restriction base="NMTOKEN"> <enumeration value="hex"> <annotation> <documentation xml:lang="en"> each (8-bit) byte is encoded as a sequence of 2 hexidecimal digits </documentation> </annotation> </enumeration> <enumeration value="base64"> <annotation> <documentation xml:lang="en"> value is encoded in Base64 as defined in the MIME RFC </documentation> </annotation> </enumeration> </restriction> </simpleType> </attribute> </restriction> </complexContent> </complexType> </element> <element name="period" id="period" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-period"/> </annotation> <complexType> <complexContent> <restriction base="facet"> <sequence> <element ref="annotation" minOccurs="0"/> </sequence> <attribute name="value" type="timeDuration"/> </restriction> </complexContent> </complexType> </element> <element name="duration" id="duration" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-duration"/> </annotation> <complexType> <complexContent> <restriction base="facet"> <sequence> <element ref="annotation" minOccurs="0"/> </sequence> <attribute name="value" type="timeDuration"/> </restriction> </complexContent> </complexType> </element> <element name="enumeration" id="enumeration" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/> </annotation> </element> <element name="whiteSpace" id="whiteSpace" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/> </annotation> <complexType> <complexContent> <restriction base="facet"> <sequence> <element ref="annotation" minOccurs="0"/> </sequence> <attribute name="value"> <simpleType> <restriction base="NMTOKEN"> <enumeration value="preserve"/> <enumeration value="replace"/> <enumeration value="collapse"/> </restriction> </simpleType> </attribute> </restriction> </complexContent> </complexType> </element> <element name="pattern" id="pattern" substitutionGroup="facet"> <annotation> <documentation xml:lang="en" source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/> </annotation> </element> </schema> |
<!-- DTD for XML Schemas: Part 2: Datatypes --> <!-- Id: datatypes.dtd,v 1.14 2000/10/23 08:58:09 ht Exp --> <!-- 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 % precision "%p;precision"> <!ENTITY % scale "%p;scale"> <!ENTITY % length "%p;length"> <!ENTITY % minLength "%p;minLength"> <!ENTITY % maxLength "%p;maxLength"> <!ENTITY % enumeration "%p;enumeration"> <!ENTITY % whiteSpace "%p;whiteSpace"> <!ENTITY % pattern "%p;pattern"> <!ENTITY % encoding "%p;encoding"> <!ENTITY % period "%p;period"> <!ENTITY % duration "%p;duration"> <!-- 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 % simpleTypeAttrs ""> <!ENTITY % maxExclusiveAttrs ""> <!ENTITY % minExclusiveAttrs ""> <!ENTITY % maxInclusiveAttrs ""> <!ENTITY % minInclusiveAttrs ""> <!ENTITY % precisionAttrs ""> <!ENTITY % scaleAttrs ""> <!ENTITY % lengthAttrs ""> <!ENTITY % minLengthAttrs ""> <!ENTITY % maxLengthAttrs ""> <!ENTITY % enumerationAttrs ""> <!ENTITY % whiteSpaceAttrs ""> <!ENTITY % patternAttrs ""> <!ENTITY % encodingAttrs ""> <!ENTITY % periodAttrs ""> <!ENTITY % durationAttrs ""> <!ENTITY % appinfoAttrs ""> <!ENTITY % documentationAttrs ""> <!-- 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)"> <!-- 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, precision, scale, length, maxLength, minLength, encoding, period 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 "%precision; | %scale;"> <!ENTITY % ordered "%bounds; | %numeric;"> <!ENTITY % unordered "%pattern; | %enumeration; | %whiteSpace; | %length; | %maxLength; | %minLength; | %encoding; | %period; | %duration;"> <!ENTITY % facet "%ordered; | %unordered;"> <!ENTITY % facetAttr "value CDATA #REQUIRED"> <!ENTITY % fixedAttr "fixed %boolean; #IMPLIED"> <!ENTITY % facetModel "(%annotation;)?"> <!ELEMENT %simpleType; ((%annotation;)?, (%restriction; | %list; | %union;))> <!ATTLIST %simpleType; name %NCName; #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 %precision; %facetModel;> <!ATTLIST %precision; %facetAttr; %fixedAttr; %precisionAttrs;> <!ELEMENT %scale; %facetModel;> <!ATTLIST %scale; %facetAttr; %fixedAttr; %scaleAttrs;> <!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; %whiteSpaceAttrs;> <!-- This one can be repeated --> <!ELEMENT %pattern; %facetModel;> <!ATTLIST %pattern; %facetAttr; %patternAttrs;> <!ELEMENT %encoding; %facetModel;> <!ATTLIST %encoding; %facetAttr; %fixedAttr; %encodingAttrs;> <!ELEMENT %period; %facetModel;> <!ATTLIST %period; %facetAttr; %fixedAttr; %periodAttrs;> <!ELEMENT %duration; %facetModel;> <!ATTLIST %duration; %facetAttr; %fixedAttr; %durationAttrs;> |
The following table shows the values of the fundamental facets for each built-in datatype.
Datatype | ordered | bounded | cardinality | numeric | ||
---|---|---|---|---|---|---|
primitive | string | false | false | countably infinite | false | |
boolean | false | false | finite | false | ||
float | true | true | finite | true | ||
double | true | true | finite | true | ||
decimal | true | false | countably infinite | true | ||
timeDuration | true | false | countably infinite | false | ||
recurringDuration | true | false | countably infinite | false | ||
binary | false | false | countably infinite | false | ||
uriReference | false | false | countably infinite | false | ||
ID | true | false | countably infinite | false | ||
IDREF | true | false | countably infinite | false | ||
ENTITY | true | false | countably infinite | false | ||
QName | true | false | countably infinite | false | ||
derived | CDATA | false | false | countably infinite | false | |
token | false | false | countably infinite | false | ||
language | false | false | countably infinite | false | ||
IDREFS | false | false | countably infinite | false | ||
ENTITIES | false | false | countably infinite | false | ||
NMTOKEN | false | false | countably infinite | false | ||
NMTOKENS | false | false | countably infinite | false | ||
Name | false | false | countably infinite | false | ||
NCName | false | false | countably infinite | false | ||
NOTATION | true | false | countably infinite | false | ||
integer | true | false | countably infinite | true | ||
nonPositiveInteger | true | false | countably infinite | true | ||
negativeInteger | true | false | countably infinite | true | ||
long | true | true | finite | true | ||
int | true | true | finite | true | ||
short | true | true | finite | true | ||
byte | true | true | finite | true | ||
nonNegativeInteger | true | false | countably infinite | true | ||
unsignedLong | true | true | finite | true | ||
unsignedInt | true | true | finite | true | ||
unsignedShort | true | true | finite | true | ||
unsignedByte | true | true | finite | true | ||
positiveInteger | true | false | countably infinite | true | ||
timeInstant | true | false | countably infinite | false | ||
time | true | false | countably infinite | false | ||
timePeriod | true | false | countably infinite | false | ||
date | true | false | countably infinite | false | ||
month | true | false | countably infinite | false | ||
year | true | false | countably infinite | false | ||
century | true | false | countably infinite | false | ||
recurringDate | true | false | countably infinite | false | ||
recurringDay | true | false | countably infinite | false |
The constraining facets are listed below with all the primitive and derived datatypes that they apply to.
length applies to the following datatypes:
minLength applies to the following datatypes:
maxLength applies to the following datatypes:
pattern applies to the following datatypes:
enumeration applies to the following datatypes:
maxInclusive applies to the following datatypes:
maxExclusive applies to the following datatypes:
minInclusive applies to the following datatypes:
minExclusive applies to the following datatypes:
precision applies to the following datatypes:
scale applies to the following datatypes:
encoding applies to the following datatypes:
duration applies to the following datatypes:
period applies to the following datatypes:
The two primitive datatypes described above, timeDuration, recurringDuration, and the five derived datatypes timeInstant, date, time, timePeriod, and recurringDate use lexical formats inspired by [ISO 8601]. This appendix provides more detail on the ISO formats and discusses some deviations from them for the datatypes defined in this specification.
[ISO 8601] "specifies the representation of dates in the Gregorian calendar and times and representations of periods of time". The Gregorian calendar includes dates prior to 1582 (the year it came into use as an ecclesiastical calendar). It should be pointed out that the datatypes described in this specification do not cover all the types of data covered by [ISO 8601], nor do they support all the lexical representations for those types of data.
[ISO 8601] lexical formats are described using "pictures" in which characters are used in place of digits. For recurringDuration and types derived from it, these characters have the following meanings:
For all the information items indicated by the above characters, leading zeros are required where indicated.
In addition to the above, certain characters are used as designators and appear as themselves in lexical formats.
In the lexical format for timeDuration the following characters are also used as designators and appear as themselves in lexical formats:
The values of the Year, Month, Day, Hour and Minutes components are not restricted but allow an arbitrary integer. Similarly, the value of the Seconds component allows an arbitrary decimal. Thus, the lexical format for timeDuration and datatypes derived from it does not follow the alternative format of § 5.5.3.2.1 of [ISO 8601].
[ISO 8601] supports a variety of "truncated" formats in which some of the characters on the left of specific formats, for example, the century, can be omitted. Truncated formats are, in general, not permitted for the datatypes defined in this specification with three exceptions. The time datatype uses a truncated format for timeInstant. By truncating the date information we represent an instant of time that recurs every day. Similarly, the recurringDate and recurringDay datatypes use left-truncated formats for date.
[ISO 8601] also supports a variety of "reduced" or right-truncated formats in which some of the characters to the right of specific formats, such as the time specification, can be omitted. Right truncated formats are also, in general, not permitted for the datatypes defined in this specification with the following exceptions: right-truncated representations of timePeriod are used as lexical representations for date, month, year and century.
An optional minus sign is allowed immediately preceding, without a space, the lexical representations for timeDuration, timeInstant and date.
To accommodate year values greater than 9999, more than four digits are allowed in the year representations of recurringDuration and datatypes derived from it. This follows [ISO 8601 Draft Revision].
A regular expressionR is a sequence of characters that denote a set of stringsL(R). When used to constrain a lexical space, a regular expressionR asserts that only strings in L(R) are valid literals for values of that type.
[Definition:] A
regular expression is composed from zero or more
branches, separated by |
characters.
For all branches S, and for all regular expressions T, valid regular expressions R are: | Denoting the set of strings L(R) containing: |
---|---|
(empty string) | the set containing just the empty string |
S | all strings in L(S) |
S|T | all strings in L(S) and all strings in L(T) |
[Definition:] A branch consists of zero or more pieces, concatenated together.
For all pieces S, and for all branches T, valid branches R are: | Denoting the set of strings L(R) containing: |
---|---|
S | all strings in L(S) |
ST | all strings st with s in L(S) and t in L(T) |
[Definition:] A piece is an atom, possibly followed by a quantifier.
For all atoms S and non-negative integers n, m such that n <= m, valid pieces R are: | Denoting the set of strings L(R) containing: |
---|---|
S | all strings in L(S) |
S? | the empty string, and all strings in L(S). |
S* | All strings in L(S?) and all strings st with s in L(S*) and t in L(S). ( all concatenations of zero or more strings from L(S) ) |
S+ | All strings st with s in L(S) and t in L(S*). ( all concatenations of one or more strings from L(S) ) |
S{n,m} | All strings st with s in L(S) and t in L(S{n-1,m-1}). ( All sequences of at least n, and at most m, strings from L(S) ) |
S{n} | All strings in L(S{n,n}). ( All sequences of exactly n strings from L(S) ) |
S{n,} | All strings in L(S{n}S*) ( All sequences of at least n, strings from L(S) ) |
S{0,m} | All strings st with s in L(S?) and t in L(S{0,m-1}). ( All sequences of at most m, strings from L(S) ) |
S{0,0} | The set containing only the empty string |
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 regular expression language defined by this specification. We welcome further input from implementors and schema authors on this issue.
[Definition:] A quantifier
is one of ?
, *
, +
,
{n,m}
or {n,}
, which have the meanings
defined in the table above.
[Definition:] An atom is either a normal character, a character class, or a parenthesized regular expression.
For all normal characters c, character classes C, and regular expressions S, valid atoms R are: | Denoting the set of strings L(R) containing: |
---|---|
c | the single string consisting only of c |
C | all strings in L(C) |
(S) | all strings in L(S) |
[Definition:] A metacharacter
is either .
, \
, ?
,
*
, +
, {
, }
(
, )
, [
or ]
.
These characters have special meanings in regular expressions,
but can be escaped to form atoms that denote the
sets of strings containing only themselves, i.e., an escaped
metacharacter behaves like a normal character.
[Definition:] A normal character is any XML character that is not a metacharacter. In regular expressions, a normal character is an atom that denotes the singleton set of strings containing only itself.
Note that a normal character can be represented either as itself, or with a character reference.
[Definition:] A character class is an atomR that identifies a set of charactersC(R). The set of strings L(R) denoted by a character class R contains one single-character string "c" for each character c in C(R).
A character class is either a character class escape or a character class expression.
[Definition:] A
character class expression is a character group surrounded
by [
and ]
characters. For all character
groups G, [G] is a valid character class
expression, identifying the set of characters
C([G]) = C(G).
[Definition:] A character group is either positive character group, a negative character group, or a character class subtraction.
[Definition:] A positive character group consists of one or more character ranges or character class escapes, concatenated together. A positive character group identifies the set of characters containing all of the characters in all of the sets identified by its constituent ranges or escapes.
For all character ranges R, all character class escapes E, and all positive character groups P, valid positive character groups G are: | Identifying the set of characters C(G) containing: |
---|---|
R | all characters in C(R). |
E | all characters in C(E). |
RP | all characters in C(R) and all characters in C(P). |
EP | all characters in C(E) and all characters in C(P). |
[Definition:]
A negative character group is a
positive character group preceded by the ^
character.
For all positive character groups P, ^P
is a valid negative character group, and C(^P)
contains all XML characters that are not in C(P).
[Definition:] A
character class subtraction is a character class expression
subtracted from a positive character group or
negative character group, using the -
character.
For any positive character group or negative character groupG, and any character class expressionC, G-C is a valid character class subtraction, identifying the set of all characters in C(G) that are not also in C(C).
[Definition:] A character rangeR identifies a set of characters C(R) containing all XML characters with Unicode code points in a specified range.
A single XML character is a character range that identifies the set of characters containing only itself. All XML characters are valid character ranges, except as follows:
[
, ]
, and \
characters are not
valid character ranges;
^
character is only valid at the beginning of a
positive character group if it is part of a
negative character group; and
-
character is a valid character range only at the
beginning or end of a positive character group.
A character range may also be written in the form s-e, identifying the set that contains all XML characters with Unicode code points greater than or equal to the code point of s, but not greater than the code point of e.
s-e is a valid character range iff:
\
^
\
or [
; and
NOTE: The code point of a single character escape is the code point of the single character in the set of characters that it identifies.
[Definition:] A character class escape is a short sequence of characters that identifies predefined character class. The valid character class escapes include the single character escapes, the multi-character escapes, and the category escapes.
[Definition:] A single character escape identifies a set containing a only one character -- usually because that character is difficult or impossible to write directly into a regular expression.
The valid single character escapes are: | Identifying the set of characters C(R) containing: |
---|---|
\n | the newline character (#xA) |
\r | the return character (#xD) |
\t | the tab character (#x9) |
\\ | \ |
\| | | |
\. | . |
\- | - |
\^ | ^ |
\? | ? |
\* | * |
\+ | + |
\{ | { |
\} | } |
\( | ( |
\) | ) |
\[ | [ |
\] | ] |
[Definition:] [Unicode3] defines a number of character properties
and provides mappings from code points to specific character properties.
The set containing all characters that have property X
,
can be identified with a category escape\p{X}
.
The complement of this set is specified with the
category escape\P{X}
.
([\P{X}]
= [^\p{X}]
).
NOTE: [Unicode3] is subject to future revision. For example, the mapping from code points to character properties might be updated. All minimally conforming processors must support the character properties defined in the version of the Unicode Standard that is current at the time this specification became a W3C Recommendation. However, implementors are encouraged to support the character properties defined in any future version of the Unicode Standard.
NOTE:
The syntax \p{X}
is the same as that used in
[Perl 5.6].
The following table specifies the main character properties (for more information, see Chapter 4 of [Unicode3]).
Category | Property | Meaning |
---|---|---|
Letters | L | All Letters |
Lu | Uppercase | |
Ll | Lowercase | |
Lt | Titlecase | |
Lm | Modifier | |
Lo | Other | |
Marks | M | All Marks |
Mn | Non-Spacing | |
Mc | Spacing Combining | |
Me | Enclosing | |
Numbers | N | All Numbers |
Nd | Decimal Digit | |
Nl | Letter | |
No | Other | |
Punctuation | P | All Punctuation |
Pc | Connector | |
Pd | Dash | |
Ps | Open | |
Pe | Close | |
Pi | Initial quote (can behave like Ps or Pe depending on usage) | |
Pf | Final quote (can behave like Ps or Pe depending on usage) | |
Po | Other | |
Separators | Z | All Separators |
Zs | Space | |
Zl | Line | |
Zp | Paragraph | |
Symbols | S | All Symbols |
Sm | Math | |
Sc | Currency | |
Sk | Modifier | |
So | Other | |
Other | C | All Others |
Cc | Control | |
Cf | Format | |
Co | Private Use | |
Cn | Not Assigned |
NOTE: The properties mentioned exclude theCs
property described in Chapter 4 of [Unicode3]. TheCs
property identifies [Unicode3] "surrogate" characters, which do not occur at the level of the "character abstraction" that XML instance documents operate on.
[Definition:] [Unicode3] groups code points into a number of blocks
such as Basic Latin (i.e., ASCII), Latin-1 Supplement, Hangul Jamo,
CJK Compatibility, etc.
The set containing all characters that have block name X
(with all white space stripped out),
can be identified with a block escape\p{IsX}
.
The compliment of this set is specified with the
block escape\P{IsX}
.
([\P{IsX}]
= [^\p{IsX}]
).
NOTE: [Unicode3] is subject to future revision. For example, the grouping of code points into blocks might be updated. All minimally conforming processors must support the blocks defined in the version of the Unicode Standard that is current at the time this specification became a W3C Recommendation. However, implementors are encouraged to support the blocks defined in any future version of the Unicode Standard.
NOTE:
The syntax \p{IsX}
is the same as that used in
[Perl 5.6].
For example, the block escape for identifying the
ASCII characters is \p{IsBasicLatin}
.
[Definition:] A multi-character escape provides a simple way to identify a commonly used set of characters:
Character sequence | Equivalent character class |
---|---|
. | [^\n\r] |
\s | [#x20\t\n\r] |
\S | [^\s] |
\i | [\p{L}\p{Nl}:_] |
\I | [^\i] |
\c | the set of characters matched by NameChar |
\C | [^\c] |
\d | \p{Nd} |
\D | [^\d] |
\w | [#x0000-#x10FFFF]-[\p{P}\p{S}\p{C}] (all characters except the set of "punctuation", "separator" and "control" characters) |
\W | [^\w] |
NOTE: The regular expression language defined here does not attempt to provide a general solution to "regular expressions" over [Unicode3] strings. In particular, it does not easily provide for matching sequences of base characters and combining marks. The language is targeted at support of "Level 1" features as defined in [Unicode Regular Expression Guidelines]. It is hoped that future versions of this specification will provide support for "Level 2" features.
Ed. Note: Priority Feedback Request
Future versions of this specification might allow non-significant white space embedded within a regular expression. The XML Schema Working Group welcomes feedback from implementors and schema authors on the advisability of including such white space.
The following have contributed material to this draft:
The editors acknowledge the members of the XML Schema Working Group, the members of other W3C Working Groups, and industry experts in other forums who have contributed directly or indirectly to the process or content of creating this document. The Working Group is particularly grateful to Lotus Development Corp. and IBM for providing teleconferencing facilities.
The current members of the XML Schema Working Group are:
Jim Barnette, Defense Information Systems Agency (DISA); David Beech, Oracle Corp.; Paul V. Biron, Health Level Seven; Don Box, DevelopMentor; Allen Brown, Microsoft; Lee Buck, TIBCO Extensibility; Charles E. Campbell, Informix; Wayne Carr, Intel; Peter Chen, Bootstrap Alliance and LSU; David Cleary, Progress Software; Mike Cokus, MITRE; Dan Connolly, W3C (staff contact); Roger L. Costello, MITRE; Ugo Corda, Xerox; Haavard Danielson, Progress Software; David Ezell, Hewlett Packard Company; David Fallside, IBM; Matthew Fuchs, Commerce One; Andrew Goodchild, Distributed Systems Technology Centre (DSTC Pty Ltd); Paul Grosso, ArborText, Inc; Martin Gudgin, DevelopMentor; Dave Hollander, Contivo (co-chair); Mary Holstege, Calico Commerce; Jane Hunter, Distributed Systems Technology Centre (DSTC Pty Ltd); Rick Jelliffe, Academia Sinica; Andrew Layman, Microsoft; Dmitry Lenkov, Hewlett Packard Company; Ashok Malhotra, IBM; Murray Maloney, Muzmo Communication, acting for Commerce One; John McCarthy, Lawrence Berkeley National Laboratory; Noah Mendelsohn, Lotus Development Corporation; Don Mullen, TIBCO Extensibility; Alex Milowski, Lexica LLC; Frank Olken, Lawrence Berkeley National Laboratory; Dave Peterson, Graphic Communications Association; Jonathan Robie, Software AG; Lew Shannon, NCR; C. M. Sperberg-McQueen, W3C (co-chair); Bob Streich, Calico Commerce; Henry S. Thompson, University of Edinburgh; Matt Timmermans, Microstar; Jim Trezzo, Oracle Corp.; Mark Tucker, Health Level Seven; Asir S. Vedamuthu, webMethods, Inc; Priscilla Walmsley, XMLSolutions; Norm Walsh, Sun Microsystems; Aki Yoshida, SAP AGThe XML Schema Working Group has benefited in its work from the participation and contributions of a number of people not currently members of the Working Group, including in particular those named below. Affiliations given are those current at the time of their work with the WG.
Paula Angerstein, Vignette Corporation; Gabe Beged-Dov, Rogue Wave Software; Greg Bumgardner, Rogue Wave Software; Dean Burson, Lotus Development Corporation; Andrew Eisenberg, Progress Software; Rob Ellman, Calico Commerce; George Feinberg, Object Design; Charles Frankston, Microsoft; Ernesto Guerrieri, Inso; Michael Hyman, Microsoft; Renato Iannella, Distributed Systems Technology Centre (DSTC Pty Ltd); Dianne Kennedy, Graphic Communications Association; Janet Koenig, Sun Microsystems; Setrag Khoshafian, Technology Deployment International (TDI); Ara Kullukian, Technology Deployment International (TDI); Murata Makoto, Xerox; Eve Maler, Sun Microsystems; Chris Olds, Wall Data; Shriram Revankar, Xerox; Mark Reinhold, Sun Microsystems; John C. Schneider, MITRE; William Shea, Merrill Lynch; Ralph Swick, W3C; Tony Stewart, Rivcom; Steph Tryphonas, Microstar