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 a two-part draft of the specification for the XML Schema definition language. This document proposes facilities for defining datatypes to be used in XML Schemas as well as other XML specifications. The datatype language, which is itself represented in XML 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 is an internal working draft for review by members of the Working Group.
It has not been reviewed by the XML Schema Working Group and the Working Group has not agreed to its publication. Note that not that all sections of the draft represent the current consensus of the WG. Different sections of the specification may well command different levels of consensus in the WG. Public comments on this draft will be instrumental in the WG's deliberations.
This working draft incorporates all WG decisions through 2000-08-02, and some decisions taken since then.
Although the Working Group does not anticipate further changes to the functionality described here, this is still a working draft, subject to change. The present version should be implemented only by those interested in providing a check on its design or by those preparing for an implementation of the Candidate Recommendation. The Schema WG will not allow early implementation to constrain its ability to make changes to this specification prior to final release.
During the Candidate Recommendation phase, although feedback based on implementation experience is welcome, there are certain aspects of the design presented herein where 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.
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] 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 may 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.5.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 (literals may appear as one or more character information items as defined in [XML Information Set]).
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.
While the dataypes 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. In such cases, this specification defines a [Definition:] canonical lexical representation, or canonical representation for short, which selects a set of literals from among the valid set of literals for the datatype such that each literal maps to a single value in the value space and vice-versa.
[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 spaceA and value spaceB where A and B are not related by , 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 base type. The value of length must be a nonNegativeInteger.
For string and datatypes derived from string, length is measured in units of [Unicode] code points. 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.
[Definition:] minLength is the minimum number of units of length, where units of length varies depending on the base type. The value of minLength must be a nonNegativeInteger.
For string and datatypes derived from string, minLength is measured in units of [Unicode] code points. For binary and datatypes derived from binary, minLength is measured in octets (8 bits) of binary data. For datatypes derived by list, length is measured in list items.
[Definition:] maxLength is the maximum number of units of length, where units of length varies depending on the base type. The value of maxLength must be a nonNegativeInteger.
For string and datatypes derived from string, maxLength is measured in units of [Unicode] code points. For binary and datatypes derived from binary, maxLength is measured in octets (8 bits) of binary data. For datatypes derived by list, length is measured in list items.
[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 ordered property of the datatype involved remains that of the base type.
[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, "20" is the hex encoding for the US-ASCII space character.
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] 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 may 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]).
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 may be used:
For each of the above facets, the unit of length is measured in number of list items.
The value space and lexical space of a union datatype are the union of the value spaces and lexical spaces of its input types. union datatypes are always derived. Currently, there are no built-inunion 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 may participate in a union type. The order in which the participating types are specified in the definition (that is, the order of the <simpleType> children of the <union> element) is significant. During validation, an element or attribute's value is validated against the participating types 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.8), 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>
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 distinquish 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.
[Definition:] Every derived datatype is defined in terms of an existing datatype, referred to as the base type. base types may be either primitive or derived.
In the example above, date is derived from the base typerecurringDuration.
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 the base type; or 3) by creating a union datatype whose value space consists of the union of the value space of two or more other datatypes.
The primitive datatypes defined by this specification are described below. For each datatype, the value space and lexical space are defined, constraining facets which apply to the datatype are listed and any datatypes derived from this datatype are specified.
primitive datatypes can only be added by revisions to this specification.
[Definition:] The string datatype represents character strings in XML. The value space of string is the set of finite-length sequences of UCS characters ([ISO 10646] and [Unicode]). A UCS character (or just character, for short) is an atomic unit of communication; it is not further specified except to note that every UCS character has a corresponding UCS code point, which is an integer.
NOTE: As noted in Order (§2.5.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" ande 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" ande 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.
Ed. Note: Priority Feedback Request
The use of arbitrary precision decimal numbers, including all datatypes derived from decimal (e.g., integer) in this design impacts the implementation of schema processors in a number of places: checking maxLength constraints on strings, for example. It may impact interchange between XML schemas and programming languages, databases, etc. Our design discussions did not reveal convincing evidence of undue burden because of arbitrary precision decimal numbers in this design, but we welcome further input from implementors.
decimal has a lexical representation
consisting of a finite-length sequence of decimal digits 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 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 stated as follows: for instances x and y of timeDuration, x-y is defined as component-wise subtraction. x > y iff all the components of x-y are non-negative and at least one component is positive. x < y iff all the components of x-y are non-positive and at least one component is negative. x = y iff all components of x-y are zero.
A single lexical representation, similar to the representations allowed by [ISO 8601], is allowed for timeDuration. This lexical representation 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, that is they do 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 are 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 timeDuration that recurs with a specific timeDuration starting from a specific origin. The order-relation on recurringDuration is: x < y iff y - x is positive.
Recurring duration 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 basetype from which the other date and time datatypes are generated. It can also be used as a basetype for user-derived datatypes. A user-derived datatype can be generated from recurringDuration by specifying the values for duration and period. The value that appears in an instance document is the value of the origin when the recurrence begins.
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:
Ed. Note: What does the pattern facet on binary really mean? Since pattern operates on the lexical space, one would have to give a regex for the base64 or hex that would result for a specific binary sequence that one wanted to constrain...this is not too far fetched for hex, but almost impossible for base64, isn't it?
[Definition:] uriReference represents a Uniform Resource Identifier (URI) Reference as defined in Section 4 of [RFC 2396]. A uriReference may be absolute or relative, and may have an optional fragment identifier.
[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]. 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]. 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]. 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:] NOTATION represents the NOTATION attribute type from [XML 1.0 Recommendation]. The value space of NOTATION is the set of all notations declared in a schema. The lexical space of NOTATION is the set of all strings that match the NCName production in [Namespaces in XML].
NOTE: The value space of NOTATION is scoped to a specific instance document.
For compatibility (see Terminology (§1.4)) NOTATION should be used only on attributes.
NOTATION 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-inderived 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-inderived datatypes are provided in Appendix Schema for Datatype Definitions (normative) (§A).
[Definition:] language represents natural language identifiers as defined by [RFC 1766]. The value space of language is the set of all strings that match the LanguageID production in [XML 1.0 Recommendation]. The lexical space of language is the set of all strings that match the LanguageID production in [XML 1.0 Recommendation]. The base type of language is string.
language has the following constraining facets:
[Definition:] IDREFS represents the IDREFS attribute type from [XML 1.0 Recommendation]. 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 base type 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]. 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 whitespace separated tokens, each of which is in the lexical space of NMTOKEN. The base type 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]. The value space of NMTOKEN is the set of tokens that match the Nmtoken production in [XML 1.0 Recommendation]. The lexical space of NMTOKEN is the set of strings that match the Nmtoken production in [XML 1.0 Recommendation]. The base type of NMTOKEN is string.
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]. The value space of NMTOKENS is the set of finite-length sequences of NMTOKENs. The lexical space of NMTOKENS is the set of whitespace separated tokens, each of which is in the lexical space of NMTOKEN. The base type 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]. The lexical space of Name is the set of all strings which match the Name production of [XML 1.0 Recommendation]. The base type of Name is string.
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:] 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 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.8.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. 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.9.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. For example: -1, -12678967543233, -100000.
The canonical representation for negativeInteger is defined by prohibiting certain options from the Lexical representation (§3.3.10.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. 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.11.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. 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.12.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. 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.13.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. 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.14.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.