<?xml version='1.0'?>
<?xml:stylesheet type='text/xsl' href='xmlschema.msxsl'?>
<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification::19990205//EN" "xmlspec-19990429.dtd" [
  <!ENTITY % versionEntities SYSTEM "versionInfo.ent">
  %versionEntities; <!-- get path and date entities -->
 <!ENTITY cellback '#d0d9fa'>
 <!ENTITY cellfront '#bedce6'>
 <!ENTITY xmlspec "http://www.w3.org/TR/REC-xml">
 <!ENTITY xmlnsspec "http://www.w3.org/TR/REC-xml-names/">
 <!ENTITY xslspec "http://www.w3.org/TR/WD-xsl/">
 <!ENTITY xsdl "../WD-xmlschema-1-19991217/structures.html">
 <!ENTITY rdfschspec "http://www.w3.org/TR/PR-rdf-schema/">
 <!ENTITY SchemaWG "<loc href='http://www.w3.org/XML/Activity#schema-wg'>W3C XML Schema Working Group</loc>">

 <!ENTITY year "&draft.year;">
 <!ENTITY mm "&draft.MM;">
 <!ENTITY MM "&draft.month;">
 <!ENTITY dd "&draft.DD;">
 <!ENTITY MMDD "&mm;&dd;">
 <!ENTITY iso.doc.date "&year;&MMDD;">

 <!ENTITY thisversion "&draft.base;/">
 <!ENTITY order "&#163;">
 <!ENTITY le "&#8804;"> <!-- less than or equal to, U+2264 ISOtech -->
 <!ENTITY ne "&#8800;"> <!-- not equal to, U+2260 ISOtech -->
 <!ENTITY infin "&#8734;"> <!-- infinity, U+221E ISOtech -->
 <!ENTITY times "&#215;"> <!-- multiplication, U+00D7 -->
 <!ENTITY sect   "&#xa7;">
 
	<!ELEMENT datatype (facet+)>
	<!ELEMENT facet (#PCDATA)>
]>
<spec>
<header>
<title>XML Schema Part 2: Datatypes</title>
<version></version>
    <w3c-designation>&WD-XSP2;-&iso.doc.date;</w3c-designation>
    <w3c-doctype>W3C Working Draft</w3c-doctype>
<pubdate><day>&dd;</day><month>&MM;</month><year>&year;<!--
Point release id: <code>$Id: datatypes.xml,v 1.23.1.10 1999/12/17 16:15:13 ht Exp $</code>--></year></pubdate>
<notice role="publoc">
<p>	(in <loc href='&XSP2.URI;.xml'>XML</loc> and
<loc href='&XSP2.base;/'>HTML</loc>,
	with accompanying <loc href='&XSP2.URI;.xsd'>schema</loc> and <loc href='&XSP2.URI;.dtd'>DTD</loc>)
</p>
</notice>
<publoc>
	<loc href='&XSP2.base;/'>
	&XSP2.base;/</loc>
<!--
	(in <loc href='&XSP2.URI;.xml'>XML</loc> and
<loc href='&XSP2.URI;.html'>HTML</loc>,
	with accompanying <loc href='&XSP2.URI;.xsd'>schema</loc> and <loc href='&XSP2.URI;.dtd'>DTD</loc>)
 -->
</publoc>
<prevlocs>
    <loc href="http://www.w3.org/TR/1999/WD-xmlschema-2-19991105/">http://www.w3.org/TR/1999/WD-xmlschema-2-19991105/</loc>
    <loc href='http://www.w3.org/TR/1999/WD-xmlschema-2-19990924/'>http://www.w3.org/TR/1999/WD-xmlschema-2-19990924/</loc>
	<loc href='http://www.w3.org/1999/05/06-xmlschema-2/'>
	http://www.w3.org/1999/05/06-xmlschema-2/</loc>
</prevlocs>
<latestloc>

	<loc href='http://www.w3.org/TR/xmlschema-2/'>http://www.w3.org/TR/xmlschema-2/</loc>

</latestloc>
<authlist>
<author>
<name>Paul V. Biron</name>
<affiliation>Kaiser Permanente, for Health Level Seven</affiliation>
<email href='mailto:Paul.V.Biron@kp.org'>Paul.V.Biron@kp.org</email>
</author>
<author>
<name>Ashok Malhotra</name>
<affiliation>IBM</affiliation>
<email href='mailto:petsa@us.ibm.com'>petsa@us.ibm.com</email>
</author>
</authlist>
    <status>
<p>This is a public working draft of XML Schema 1.0 for review by the
public and by members of the World Wide Web Consortium.
</p><p>
It has been reviewed by the XML Schema Working Group, and the Working
Group has agreed to its publication.  The WG believes this draft to be
`feature-complete': the functionality included here is substantially
complete and is expected to be stable.  We do not expect to add major
new functionality, or to make major changes to the functionality
described in this draft.  Some sections of the draft (in particular
those on conformance), and some aspects of the design (in particular
details of the transfer syntax for schemas), on the other hand, are
still rough and are expected to be revised.
</p><p>
The WG expects to spend January, 2000, working out details, clarifying
points of uncertainty that arise in the review of this draft, cleaning
up inconsistencies, reviewing the design of the concrete transfer
syntax, and making editorial improvements.
</p><p>
Following that period of review and polishing, it is the WG's intent
to issue a Last Call for Review by other W3C working groups sometime
during February, 2000, and to submit this specification in March,
2000, for publication as a Candidate Recommendation.  This schedule
may vary, depending on the comments of the public and of other W3C
working groups on this draft.  Such comments are instrumental in the
WG's deliberations, and we encourage readers to review the draft and send comments to
        <loc
         href="http://lists.w3.org/Archives/Public/www-xml-schema-comments/">www-xml-schema-comments@w3.org</loc>
(<loc href='http://lists.w3.org/Archives/Public/www-xml-schema-comments/'>archive</loc>).   
</p><p>
Although the Working Group does not anticipate further substantial
changes to the functionality described here, this is still a working
draft, subject to change based on experience and on comment by the
public and other W3C working groups.  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.  <emph>The Schema WG will not
allow early implementation to constrain its ability to make changes to
this specification prior to final release.</emph>
</p>
<p>
A list of current W3C working drafts can be found at
<loc href='http://www.w3.org/TR/'>http://www.w3.org/TR/</loc>. 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".
</p>
<ednote>
	<edtext>Several "note types" are used throughout this draft:
	<glist>
		<gitem><label>issue [Issue (issue-name): ]</label>
			<def>
			<p>something on which the editors are seeking comment.</p>
			</def>
		</gitem>
		<gitem><label>editorial note [Ed. Note: ]</label>
			<def>
				<p>something the editors wish to call to the attention of the
				reader. To be removed prior to the recommendation becoming final.</p>
			</def>
		</gitem>
		<gitem><label>note [Note: ]</label>
			<def>
				<p>something the editors wish to call to the attention of the reader.
				To remain in the final recommendation.</p>
			</def>
		</gitem>
	</glist>
	</edtext>
</ednote>
</status>
<abstract>
<p>
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 and 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.
</p>
</abstract>
<langusage>
<language id='EN'>English</language>
</langusage>
<revisiondesc>
<slist>
<!--
     commenting these out means only that they won't show up in the stylesheet
	 generated "Revisions from previous draft" appendix
  -->
<!-- Changes before Sept public draft commented out...
<sitem>
19990521: PVB: corrected definition of length and maxlengths facet for strings to
be in terms of <emph>characters</emph> not <emph>bytes</emph>
</sitem>
<sitem>
19990521: PVB: removed issue "other-date-representations".  We don't
want other separators, left mention of aggregate reps for dates as
an ednote.
</sitem>
<sitem>
19990521: PVB: fixed "holidays" example, "-0101" ==> "==0101"
(where == in the correction should be two hyphens, but that would
not allow us to comment out this sitem)
</sitem>
<sitem>
19990521: PVB: fixed "common date" example, lexicalRepresenation ==> lexicalRepresentation
</sitem>
<sitem>
19990521: PVB: added note that -YY-MM-DD style dates are deprecated
</sitem>
<sitem>
19990521: PVB: added termdef element around definition of subtype
</sitem>
<sitem>
19990521: PVB: removed "whose basetype is a built-in" from definition of
"user-generated" datatype
</sitem>
<sitem>
19990521: PVB: clarified that the length facet for binary datatype is
length in bytes
</sitem>
<sitem>
19990521: PVB: fixed weird spacing problems introduced by ArborText
</sitem>
<sitem>
19990521: PVB: fixed references to non-terminals in productions
</sitem>
<sitem>
19990524: AM: changed "boolean" to have a single lexical representation.
</sitem>
<sitem>
19990524: AM: added issue: "should we add a facet to restrict a binary
datatype to a user-defined format such as audio, image, etc."
</sitem>
<sitem>
19990524: AM: corrected reference to SQL standard.
</sitem>
<sitem>
19990524: AM: corrected definition of length and maximum length
facets to be a positive integer.
</sitem>
<sitem>
19990524: AM: corrected default format for integer, decimal and real.
</sitem>
<sitem>
19990524: AM: rewrote issue definition-overiding.
</sitem>
<sitem>
19990524: AM: edited Conformance section to add example of lexical
errors and fix reference to above issue.
</sitem>
<sitem>
19990601: PVB: changed date formats in examples of Section 1 to be conformant
with the date datatype
</sitem>
<sitem>
19990601: PVB: added a "for compatibility" terminology entry
</sitem>
<sitem>
19990601: PVB: added a Name datatype and redefined the XML 1.0 attribute types
in terms of it
</sitem>
<sitem>
19990601: PVB: remove "for attributes only" restriction on XML 1.0  attribute types.
Added a "for compatibility" clause for attribute values.
</sitem>
<sitem>
19990601: PVB: added language datatype
</sitem>
<sitem>
19990602: PVB: added uuid datatype
</sitem>
<sitem>
19990602: PVB: added NCName datatype
</sitem>
<sitem>
19990604: AM: changed date and time formats to allow only ISO 8601
extended format. Impacted sections on the date, time datatypes,
section 4, Appendix C.
</sitem>
<sitem>
19990604: AM: added ednote to string datatype saying we need to harmonize
with I18N character model.
</sitem>
<sitem>
19990604: PVB: added "Revisions from previous draft" appendix
</sitem>
<sitem>
19990604: PVB: moved "built-in generated" datatype definitions into the
schema for datatype definitions (instead of it being in its own appendix).
</sitem>
<sitem>
19990604: PVB: upadted the schema for datatype definitions to point to
the correct (per xmlschema-1) DTD and schema
</sitem>
<sitem>
19990623: AM: added paragraph to conformance section which begins
to be more precise about how conforming processors should behave
</sitem>
<sitem>
19990623: AM: removed confusing statement from conformance section
which said that " checking for lexical conformance is all that is
expected of an XML processor."
</sitem>
<sitem>
19990623: PVB: removed section on "Characterizing Operations" and
all references to it (or its content) in the rest of the draft.
</sitem>
<sitem>
19990623: PVB: removed uuid datatype
</sitem>
<sitem>
19990623: PVB: made NMTOKEN a primitive datatype and Name a
subtype of NMTOKEN.
</sitem>
<sitem>
19990623: PVB: corrected the basetypes of following XML-related
generated datatypes: IDREFS (from ID to IDREF), ENTITY (from ID to Name),
ENTITIES (from ID to ENTITY), NMTOKENS (from Name to NMTOKEN).
</sitem>
<sitem>
19990623: PVB: changed name of section "User-Generated Datatypes" to
the more correct "Defining Generated Datatypes".  Also added some
explanatory text to the beginning of that section which explains
that the abstract syntax there is used both for defining built-in
and user-generated datatypes.
</sitem>
<sitem>
19990623: PVB: added explanations of abstract and concrete
syntax (mostly borrowed from the structural draft) to section
"Defining Generated Datatypes".
</sitem>
<sitem>
19990623: PVB: separated references into those that are normative
and those that are non-normative
</sitem>
<sitem>
19990623: PVB: added a pointer to the draft revision of ISO 8601
in its bib entry
</sitem>
<sitem>
19990623: PVB: added "no-consensus" issues to those all sections
except "Type System" and "Built-in datatypes" stating that no WG
concensus has been reached on the section (the exclusions above
are because those sections which granted consensus status at the
Ann Arbor f2f)
</sitem>
<sitem>
19990623: PVB: cleaned up productions for numeric literals
</sitem>
<sitem>
19990624: PVB: excluded subsections 1.1 and 1.2 from the "no-consusus"
issue for section 1
</sitem>
<sitem>
19990630: PVB: removed number datatype, made real into a built-in
primitive, changed the basetype of decimal to real and the basetype
of integer to decimal.  Also added NaN, INF and -INF to the lexical
space of all numeric types.
</sitem>
<sitem>
19990630: PVB: added 2 new subtypes of integer: non-positive-integer
and non-negative-integer, each of which has 1 subtype: negative-integer
and positive-integer, respectively.  Added generated datatype definitions
for these to the schema for datatypes.
</sitem>
<sitem>
19990630: PVB: fixed typos in definition of IDREF and IDREFS
(was "the lexical space of ID is .." now "the lexical space of IDREF is ...")
</sitem>
<sitem>
19990630: PVB: added issue(non-negative-integer-literals)
</sitem>
<sitem>
19990630: PVB: added links to known subtypes in all datatype
descriptions
</sitem>
<sitem>
19990630: PVB: changed "no-consensus" issues to "no-consensus"
ednotes
</sitem>
<sitem>
19990630: PVB: changed "no-consensus" ednote for section 1 to
exclude subsection 1.3, as voted on during the telcon today
</sitem>
<sitem>
19990630: PVB: corrected several interal cross-references: from termref's
to specref's
</sitem>
<sitem>
19990630: PVB: added all previous drafts (internal as well as public WDs)
to the "Previous Versions" section.  In future public WDs only those
"previous versions" which were public WDs will display
</sitem>
<sitem>
19990630: PVB: changed "collection" to "set" in definition of "value space"
(thought this had been changed long ago, sorry)
</sitem>
<sitem>
19990708: PVB: removed section 1.5 "Organization", per WG vote on telcon
</sitem>
<sitem>
19990708: PVB: removed "no-consensus" ednote from section 1
</sitem>
<sitem>
19990709: PVB: added (stub) subsections on "Precision", "Scale" and "Encoding" to
section 2.4.2 "Constraining Facets".  All facets mentioned in all datatype
definitions in section 3 should be listed in 2.4.2. (this is not intended to address
the standing issue <xspecref href="http://www.w3.org/XML/Group/xmlschema-current/issues.html#constraining-facet-definitions">
constraining-facet-definitions</xspecref>, but was needed for the next revision item)
</sitem>
<sitem>
19990709: PVB: added "Datatypes and Facets" appendix which consists of
several tables which attempt to show which facets apply to which datatypes
</sitem>
<sitem>
19990713: PVB: fixed bug in schema for datatypes regarding modelGroup vs.
elementType Refs in unordered modelGroup
as per
<loc href='http://lists.w3.org/Archives/Public/www-xml-schema-comments/1999AprJun/0088.html'>
http://lists.w3.org/Archives/Public/www-xml-schema-comments/1999AprJun/0088.html</loc>
</sitem>
<sitem>
19990726: AM: Changed example of user-generated datatype from
heightInInches to i4.
</sitem>
<sitem>
19990726: AM: Rewrote "Exact and Approximate".
</sitem>
<sitem>
19990812: PVB: Removed all mention of picture constraints as lexical-representations
for strings
</sitem>
<sitem>
19990819: AM: Amended Ed. Note on a URL for the datatypes namespace
referring to Dan Connolly's note "make up your own".
</sitem>
<sitem>
19990819: AM: Removed issue on NULLS, 2 occurrences.
</sitem>
<sitem>
19990819: AM: Changed Ed. Note on "Better Ref Mechs" associated with
IDREFS to "issue"..
</sitem>
<sitem>
19990819: AM: Removed issue on measurement units as WG decided to
defer to version 2.
</sitem>
<sitem>
19990919: HT: modifed abstract syntax to better reflect intent?
</sitem>
<sitem>
19990923: HT: modified schema for schemas to conform to the concrete
syntax in the latest Structures draft
</sitem>
<sitem>
19990923: PVB: added minAbsoluteValue and maxAbsoluteValue facets to
real, their intent is to allow generation of subtypes of real whose
value spaces correspond to comment float-point representations.
Added examples to section 4 to show how to generate IEEE 32-bit, etc.
</sitem>
<sitem>
19990923: PVB: replaced dateTime, date, time and timePeriod with all
new date/time related types: timeInstant, timeDuration, recurringInstant,
date and time.  Additionally, limited the lexical representations of each
of the new types to a single form (w/ the exception of still allowing both
left truncation and reduced [i.e., right truncated] representations).
Changed all examples which used date/time to use the new lexical representation
</sitem>
<sitem>
19990923: PVB: modified the abstract syntax, schema for datatypes and DTD
for datatypes to bring them in line with above changes.
</sitem>
<sitem>
19990924: HST: link housekeeping before publication</sitem>
<sitem>
19991020: AM: Rewrote "NOTATION".
</sitem>
<sitem>
19991020: AM: Made NMTOKEN a subtype of string.
</sitem>
<sitem>
19991020: AM: Changed lex reps for all date and time datatypes to ISO
extended format i.e. with separators.
</sitem>
<sitem>
19991020: AM: Removed issue on non-Gregorian dates.
</sitem>
<sitem>
19991020: AM: Renamed "lexical representation" facet for string to "pattern".
</sitem>
 <sitem>
19991026: AM: Added appendix discussing ISO 8601 formats.  Removed note
asking for such explanation.
</sitem>
<sitem>
1999-10-26: PVB: fixed errors in datatypes.xsd and datatypes.dtd as pointed
out by <loc href="http://lists.w3.org/Archives/Public/www-xml-schema-comments/1999JulSep/0050.html">
Curt Arnold</loc>
</sitem>
<sitem>
1999-10-26: PVB: added period to the facets production
</sitem>
<sitem>
1999-10-26: PVB: added a note on the basetype to the definition of
datatype NMTOKEN
</sitem>
<sitem>
1999-10-26: PVB: removed NaN, INF and -INF from the lexical space
of integer and decimal
</sitem>
 End of commented out section -->
<sitem>
1999-11-08: PVB: removed real datatype and all references to it
</sitem>
<sitem>
1999-11-08: PVB: added inital definitions for float and double datatypes.
This initial definition is not intended to be complete, we need a more
complete description of the round-to-nearest behavior of mapping literals
into the value space (i.e., a more readable description of "best approximation"
from the Clinger paper in the non-normative references section).
</sitem>
<sitem>
1999-11-08: PVB: corrected typos in the definitions of datatypes generated
from integer to corrected identify the generated type
</sitem>
<sitem>
1999-11-08: PVB: added specref elements to all mentions of constraining facets
</sitem>
<sitem>
1999-11-08: PVB: added term elements to all mentions of a datatype name in
the definition of that datatype
</sitem>
<sitem>
1999-11-12: PVB: changed lexical space of timeDuration to be more consistent
with ISO 8601, nYnMnDTnHnMnS (minus the 'P' designator).
</sitem>
<sitem>
1999-11-12: PVB fixed productions for decimalLiteral to allow forms such as
-.12 and -23.
</sitem>
<sitem>
19991122: AM: Added some more explanation to timeDuration format.  Fixed
Appendix D to reflect changes.
</sitem>
<sitem>
19991122: AM: Added "uncountable infinite and exact" value space to 2.4.1.3
</sitem>
<sitem>
19991122: AM: Removed issue "Better Reference Mechanisms".
</sitem>
<sitem>
19991122: AM: Added "collation sequence for strings is Unicode characater number".
</sitem>
<sitem>
19991122: AM: Added min/max facets to date/time dataypes.
</sitem>
<sitem>
19991122: AM: Removed issues on URI and binary datatypes.
</sitem>
<sitem>
19991122: AM: Added value space validation to conformance section.
</sitem>
<sitem>
19991122: AM: Added values space definitions to date/time datatypes.
</sitem>
<sitem>
1999-12-08: pvb: Added QName datatype
</sitem>
<sitem>
1999-12-08: pvb: changed language to be a subtype of string
</sitem>
<sitem>
1999-12-10: pvb: many small editorial changes for consistency
</sitem>
<sitem>
1999-12-10: pvb: Added pattern facet to all date/time types (should
have been there all along)
</sitem>
<sitem>
1999-12-10: pvb: Added full list of facets and subtypes to each type
definition
</sitem>
<sitem>
1999-12-10: pvb: replaced regex appendix with a brief summary of proposed
Unicode support, complete proposal coming shortly
</sitem>
<sitem>
1999-12-10: pvb: moved some references from normative to non-normative
</sitem>
<sitem>
1999-12-10: pvb: changed concrete syntax for datatype defns to more closely
match the structures draft: in particular, to allow annotations on the
datatype element and all facet elements.
</sitem>
<sitem>
1999-12-15: pvb: added normaitive reference to RTC 2045 for def of base64
</sitem>
<sitem>
1999-12-15: pvb: many more small editorial changes, for consistency in
style and presentation
</sitem>
<sitem>
1999-12-15: pvb: corrected small errors in table in appendix C.1, Fundamental
facets
</sitem>
<sitem>
1999-12-15: pvb: filled out list of datatypes for each facet in appendix C.2,
Constraining facets
</sitem>
<sitem>
1999-12-15: expanded abstract
</sitem>
<sitem>
1999-12-15: pvb: updated description of lexical space for float/double to
include literals for +- inf, +- 0, nan.
</sitem>
<sitem>
1999-12-16: pvb: modified defns of ID, IDREF, IDREFS, ENTITY, ENTITIES
and NOTATION to match NCName instead of Name as required by the Namespaces
in XML spec
</sitem>
<sitem>
1999-12-16: pvb: fully specified value space for decimal
</sitem>
</slist>
</revisiondesc>
</header>
<body>
<div1 id='Intro'>
<head>Introduction</head>
<div2 id='purpose'>
<head>Purpose</head>
<p>
The <bibref ref='XML'/> specification defines limited
facilities for applying datatypes to document content in that documents
may contain or refer to DTDs that assign types to elements and attributes.
However, document authors, including authors of traditional
<emph>documents</emph> and those transporting <emph>data</emph> in XML,
often require a higher degree of type checking to ensure robustness in
document understanding and data interchange.
</p>
<p>
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.
</p>
<table border='1' bgcolor='&cellback;'>
<thead>
<tr>
<th align='center'>Data oriented</th>
<th align='center'>Document oriented</th>
</tr>
</thead>
<tbody>
<tr>
<td><eg><![CDATA[<invoice>
   <orderDate>1999-01-21</orderDate>
   <shipDate>1999-01-25</shipDate>
   <billingAddress>
      <name>Ashok Malhotra</name>
      <street>123 IBM Ave.</street>
      <city>Hawthorne</city>
      <state>NY</state>
      <zip>10532-0000</zip>
   </billingAddress>
   <voice>555-1234</voice>
   <fax>555-4321</fax>
</invoice>]]></eg></td>
<td><eg><![CDATA[<memo importance="high"
      date="1999-03-23">
   <from>Paul V. Biron</from>
   <to>Ashok Malhotra</to>
   <subject>Latest draft</subject>
   <body>
      We need to discuss the latest
      draft <emph>immediately</emph>.
      Either email me at <email>
      mailto:paul.v.biron@kp.org</email>
      or call <phone>555-9876</phone>
   </body>
</memo>]]></eg></td>
</tr>
</tbody>
</table>
<p>
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.
</p>
<p>
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.
</p>
</div2>
<div2 id='requirements'>
<head>Requirements</head>
<p>
The <bibref ref='schema-requirements'/> document spells out
concrete requirements to be fulfilled by this specification,
which state that the XML Schema Language must:
</p>
<olist>
<item>
<p>
provide for primitive data typing, including byte, date,
integer, sequence, SQL &amp; Java primitive data types, etc.;
</p>
</item>
<item>
<p>
define a type system that is adequate for import/export
from database systems (e.g., relational, object, OLAP);
</p>
</item>
<item>
<p>
distinguish requirements relating to lexical data representation
vs. those governing an underlying information set;
</p>
</item>
<item>
<p>
allow creation of user-defined datatypes, such as
datatypes that are derived from existing datatypes and which
may constrain certain of its properties (e.g., range,
precision, length, format).
</p>
</item>
</olist>
</div2>
<div2 id='scope'>
<head>Scope</head>
<p>
This portion of the XML Schema Language discusses datatypes that can be
used in a XML Schema.  These datatypes can be specified for element content
that would be specified as <xspecref href='&xmlspec;#dt-chardata'>#PCDATA</xspecref>
and attribute values of <xspecref href='&xmlspec;#sec-attribute-types'>various
types </xspecref> in a DTD.  It is the intension 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 <bibref ref='XSL'/> and <bibref ref='RDFSchema'/>.
</p>
<p>
For the most part, this specification discusses what are sometimes referred
to as <termref def='dt-atomic'/> datatypes in that they constrain the lexical representation
of a single literal.  In some cases, as for example in <specref ref='IDREFS'/>,
<specref ref='ENTITIES'/> and <specref ref='NMTOKENS'/>, the value may consist of a
list or set of literals separated by spaces. This is an example of what is
called an <termref def='dt-aggregate'/> datatype. Future versions of this specification
may contain a more general mechanism for <termref def='dt-aggregate'/>
(collection) datatypes
such as sets, bags and records.
</p>
<ednote>
<edtext>
The WG has voted to have a simple list aggregate construct.  A list will be
whitespace separated list of some atomic datatype.  There was not time to
incorporate that vote into this draft.  This vote will affect the
<specref ref='IDREFS'/>, <specref ref='ENTITIES'/>, and <specref ref='NMTOKENS'/>
types.  The list generator will be available to all schema authors.
</edtext>
</ednote>
</div2>
<div2 id='terminology'>
<head>Terminology</head>
<p>
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:
</p>
<glist>
<gitem id='compatibility'>
<label>For compatibility</label>
<def>
<p>
A feature of this specification included solely to ensure that
schemas which use this feature remain compatible with
<bibref ref='XML'/>
</p>
</def>
</gitem>
</glist>
<!--
<ednote>
<edtext>
if necessary, insert a terminology list (e.g., may,
must, datatype valid, etc.)
</edtext>
</ednote>
-->
</div2>
</div1>
<div1 id='typesystem'>
<head>Type System</head>
<p>
This section describes the conceptual framework behind the type system
defined in this specification.  The framework has been influenced by the
<bibref ref='ISO11404'/> standard on language-independent datatypes
as well as the datatypes for <bibref ref='SQL'/> and for programming languages
such as Java.
</p>
<p>
The datatypes discussed in this specification are computer representations
of well known abstract concepts such as <emph>integer</emph> and <emph>date</emph>.
It is not the place of this specification to define these abstract concepts;
many other publications provide excellent definitions.
</p>
<!--
<p>
Two concepts are essential for an understanding of datatypes as they
are discussed here: a <termref def='dt-value-space'/> is an abstract collection of
permitted values for a datatype. Each datatype also has a space of valid
lexical representations or literals, each of which denotes a single value.
A single value in the <termref def='dt-value-space'/> may
be denoted by several distinct valid literals.
</p>
-->
<div2 id='datatype'>
<head>Datatype</head>
<p>
<termdef id='dt-datatype' term='datatype'>In this specification,
a <term>datatype</term> is defined as a 3-tuple, consisting of
a) a set of distinct values, called its <termref def='dt-value-space'/>,
b) a set of lexical representations, called its <termref def='dt-lexical-space'/>,
and c) a set of facets that characterize properties of the
<termref def='dt-value-space'/>, individual values or lexical items.
</termdef>
</p>
</div2>
<div2 id='value-space'>
<head>Value space</head>
<p>
<termdef id='dt-value-space' term='value space'>A <term>value
space</term> is the set of permitted values for a given
datatype.</termdef>
</p>
<p>
The <termref def='dt-value-space'/> of a given datatype can
be defined in one of the following ways:
<ulist>
<item>
<p>enumerated outright (extensional definition)</p>
</item>
<item>
<p>
defined axiomatically from fundamental notions (intensional definition)
</p>
</item>
<item>
<p>
defined as the subset of values from an already defined
<termref def='dt-value-space'/> with a given set of properties
</p>
</item>
<item>
<p>
defined as a combination of values from some already defined
<termref def='dt-value-space'/>(s) by a specific construction procedure
</p>
</item>
</ulist>
</p>
<p>
<termref def='dt-value-space'/>s have certain properties.  For example,
they always have the property of <termref def='dt-cardinality'/>,
some definition of <emph>equality</emph>
and may be <termref def='dt-ordered'/> by which individual
values within the <termref def='dt-value-space'/> can be compared to one another.
</p>
</div2>
<div2 id='lexical-space'>
<head>Lexical space</head>
<p>
In addition to its <termref def='dt-value-space'/>, each datatype also has a lexical
space.
</p>
<p>
<termdef term='lexical space' id='dt-lexical-space'>A
<term>lexical space</term> is a set of valid <emph>literals</emph> for a datatype.
Each value in the datatype's <termref def='dt-value-space'/> is denoted by one or
more literals in its lexical space.</termdef>
</p>
<p>
For example, "100" and "1.0E2"
are two different literals from the <termref def='dt-lexical-space'/> of
<specref ref='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.
</p>
</div2>
<!--
     remove this entire section (and all references to it) for now...
	 we will reintroduce it later if we get EVERYTHING else done and
	 there is still time
	
<div2 id="characterizing-operations">
<head>Characterizing operations</head>
<p>
Many different datatypes may share the same <termref def='dt-value-space'/>.  As
a result, a datatype is only partially defined by its <termref def='dt-value-space'/>.
<termdef id="dt-characterizing-operations" term="characterizing operations">The
<term>characterizing operations</term> for a datatype are those operations (such as
"add" or "append") on or resulting in values of the datatype which distinguish
this datatype from other datatypes having <termref def='dt-value-space'/>s
which are identical
except possibly for substitution of symbols.</termdef>
</p>
<p>
Characterizing operations  can be useful in choosing the appropriate
datatype for particular purposes, such as mapping to or from common programming
languages or database environments.
</p>
<ednote>
<edtext>
Currently, no characterizing operations are defined on the
<termref def='dt-built-in'/> datatypes provided by this specification;
additionally, there is
no means to specify characterizing operations on <termref def='dt-user-generated'/>
datatypes.
This will be addressed in a future draft.
</edtext>
</ednote>
<p>
This discussion of characterizing operations in the definition
of datatype is for pedagogical purposes only and does <emph>not</emph>
imply that conforming processors must implement those operations, nor
does it imply that <emph>expressions</emph> (containing operators) which
evaluate to values of a given datatype will be accepted by conforming processors.
</p>
<div3 id="equal">
<head>Equal</head>
<p>
Every <termref def='dt-value-space'/> supports the notion of equality,
with	the following
rules:
</p>
<ulist>
<item>
<p>
for any two instances of values from the <termref def='dt-value-space'/> (a,b),
either a
is equal to b, denoted a = b, or a is not equal to b, denoted a &#8800; b;
</p>
</item>
<item>
<p>
there is no pair of instances (a, b) of values from the <termref def='dt-value-space'/>
such that both a = b and a &#8800; b;
</p>
</item>
<item>
<p>
for every value a from the <termref def='dt-value-space'/>, a = a;
</p>
</item>
<item>
<p>
for any two instances (a, b) of values from the <termref def='dt-value-space'/>,
a = b if and only if b = a;
</p>
</item>
<item>
<p>
for any three instances (a, b, c) of values from the <termref def='dt-value-space'/>,
if a = b and b = c, then a = c.
</p>
</item>
</ulist>
<p>
On every datatype, the operation Equal is defined in terms of the equality property of
the <termref def='dt-value-space'/>: for any values a, b drawn from the
<termref def='dt-value-space'/>, Equal(a,b) is true if a = b, and false otherwise.
</p>
</div3>
</div2>
  -->
<div2 id='datatype-dichotomies'>
<head>Datatype dichotomies</head>
<p>
It is useful to categorize the datatypes defined in this specification
along various dimensions, forming a set of characterization dichotomies.
</p>
<div3 id='atomic-vs-aggregate'>
<head>Atomic vs. aggregate datatypes</head>
<p>
The first distinction to be made is that between <termref def='dt-atomic'/>
and <termref def='dt-aggregate'/> datatypes.
</p>
<ulist>
<item>
<p>
<termdef id='dt-atomic' term='atomic'><term>Atomic</term> datatypes
are those having values which are intrinsically indivisible.</termdef>
</p>
</item>
<item>
<p>
<termdef id='dt-aggregate' term='aggregate'><term>Aggregate</term>
datatypes are those having values which can be decomposed into two
or more component values.</termdef>
</p>
</item>
</ulist>
<p>
For example, a date that is represented as a single character
string could be the value of an <termref def='dt-atomic'/> <emph>date</emph> datatype;
while
another date represented as separate "month", "day" and "year"
elements would be the value of an <termref def='dt-aggregate'/> <emph>date</emph>
datatype.
Not surprisingly, the distinction is analogous to that between
an XML element whose content model is #PCDATA and one with element content.
</p>
<p>
As discussed above, this specification focuses mainly on <termref def='dt-atomic'/>
datatypes.
Later versions of this specification may address <termref def='dt-aggregate'/>
datatypes in more detail.
Note that
the legacy XML attribute types <specref ref='IDREFS'/>, <specref ref='ENTITIES'/>
and <specref ref='NMTOKENS'/> are conceptually <termref def='dt-aggregate'/>
types (lists), although at present they are defined in this specification as
<termref def='dt-atomic'/>.
</p>
<p>
A datatype which is <termref def='dt-atomic'/> in this specification need not
be an "atomic" datatype in any programming language used to implement
this specification.
</p>
</div3>
<div3 id='primitive-vs-generated'>
<head>Primitive vs. generated datatypes</head>
<p>
Next, we distinquish between <termref def='dt-primitive'/> and 
<termref def='dt-generated'/> datatypes.
</p>
<ulist>
<item>
<p>
<termdef id='dt-primitive' term='primitive'><term>Primitive</term>
datatypes are those that are not defined in terms of other datatypes;
they exist <emph>ab initio</emph>.</termdef>
</p>
</item>
<item>
<p>
<termdef id='dt-generated' term='generated'><term>Generated</term>
datatypes are those that are defined in terms of other datatypes.</termdef>
</p>
</item>
</ulist>
<p>
For example, a <specref ref='float'/> is a well defined mathematical   <!--find example other than float -->
concept that cannot be defined in terms of other datatypes while
a <specref ref='date'/> is a special case of the more general datatype
<specref ref='recurringInstant'/>.
</p>
<p>
The datatypes defined by this specification fall into both
the <termref def='dt-primitive'/> and <termref def='dt-generated'/> categories.
It is felt that a judiciously
chosen set of <termref def='dt-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 generated.
</p>
<p>
A datatype which is <termref def='dt-primitive'/> in this specification need not
be a "primitive" datatype in any programming language used to implement
this specification.
Likewise, a datatype which is <termref def='dt-generated'/> in this specification
need not be a "generated" datatype in any programming language used to implement
this specification.
</p>
<!--
</div3>
<div3 id='basetype'>
<head>Basetype</head>
-->
<p>
<termdef id='dt-basetype' term='basetype'>Every <termref def='dt-generated'/>
datatype is defined in terms of an existing datatype, referred to as
the <term>basetype</term>.  <term>basetype</term>s may be either
<termref def='dt-primitive'/> or <termref def='dt-generated'/>.</termdef>
</p>
<p>
<termdef id='dt-subtype' term='subtype'>If type <emph>a</emph> is the
<termref def='dt-basetype'/> of type <emph>b</emph>, then <emph>b</emph>
is said to be a <term>subtype</term> of <emph>a</emph>.
The <termref def='dt-value-space'/> of a <term>subtype</term>
is a <emph>subset</emph> of the <termref def='dt-value-space'/>
of the <termref def='dt-basetype'/>.
</termdef>
</p>
<p>
In the example above, <specref ref='date'/>
is a <termref def='dt-subtype'/> of the <termref def='dt-basetype'/>
<specref ref='recurringInstant'/>.
</p>
</div3>
<div3 id='built-in-vs-user-generated'>
<head>Built-in vs. user-generated datatypes</head>
<ulist>
<item>
<p>
<termdef id='dt-built-in' term='built-in'><term>Built-in</term>
datatypes are those which are defined in this specification,
and may be either <termref def='dt-primitive'/> or <termref def='dt-generated'/>;
</termdef>
</p>
</item>
<item>
<p>
<termdef id='dt-user-generated' term='user-generated'><term>User-generated</term>
datatypes are those <termref def='dt-generated'/> datatypes that are defined by
individual schema designers by giving values to <termref def='dt-constraining'/>
facets.</termdef>
</p>
</item>
</ulist>
<p>
Conceptually there is no difference between the <termref def='dt-built-in'/>
<termref def='dt-generated'/>
datatypes included in this specification and the <termref def='dt-user-generated'/>
datatypes which will be created by individual schema designers.
The <termref def='dt-built-in'/> <termref def='dt-generated'/> 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 <termref def='dt-generated'/> datatypes in this specification
serves to demonstrate the mechanics and utility of the datatype
generation facilities of this specification.
</p>
<p>
A datatype which is <termref def='dt-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 <termref def='dt-user-generated'/> in this
specification need not
be a "user-generated" datatype in any programming language used to implement
this specification.
</p>
</div3>
</div2>
<div2 id='facets'>
<head>Facets</head>
<p>
<termdef id='dt-facet' term='facet'>A <term>facet</term> is a
single defining aspect of a concept or an object.  Generally speaking,
each facet characterizes a concept or object along independent aspects
or dimensions.</termdef>
</p>
<p>
The facets of a datatype serve to distinguish those aspects of
one datatype which <emph>differ</emph> 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 <emph>synthesis</emph> of facet values which together
determine the <termref def='dt-value-space'/> and properties of the datatype.
</p>
<p>
Facets are of two types: <emph>fundamental</emph> facets that define
the datatype and <emph>non-fundamental</emph> or <emph>constraining
</emph> facets that constrain the permitted values of a datatype.
</p>
<div3 id='fundamental-facets'>
<head>Fundamental facets</head>
<!--
					<issue id="facet-or-property">
						<p>
							Are the <bibref ref="ISO11404"/> notions of <specref
							ref="order"/>, <specref ref="bound"/>, etc. really
							facets as we've been talking about them, or are they
							<emph>properties</emph> which are logically derived
							from concrete values given for specific facets?
							(e.g., if a value is given for the <term>maxInclusive</term>
							facet then the datatype has the property of being
							<term>bounded</term>).
						</p>
					</issue>
  -->
<p>
Datatypes are characterized by properties of their <termref def='dt-value-space'/>.
Each of
these properties give rise to a facet that serves to characterize
the datatype.
These properties are discussed in this section.
</p>
<div4 id='order'>
<head>Order</head>
<p>
<termdef id='dt-ordered' term='ordered'>A <termref def='dt-value-space'/>, and hence
a datatype, is said to be <term>ordered</term> if there exists an
<term>order relation</term>
defined for that <termref def='dt-value-space'/>.</termdef>
</p>
<p>
<term>order relations</term>
have the following
rules:
</p>
<ulist>
<item>
<p>
for every pair (a, b) from the <termref def='dt-value-space'/>,
either a &lt; b or b &lt;
a, or a = b;
</p>
</item>
<item>
<p>
for every triple (a, b, c) from the <termref def='dt-value-space'/>,
if a &lt; b and
b &lt; c, then a &lt; c.
</p>
</item>
</ulist>
<!--
     remove all references to the section on characterizing-operations)
	 for now...
	 we will reintroduce it later if we get EVERYTHING else done and
	 there is still time
	
<p>
If a <termref def='dt-value-space'/> is ordered, then the datatype will have
a corresponding
<specref ref="characterizing-operations"/>, called InOrder(a, b), defined
by:
</p>
<ulist>
<item>
<p>
for every (a, b) from the <termref def='dt-value-space'/>,
InOrder(a, b) is true if a &le;
b, and false otherwise.
</p>
</item>
</ulist>
  -->
<p>
There may exist several possible order relations for a given
<termref def='dt-value-space'/>.
Additionally, there may exist multiple datatypes with the same
<termref def='dt-value-space'/>.
In such cases, each datatype will define a different order relation on the
<termref def='dt-value-space'/>.
</p>
<ednote>
<edtext>
Currently, no order relations are defined on the <termref def='dt-built-in'/>
datatypes provided by this specification; additionally, there is no means
to specify an order relation on <termref def='dt-user-generated'/> datatypes.
This will be addressed
in a future draft.
</edtext>
</ednote>
</div4>
<div4 id='bounds'>
<head>Bounds</head>
<p>
<termdef id='dt-bounded-above' term='bounded above'>
A <termref def='dt-value-space'/> is <term>bounded above</term>
if there exists a unique value <emph>U</emph> in the <termref def='dt-value-space'/>
such that,
for all values <emph>v</emph> in the <termref def='dt-value-space'/>,
<emph>v</emph> &le; <emph>U</emph>.
</termdef>
<termdef id='dt-upper-bound' term='upper bound'>
The value <emph>U</emph> is said to be an <term>upper bound</term> of the
<termref def='dt-value-space'/>.
</termdef>
</p>
<p>
<termdef id='dt-bounded-below' term='bounded below'>A
<termref def='dt-value-space'/> is <term>bounded below</term> if there exists a
unique value <emph>L</emph> in the space such that, for all values <emph>v</emph>
in the <termref def='dt-value-space'/>, <emph>L</emph> &le; <emph>v</emph>.
</termdef>
<termdef id='dt-lower-bound' term='lower bound'>
The value <emph>L</emph> is then said to be a  <term>lower bound</term> of
the <termref def='dt-value-space'/>.</termdef>
</p>
<p>
<termdef id='dt-bounded' term='bounded'>A datatype is <term>bounded</term> if
its <termref def='dt-value-space'/> has both an <termref def='dt-upper-bound'/>
and a
<termref def='dt-lower-bound'/>.
</termdef>
</p>
</div4>
<div4 id='cardinality'>
<head>Cardinality</head>
<p>
<termdef id='dt-cardinality' term='cardinality'>Every <termref def='dt-value-space'/>
has associated
with it the concept of <term>cardinality</term>.  Some <termref def='dt-value-space'/>s
are finite,
some are countably infinite while still others are uncountably infinite. A
datatype is said to have the cardinality of its <termref def='dt-value-space'/>.
</termdef>
</p>
<p>
It
is sometimes useful to categorize <termref def='dt-value-space'/>s
(and hence, datatypes) as
to their cardinality, there are three significant cases:
</p>
<ulist>
<item>
<p>
<termref def='dt-value-space'/>s that are finite
</p>
</item>
<item>
<p>
<termref def='dt-value-space'/>s that are countably infinite and exact
(see <specref ref='exact-approx'/>)
</p>
</item>
<item>
<p>
<termref def='dt-value-space'/>s that are countably infinite and approximate
(see <specref ref='exact-approx'/>)
</p>
</item>
<!--
<item>
<p>
<termref def='dt-value-space'/>s that are uncountably infinite and exact
(see <specref ref='exact-approx'/>)
</p>
</item>
-->
</ulist>
<p>
Every finite <termref def='dt-value-space'/> is necessarily exact. No computational
datatype has a <termref def='dt-value-space'/> that is is uncountably infinite.
</p>
</div4>
<div4 id='exact-approx'>
<head>Exact and Approximate</head>
<p>
The computational representation of a datatype may limit the degree
to which values of the datatype can be distinguished.
</p>
<p>
<termdef id='dt-exact' term='exact'>
If every
value in the <termref def='dt-value-space'/> of the conceptual datatype is distinguishable
in the computational representation from every other value in the
<termref def='dt-value-space'/>,
then the datatype is said to be <term>exact</term>.</termdef>
<termdef id='dt-approximate' term='approximate'>
If a datatype is not <term>exact</term> then it is <term>approximate</term>.</termdef>
</p>
<p>
Certain mathematical datatypes with very large or infinite value
spaces have representations which are said to be approximate in that
multiple values in the conceptual <termref def='dt-value-space'/> map to single values
in the <termref def='dt-value-space'/> of the representation.
In this specification, all approximate datatypes have computational
models which specify, via parametric values, a degree of approximation,
that is, they require a certain minimum set of values of the mathematical
datatype to be distinguishable in the computational datatype.
Further, each value in the conceptual <termref def='dt-value-space'/> must be capable
of being represented in the representational <termref def='dt-value-space'/>
within a certain
distance i.e. the difference between the conceptual value and the
representational value must not exceed some agreed upon value.
</p>
</div4>
<div4 id='numeric'>
<head>Numeric</head>
<p>
<termdef id='dt-numeric' term='numeric'>A datatype is said to be
<term>numeric</term> if its values are conceptually
quantities (in some mathematical number system).</termdef>
<termdef id='dt-non-numeric' term='non-numeric'>A datatype
whose values are not <termref def='dt-numeric'/> is said to be <term>non-numeric</term>
.</termdef>
</p>
</div4>
</div3>
<div3 id='non-fundamental'>
<head>Constraining or Non-fundamental facets</head>
<p>
<termdef id='dt-constraining' term='constraining'><term>Constraining</term>
facets are optional properties that can be applied
to a datatype to constrain its <termref def='dt-value-space'/>.</termdef>
</p>
<p>
Constraining
the <termref def='dt-value-space'/> consequently constrains the <termref def='dt-lexical-space'/>.
Adding constraining facets to a  <termref def='dt-basetype'/> is used in
<specref ref='defining-generated-datatypes'/>.
</p>
<p>
In this section we define all <termref def='dt-constraining'/> facets that
are available for use when generating subtypes.
</p>
<!--
					<issue id="instance-overriding">
						<p>
							should it be possible to specify a value for a non-fundamental
							facet on an element or attribute of a given datatype in an
							instance document (on an element-instance/attribute-instance
							basis)?  If so, what syntax should be used?
							This needs to be coordinated with
							the structural schema editorial team.
						</p>
					</issue>
					<issue id="definition-overriding">
						<p>
							should it be possible to specify a value for a non-fundamental
							facet in an element or attribute definition in a
							schema (see Section 3.4.4 of <bibref ref="structural-schemas"/>?
							If so, what syntax should be used?
							This needs to be coordinated with
							the structural schema editorial team.
						</p>
					</issue>
  -->
<div4 id='length'>
<head>length</head>
<p>
<termdef id='dt-length' term='length'><term>length</term> is
the number of <emph>units of length</emph>, where <emph>units of length</emph>
varies depending on the <termref def='dt-basetype'/>.
The value of <term>length</term> must be a
<specref ref='positive-integer'/>.
</termdef>
</p>
<p>
For subtypes of <specref ref='string'/>,
<term>length</term> is measured in units of characters.
For subtypes of <specref ref='binary'/>, <term>length</term>
is measured in bits.
</p>
<ednote>
<edtext>
We need to ultimately reconcile the notion of string length with the resolution
of the i18n issues around character, indexing, etc.  I18N recommends
that length and maxlength be a "character count" and do not indicate
storage requirements.
</edtext>
</ednote>
</div4>
<div4 id='minlength'>
<head>minlength</head>
<p>
<termdef id='dt-minlength' term='minlength'><term>minlength</term> is
the minimum number of <emph>units of length</emph>, where <emph>units of length</emph>
varies depending on the <termref def='dt-basetype'/>.
The value of <term>minlength</term> must be a
<specref ref='positive-integer'/>.</termdef>
</p>
<p>
For subtypes of <specref ref='string'/>,
<term>minlength</term> is measured in units of characters.
For subtypes of <specref ref='binary'/>, <term>minlength</term>
is measured in bits.
</p>
<constraintnote type='cos' id='length-minlength'>
<head>length and minlength</head>
<p>
It is an error for both <termref def='dt-length'/>
and <termref def='dt-minlength'/> to be specified
for the same datatype.
</p>
</constraintnote>
</div4>
<div4 id='maxlength'>
<head>maxlength</head>
<p>
<termdef id='dt-maxlength' term='maxlength'><term>maxlength</term> is
the maximum number of <emph>units of length</emph>, where <emph>units of length</emph>
varies depending on the <termref def='dt-basetype'/>.
The value of <term>maxlength</term> must be a
<specref ref='positive-integer'/>.</termdef>
</p>
<p>
For subtypes of <specref ref='string'/>,
<term>maxlength</term> is measured in units of characters.
For subtypes of <specref ref='binary'/>, <term>maxlength</term>
is measured in bits.
</p>
<constraintnote type='cos' id='length-maxlength'>
<head>length and maxlength</head>
<p>
It is an error for both <termref def='dt-length'/>
and <termref def='dt-maxlength'/> to be specified
for the same datatype.
</p>
</constraintnote>
</div4>
<div4 id='pattern'>
<head>pattern</head>
<p>
<termdef id='dt-pattern' term='pattern'>
For subtypes of <specref ref='string'/>, <term>pattern</term>
can be used to constrain the allowable values using <specref ref='regexs'/>.
For subtypes of the date and time related types (<specref ref='timeInstant'/>, <specref ref='timeDuration'/>,
<specref ref='recurringInstant'/>, <specref ref='date'/> and <specref ref='time'/>),
<term>pattern</term> can be used to constrain the allowable values using
IS0 8601 "pictures" (<specref ref='formatdetails'/>).
</termdef>
</p>
</div4>
<div4 id='enumeration'>
<head>enumeration</head>
<p>
<termdef id='dt-enumeration' term='enumeration'>
<term>enumeration</term> constrains the <termref def='dt-value-space'/> of the
datatype to the specified list.</termdef>
No order or any other
relationship is implied between the elements of the enumeration list.
</p>
<p>
<termref def='dt-enumeration'/> can be applied to all datatypes exception for
the following:
<specref ref='boolean'/> and
<specref ref='binary'/>.
<!--
<specref ref='string'/>,
<specref ref='float'/>, <specref ref='double'/>, <specref ref='timeInstant'/>,
<specref ref='timeDuration'/>,
<specref ref='recurringInstant'/>,
<specref ref='language'/>,
<specref ref='NMTOKEN'/>,
<specref ref='Name'/>,
<specref ref='NCName'/>,
<specref ref='ENTITY'/>,
<specref ref='NOTATION'/>,
<specref ref='decimal'/>,
<specref ref='integer'/>,
<specref ref='non-negative-integer'/>,
<specref ref='positive-integer'/>,
<specref ref='non-positive-integer'/>,
<specref ref='negative-integer'/>,
<specref ref='date'/>,
<specref ref='time'/>.
-->
</p>
</div4>
<div4 id='maxInclusive'>
<head>maxInclusive</head>
<p>
<termdef id='dt-maxInclusive' term='maxInclusive'>
<term>maxInclusive</term> is the <termref def='dt-upper-bound'/>
of the <termref def='dt-value-space'/> for a datatype with the
<termref def='dt-ordered'/>
property.  The value is <emph>inclusive</emph> in the sense that
the value is itself included in the <termref def='dt-value-space'/>.
The value of <term>maxInclusive</term> must be of the same type
as the <termref def='dt-basetype'/>.</termdef>
</p>
</div4>
<div4 id='maxExclusive'>
<head>maxExclusive</head>
<p>
<termdef id='dt-maxExclusive' term='maxExclusive'>
<term>maxExclusive</term> is the <termref def='dt-upper-bound'/>
of the <termref def='dt-value-space'/> for a datatype with the
<termref def='dt-ordered'/>
property.  The value is <emph>exclusive</emph> in the sense that
the value is itself excluded from the <termref def='dt-value-space'/>.
The value of <term>maxExclusive</term> must be of the same type
as the <termref def='dt-basetype'/>.</termdef>
</p>
<constraintnote type='cos' id='maxInclusive-maxExclusive'>
<head>maxInclusive and maxExclusive</head>
<p>
It is an error for both <termref def='dt-maxInclusive'/>
and <termref def='dt-maxExclusive'/> to be specified
for the same datatype.
</p>
</constraintnote>
</div4>
<div4 id='minInclusive'>
<head>minInclusive</head>
<p>
<termdef id='dt-minInclusive' term='minInclusive'>
<term>minInclusive</term> is the <termref def='dt-lower-bound'/>
of the <termref def='dt-value-space'/> for a datatype with the
<termref def='dt-ordered'/>
property.  The value is <emph>inclusive</emph> in the
sense that the value is itself included in the <termref def='dt-value-space'/>.
The value of <term>minInclusive</term> must be of the same type
as the <termref def='dt-basetype'/>.</termdef>
</p>
</div4>
<div4 id='minExclusive'>
<head>minExclusive</head>
<p>
<termdef id='dt-minExclusive' term='minExclusive'>
<term>minExclusive</term> is the <termref def='dt-lower-bound'/>
of the <termref def='dt-value-space'/> for a datatype with the
<termref def='dt-ordered'/>
property.  The value is <emph>exclusive</emph> in the sense that
the value is itself excluded from the <termref def='dt-value-space'/>
for the datatype.
The value of <term>minExclusive</term> must be of the same type
as the <termref def='dt-basetype'/>.</termdef>
</p>
<constraintnote type='cos' id='minInclusive-minExclusive'>
<head>minInclusive and minExclusive</head>
<p>
It is an error for both <termref def='dt-minInclusive'/>
and <termref def='dt-minExclusive'/> to be specified
for the same datatype.
</p>
</constraintnote>
</div4>
<div4 id='precision'>
<head>precision</head>
<p>
<termdef id='dt-precision' term='precision'><term>precision</term>
is the total number of decimal digits in values of subtypes of
<specref ref='decimal'/>.  The value of <term>precision</term>
must be a <specref ref='positive-integer'/>.
</termdef>
</p>
</div4>
<div4 id='scale'>
<head>scale</head>
<p>
<termdef id='dt-scale' term='scale'><term>scale</term>
is the total number of decimal digits to the right of the decimal
point in values of subtypes of <specref ref='decimal'/>.
The value of <term>scale</term> must be a <specref ref='positive-integer'/> .
</termdef>
<constraintnote type='cos' id='scale-precision'>
<head>scale less or equal to precision</head>
<p>
It is an error for <termref def='dt-scale'/> to be greater than
<termref def='dt-precision'/>.
</p>
</constraintnote>
</p>
</div4>
<div4 id='encoding'>
<head>encoding</head>
<p>
<termdef id='dt-encoding' term='encoding'><term>encoding</term> is the
encoded form of the <termref def='dt-lexical-space'/> of <specref ref='binary'/>.
The value of <term>encoding</term> must be one of {hex, base64} <bibref ref='RFC2045'/>.
</termdef>
</p>
</div4>
<div4 id='period'>
<head>period</head>
<p>
<termdef id='dt-period' term='period'><term>period</term> is the frequency
of recurrence for values of subtypes of <specref ref='recurringInstant'/>.
The value of <term>period</term> must be <specref ref='timeDuration'/>.
</termdef>
</p>
</div4>
</div3>
</div2>
</div1>
<div1 id='built-in-datatypes'>
<head>Built-in datatypes</head>

<div2 id='namespaces'>
<head>Namespace considerations</head>
<p>
The <termref def='dt-built-in'/> datatypes defined by this specification
are designed so that systems other than the XML Schema Definition Language
may use them. To facilitate such usage, the <termref def='dt-built-in'/>
datatypes in this specification come from the XML Datatype Language namespace,
the specific namespace defined by this specification.  This applies to both
<termref def='dt-built-in'/> <termref def='dt-primitive'/> and
<termref def='dt-built-in'/> <termref def='dt-generated'/> datatypes.
</p>
<ednote>
<edtext>
The exact URIs for the namespace(s) defined by this W3C specification
is still an open issue. This issue has been raised with the XML Coordination
Group (issue 1999-0201-07 Standardizing W3C namespace  URIs) for general
coordination and resolution.  On August 11, Dan Connolly recommended
we make up our own URI for datatypes.
See <loc href='http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/1999Aug/0060.html'>
http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/1999Aug/0060.html 
(Member only)</loc>.
</edtext>
</ednote>
<p>
Each <termref def='dt-user-generated'/> datatype is also associated with a
unique namespace.
However, <termref def='dt-user-generated'/> datatypes do not come from the
XML Datatype Language
namespace; rather, they come from the namespace of the schema in which they
are defined <xspecref href='&xsdl;#def-tns'>Association of components with
a target namespace</xspecref> in <bibref ref='structural-schemas'/>.
</p>
<p>
As described in more detail in <specref ref='defining-generated-datatypes'/>,
each <termref def='dt-user-generated'/> datatype must be defined in terms
of another datatype, by assigning facets which serve to constrain the value
set of the <termref def='dt-user-generated'/> datatype to a subset of the
<termref def='dt-basetype'/>.
</p>
</div2>
<div2 id='built-in-primitive-datatypes'>
<head>Primitive datatypes</head>
<p>
The <termref def='dt-primitive'/> datatypes defined by this specification
are described below.  For each datatype, the <termref def='dt-value-space'/>
and <termref def='dt-lexical-space'/> are specified, all
<termref def='dt-constraining'/> facets which apply to the datatype are
enumerated and <termref def='dt-subtype'/>, if any, defined by this specification
are listed.
</p>
<p>
<termref def='dt-primitive'/> datatypes can only be added by revisions to this
specification.
</p>
<div3 id='string'>
<head>string</head>
<p>
<termdef id='dt-string' term='string'>The <term>string</term>
datatype represents character strings in XML.  The <termref def='dt-value-space'/>
of <term>string</term> is the set of finite sequences of UCS characters
(<bibref ref='ISO10646'/> and <bibref ref='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.
The <termref def='dt-ordered'/> property of <term>string</term> is
the <bibref ref='Unicode'/> character number sequence.
</termdef>
</p>
<ednote>
<edtext>
We need to harmonize this definition with the I18N character model.
</edtext>
</ednote>
<div4>
<head>Constraining facets of string</head>
<p>
<term>string</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of string</head>
<p>
<term>string</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='NMTOKEN'/></p></item>
<item><p><specref ref='language'/></p></item>
</ulist>
</div4>
<!--
<datatype name='string'>
	<subtype>NMTOKEN</subtype>
	<subtype>language</subtype>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='boolean'>
<head>boolean</head>
<p>
<termdef id='dt-boolean' term='boolean'><term>boolean</term>
has the <termref def='dt-value-space'/> required to support
the mathematical concept of binary-valued
logic: {true, false}.</termdef>
</p>
<div4 id='boolean-lexical-representation'>
<head>Lexical Representation</head>
<p>
An instance of a datatype that is defined as <termref def='dt-boolean'/>
can have the following legal lexical values {true, false}.
</p>
</div4>
</div3>
<div3 id="float">
<head>float</head>
<p>
<termdef id='dt-float' term='float'><term>float</term> corresponds
to the IEEE single-precision 32-bit floating point type <bibref ref="ieee754"/>.
The basic <termref def='dt-value-space'/> of <term>float</term> consists of
the values <emph>m &times; 2^e</emph>, where <emph>m</emph> is an <specref ref='integer'/>
whose absolute value is less than <emph>2^24</emph>, and <emph>e</emph> is an
<specref ref='integer'/> between -149 and 104, inclusive.  In addition to
the basic <termref def='dt-value-space'/> described above, the
<termref def='dt-value-space'/> of <term>float</term> also
contains the following <emph>special values</emph>: positive and negative zero,
positive negative infinity and not-a-number.
</termdef>
</p>
<p>
The mapping from a literal in the <termref def='dt-lexical-space'/> to a value
in the <termref def='dt-value-space'/> of
<term>float</term> follows IEEE <emph>round to nearest</emph> behavior
<bibref ref="ieee754"/>.  For further information on mapping literals to values in
the <termref def='dt-value-space'/>, see <bibref ref='clinger1990'/>.
</p>
<div4 id="float-lexical-representation">
<head>Lexical representation</head>
<p>
<term>float</term> values have a single standard lexical representation consisting of
a mantissa followed, optionally, by the character "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 default
lexical rules for <specref ref='integer'/> and <specref ref='decimal'/>.
If the "E" and the the following exponent are omitted, an exponent
value of 1 is assumed.
</p>
<p>
The <emph>specical values</emph> positive and negative zero, positive
and negative infinity and not-a-number have <code>0</code>, <code>-0</code>, <code>INF</code>,
<code>-INF</code> and <code>NAN</code>, respectively.
</p>
<p>
For example, <code>-1E4, 1267.43233E12, 12.78E-2, 12 and INF</code> are all legal
literals for <term>float</term>.
</p>
</div4>
<div4>
<head>Constraining facets of float</head>
<p>
<term>float</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
<!--
<datatype name='float'>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div4>
</div3>
<div3 id="double">
<head>double</head>
<p>
<termdef id='dt-double' term='double'>The <term>double</term> datatype corresponds
to IEEE double-precision 64-bit floating point type <bibref ref="ieee754"/>.
The basic <termref def='dt-value-space'/> of <term>double</term> consists of the values 
<emph>m &times; 2^e</emph>, where <emph>m</emph> is an <specref ref='integer'/>
whose absolute value is less than <emph>2^53</emph>, and <emph>e</emph> is an
<specref ref='integer'/> between -1075 and 970, inclusive.  In addition to the
basic <termref def='dt-value-space'/> described above,
the <termref def='dt-value-space'/> of <term>double</term> also contains the following
<emph>special values</emph>: positive and negative zero, positive
negative infinity and not-a-number.
</termdef>
</p>
<p>
The mapping from a literal in the <termref def='dt-lexical-space'/> to a value in
the <termref def='dt-value-space'/> of <term>double</term> follows IEEE <emph>round
to nearest</emph> behavior <bibref ref="ieee754"/>.  For further information on
mapping literals to values in the <termref def='dt-value-space'/>, see
<bibref ref='clinger1990'/>.
</p>
<div4 id="double-lexical-representation">
<head>Lexical representation</head>
<p>
<term>double</term> values have a single standard lexical representation consisting of
a mantissa followed, optionally, by the character "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 default
lexical rules for integer and decimal numbers discussed above.
If the "E" and the the following exponent are omitted, an exponent
value of 1 is assumed.
</p>
<p>
The <emph>specical values</emph> positive and negative zero, positive
and negative infinity and not-a-number have <code>0</code>, <code>-0</code>, <code>INF</code>,
<code>-INF</code> and <code>NAN</code>, respectively.
</p>
<p>
For example, <code>-1E4, 1267.43233E12, 12.78E-2, 12 and INF</code> are all legal
literals for <term>double</term>.
</p>
</div4>
<div4><head>Constraining facets of double</head>
<p>
<term>double</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
<!--
<datatype name='double'>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div4>
</div3>
<div3 id='decimal'>
<head>decimal</head>
<p>
<termdef id='dt-decimal' term='decimal'><term>decimal</term>
represents arbitrary precision decimal numbers.
The <termref def='dt-value-space'/> of <term>decimal</term>
consists of the values <emph role='equation'>i &times; 10^n</emph>,
where <emph role='equation'>i</emph> is an <specref ref='integer'/>
and <emph role='equation'>n</emph> is an <specref ref='integer'/>.
</termdef>
</p>
<div4 id='decimal-lexical-representation'>
<head>Lexical representation</head>
<p>
<term>decimal</term> has a single standard lexical representation.
This consists of a finite 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.
 For example: -1.23,
12678967.543233, +100000.00.
</p>
</div4>
<div4>
<head>Constraining facets of decimal</head>
<p>
<term>decimal</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-precision'/></p></item>
<item><p><termref def='dt-scale'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of decimal</head>
<p>
<term>decimal</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='integer'/></p></item>
</ulist>
<!--
<datatype name='decimal'>
	<subtype>integer</subtype>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
	<facet>precision</facet>
	<facet>scale</facet>
</datatype>
-->
</div4>
</div3>
<div3 id="timeInstant">
<head>timeInstant</head>
<p>
<termdef id="dt-timeInstant" term="timeInstant"><term>timeInstant</term>
represents a combination of date and time values representing a single
instant in time.
The <termref def='dt-value-space'/> of <term>timeInstant</term> is the space of Gregorian dates
and legal time values as defined in &sect; 5.4 of <bibref ref="ISO8601"/>.</termdef>
</p>
<div4 id="timeInstant-lexical-repr">
<head>Lexical Representation</head>
<p>
A single lexical representation, which is a subset of the lexical
representations allowed by <bibref ref="ISO8601"/>, is allowed for <term>timeInstant</term>.
This lexical representation is the <bibref ref="ISO8601"/>
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 accomodate year values greater than 9999 additional digits can be added
to the left of this representation.
</p>
<p>
This representation can be immediately followed by a "Z" to indicate
Coordinated Universal Time.  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 <specref ref="isoformats"/>.</p>
<p>
For example, to indicate 1:20 pm on May the 31st, 1999 for Eastern Standard Time
which is 5 hours behind Coordinated Universal Time, one
would write: 1999-05-31T13:20:00-05:00.
</p>
</div4>
<!--
<div4 id="timeInstant-truncated-repr">
<head>Truncated Representations</head>
<p>Left truncated forms of the above representation are used as the lexical
representation for the <specref ref="recurringInstant"/> datatype and
its subtype <specref ref="time"/>.
Right truncated forms of this representation are used as the lexical
representation for the datatype <specref ref="date"/>.</p>
</div4>
  -->
<div4>
<head>Constraining facets of timeInstant</head>
<p>
<term>timeInstant</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
<!--
<datatype name='timeInstant'>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div4>
</div3>
<div3 id="timeDuration">
<head>timeDuration</head>
<p>
<termdef id="dt-timeDuration" term="timeDuration"><term>timeDuration</term>
represents a duration of time.
The <termref def='dt-value-space'/> of <term>timeDuration</term> is the space of time durations
as defined in &sect; 5.5.3.2 of <bibref ref="ISO8601"/>.
</termdef>
</p>
<div4 id="timeDuration-lexical-repr">
<head>Lexical Representation</head>
<p>
A single lexical representation, conforming to a subset of the 
representations allowed by <bibref ref="ISO8601"/>, is allowed for <term>timeDuration</term>.
This lexical representation is the <bibref ref="ISO8601"/>
extended format PnYnMnDTnHnMnnS, where <emph>Y</emph> represents the number
of years, <emph>M</emph> the number of months, <emph>D</emph> the number of
days, <emph>T</emph> is the date/time separator, <emph>H</emph> the number of hours, <emph>M</emph> the number of minutes and
<emph>S</emph> the number of seconds.  The number of seconds can include decimal digits to arbitrary precision.  An optional preceding minus sign is allowed to indicate a negative duration.  If the sign is omitted a positive duration is
indicated. See also <specref ref="isoformats"/>.
</p>
<p>
For example, to indicate a duration of 1 year, 2 months, 3 days, 10
hours, and 30 minutes, one would write: 1Y2M3DT10H30M.
</p>
<p>Right truncated forms of the above representation are allowed. For example,
P1347Y and P1347M are both allowed; P0Y1347M is also allowed. 
P0Y1347M0D is not allowed and P-1347M is not allowed although -P1347M is
allowed.</p>
<p>
Time periods, i.e. specific durations of time, can be represented by supplying
two items of information: a start instant and a duration or a start instant and
an end instant or an end instant and a duration.
</p>
</div4>
<div4>
<head>Constraining facets of timeDuration</head>
<p>
<term>timeDuration</term> also has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
<!--
<datatype name='timeDuration'>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div4>
</div3>
<div3 id="recurringInstant">
<head>recurringInstant</head>
<p>
<termdef id="dt-recurringInstant" term="recurringInstant"><term>recurringInstant</term>
represents an instant of time that recurs with a specific
<specref ref="timeDuration"/>.</termdef>
</p>
<p>
Note that we do not attempt to support
general recurring instants of time, just those that needed to support
<specref ref="date"/> and <specref ref="time"/> and those
that arise from truncated and reduced lexical representations of
<specref ref="timeInstant"/>. See also <specref ref="isoformats"/>.
</p>
<div4 id="recurringInstant-lexical-repr">
<head>Lexical Representation</head>
<p>
The lexical representation for <term>recurringInstant</term> is the left truncated
<bibref ref="ISO8601"/> representation for <specref ref="timeInstant"/>.
For example, if the century "CC" is omitted from the timeInstant
representation it means a timeInstant that recurs every hundred years.
Similarly, if "CCYY" is omitted it designates a time instant that recurs
every year.
</p>
<p>
Every two character "unit" of the representation that is omitted is indicated by
a single hyphen "-".  For example, to indicate 1:20 pm on May the 31st
every year, one would write write: --05-31T13:20:00-05:00.
</p>
</div4>
<div4>
<head>Constraining facets of recurringInstant</head>
<p>
<term>recurringInstant</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-period'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of recurringInstant</head>
<p>
<term>recurringInstant</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref="date"/></p></item>
<item><p><specref ref="time"/></p></item>
</ulist>
<!--
<datatype name='recurringInstant'>
	<subtype>date</subtype>
	<subtype>time</subtype>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
	<facet>period</facet>
</datatype>
-->
</div4>
</div3>
<!--
<div3 id="recurringDuration">
<head>recurringDuration</head>
<p>
<termdef id="dt-recurringDuration" term="recurringDuration"> The
<term>recurringDuration</term> datatype represents an duration of time
that recurs with at a specific <specref ref="timeDuration"/>.  Note that we
do not attempt to support general recurring durations of time, just those
that we need to support the <specref ref="date"/> and <specref ref="time"/>
datatypes and those that arise from truncated lexical representations of
<specref ref="timeDuration"/>.
</p>
<div4 id="recurringDuration-lexical-repr">
<head>Lexical Representation</head>
<p>
The lexical representation for recurringDuration is the left truncated <bibref ref="ISO8601"/>
representation for <specref ref="timeDuration"/>.
For example, if the century "CC" is omitted from the timeInstant
representation it means a timeDuration that recurs every hundred years.
Another way of interpreting such a representation is to assume it refers
to a single duration in the current century.  Similarly, if "CCYY" is omitted it designates a
time duration that recurs every year.  Alternatively, it designates
a time instant for the current year.
</p>
</div4>
</div3>
  -->
<div3 id='binary'>
<head>binary</head>
<p>
<termdef id='dt-term' term='binary'><term>binary</term>
represents binary data.  The <termref def='dt-value-space'/> of <term>binary</term>
is the set of finite sequences of binary bits.
</termdef>
</p>
<div4>
<head>Constraining facets of binary</head>
<p>
<term>binary</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-encoding'/></p></item>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
</ulist>
</div4>
<!--
<datatype name='binary'>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>encoding</facet>
</datatype>
-->
</div3>
<div3 id='uri'>
<head>uri</head>
<p>
<termdef id='dt-uri' term='uri'><term>uri</term>
represents a Uniform Resource Identifier (URI) Reference as defined
in <bibref ref='RFC2396'/>.
</termdef>
</p>
<!-- <issue id='uri-scheme-facet'>
<p>
should we have a facet to allow a limitation to a specific scheme?  It
might be useful to able to say that something was not only a URI, but that
it was a "mailto" and not a "http://...".
</p>
</issue> -->
<div4>
<head>Constraining facets of uri</head>
<p>
<term>uri</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
<!--
<datatype name='uri'>
	<facet>enumeration</facet>
</datatype>
-->
</div4>
</div3>
<!--
     remove uuid datatype for now...
	 we might reintroduce it later if we get EVERYTHING else done and
	 there is still time

<div3 id="uuid">
<head>uuid</head>
<p>
<termdef id="dt-uuid" term="uuid">The <term>uuid</term> datatype
represents Universally Unique IDentifiers as defined in <bibref ref="uuids"/>.
The <termref def='dt-value-space'/> of the uuid datatype is the set of 128-bit sequences, groupped
into 16 octects, where some bits of octet 8 (called the variant field)
determine finer structure (see <bibref ref="uuids"/> for a complete description).
The lexical space of the uuid datatype is the set of all 36 character
strings where the 9th, 14th, 19th and 24th characters are "-" and all other
characters are hexidecimal digits.</termdef>
</p>
<p>
The <term>uuid</term> datatype has no fundamental or constraining facets.
</p>
</div3>
  -->
</div2>
<div2 id='built-in-generated'>
<head>Generated datatypes</head>
<p>
This section gives conceptual definitions for all <termref def='dt-built-in'/>
<termref def='dt-generated'/>
datatypes defined by this specification.
The <termref def='key-abstractSyntax'/>
used to define <termref def='dt-generated'/> datatypes (whether
<termref def='dt-built-in'/> or <termref def='dt-user-generated'/>) is
given in section <specref ref='defining-generated-datatypes'/> and the complete
definitions of the <termref def='dt-built-in'/> <termref def='dt-generated'/>
datatypes (written in the <termref def='key-concreteSyntax'/> based on that
abstract syntax given in Appendix <specref ref='schema'/>) are provided in Appendix
<specref ref='schema'/>.
</p>
<div3 id='language'>
<head>language</head>
<p>
<termdef id='dt-language' term='language'><term>language</term>
represents natural language identifiers as defined by <bibref ref='RFC1766'/>.
The <termref def='dt-value-space'/> of <term>language</term> is the set of all
strings that match the <xnt href='&xmlspec;#NT-LanguageID'>LanguageID</xnt>
production in <bibref ref='XML'/>.
The <termref def='dt-lexical-space'/> of <term>language</term> is the set
of all strings that match the <xnt href='&xmlspec;#NT-LanguageID'>LanguageID</xnt>
production in <bibref ref='XML'/>.  The <termref def='dt-basetype'/> of
<term>language</term> is <specref ref='string'/>.
</termdef>
</p>
<div4>
<head>Constraining facets of language</head>
<p>
<term>language</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
</div4>
<!--
<datatype name='language' source='string'>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='NMTOKEN'>
<head>NMTOKEN</head>
<p>
<termdef id='dt-NMTOKEN' term='NMTOKEN'><term>NMTOKEN</term> represents the
<xnt href='&xmlspec;#NT-TokenizedType'>NMTOKEN attribute type</xnt> from
<bibref ref='XML'/>.
The <termref def='dt-value-space'/> of <term>NMTOKEN</term> is the set
of all strings that match the <xnt href='&xmlspec;#NT-Nmtoken'>Nmtoken</xnt>
production in <bibref ref='XML'/>. The <termref def='dt-lexical-space'/>
of <term>NMTOKEN</term> is the set of all strings that match
the <xnt href='&xmlspec;#NT-Nmtoken'>Nmtoken</xnt> production in
<bibref ref='XML'/>.  The <termref def='dt-basetype'/> of <term>NMTOKEN</term>
is <specref ref='NMTOKENS'/>.
</termdef>
</p>
<p>
For compatibility (see <specref ref='terminology'/>) <term>NMTOKEN</term> should
be used only on attributes.
</p>
<div4>
<head>Constraining facets of NMTOKEN</head>
<p>
<term>NMTOKEN</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of NMTOKEN</head>
<p>
<term>NMTOKEN</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='Name'/></p></item>
</ulist>
</div4>
<!--
<datatype name='NMTOKEN' source='NMTOKENS'>
	<subtype>Name</subtype>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='NMTOKENS'>
<head>NMTOKENS</head>
<p>
<termdef id='dt-NMTOKENS' term='NMTOKENS'><term>NMTOKENS</term> represents the
<xnt href='&xmlspec;#NT-TokenizedType'>NMTOKENS attribute type</xnt> from
<bibref ref='XML'/>.  It consists of a whitepsace-separated list of NMTOKENs.
The <termref def='dt-value-space'/> of <term>NMTOKENS</term> is the set of
all strings that match the <xnt href='&xmlspec;#NT-Nmtokens'>Nmtokens</xnt>
production in <bibref ref='XML'/>.
The <termref def='dt-lexical-space'/> of <term>ID</term> is the set of all
strings that match the <xnt href='&xmlspec;#NT-Nmtokens'>Nmtokens</xnt> production
in <bibref ref='XML'/>.
The <termref def='dt-basetype'/> of <term>NMTOKENS</term> is
<specref ref='string'/>.</termdef>
</p>
<p>
For compatibility (see <specref ref='terminology'/>) <term>NMTOKENS</term> should
be used only on attributes.
</p>
<div4>
<head>Constraining facets of NMTOKENS</head>
<p>
<term>NMTOKENS</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of NMTOKENS</head>
<p>
<term>NMTOKENS</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='NMTOKEN'/></p></item>
</ulist>
</div4>
<!--
<datatype name='NMTOKENS' source='string'>
	<subtype>NMTOKEN</subtype>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='Name'>
<head>Name</head>
<p>
<termdef id='dt-Name' term='Name'><term>Name</term>
represents <xspecref href='&xmlspec;#dt-name'>XML Names</xspecref>.
The <termref def='dt-value-space'/> of <term>Name</term>
the set of all strings which match the <xspecref href='&xmlspec;#NT-Name'>
Name</xspecref> production of <bibref ref='XML'/>.  The
<termref def='dt-lexical-space'/> of <term>Name</term> is the set of all
strings which match the
<xnt href='&xmlspec;#NT-Name'>Name</xnt> production of
<bibref ref='XML'/>. The <termref def='dt-basetype'/> of <term>Name</term>
is <specref ref='NMTOKEN'/>.</termdef>
</p>
<div4>
<head>Constraining facets of Name</head>
<p>
<term>Name</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of Name</head>
<p>
<term>Name</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='QName'/></p></item>
<item><p><specref ref='NCName'/></p></item>
</ulist>
</div4>
<!--
<datatype name='Name' source='NMTOKEN'>
	<subtype>ID</subtype>
	<subtype>NCName</subtype>
	<subtype>QName</subtype>
	<subtype>NOTATION</subtype>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='QName'>
<head>QName</head>
<p>
<termdef id='dt-QName' term='QName'><term>QName</term>
represents <xspecref href='&xmlnsspec;#dt-qname'>XML qualified names</xspecref>.
The <termref def='dt-value-space'/> of <term>QName</term>
is the set of all strings which match the <xspecref href='&xmlnsspec;#NT-QName'>
QName</xspecref> production of <bibref ref='XMLNS'/>.  The
<termref def='dt-lexical-space'/> of
<term>QName</term> is the set of all strings which match the
<xnt href='&xmlnsspec;#NT-QName'>QName</xnt> production of
<bibref ref='XMLNS'/>.  The <termref def='dt-basetype'/> of <term>QName</term>
is <specref ref='Name'/>. </termdef>
</p>
<div4>
<head>Constraining facets of QName</head>
<p>
<term>QName</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
</div4>
<!--
<datatype name='QName' source='Name'>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='NCName'>
<head>NCName</head>
<p>
<termdef id='dt-NCName' term='NCName'><term>NCName</term>
represents XML "non-colonized" Names.  The <termref def='dt-value-space'/>
of <term>NCName</term> is
the set of all strings which match the <xspecref href='&xmlnsspec;#NT-NCName'>
NCName</xspecref> production of <bibref ref='XMLNS'/>.  The
<termref def='dt-lexical-space'/> of
<term>NCName</term> is the set of all strings which match the
<xnt href='&xmlnsspec;#NT-NCName'>NCName</xnt> production of
<bibref ref='XMLNS'/>.  The <termref def='dt-basetype'/> of <term>NCName</term>
is <specref ref='Name'/>. </termdef>
</p>
<div4>
<head>Constraining facets of NCName</head>
<p>
<term>NCName</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of NCName</head>
<p>
<term>NCName</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='ID'/></p></item>
<item><p><specref ref='NOTATION'/></p></item>
</ulist>
</div4>
<!--
<datatype name='NCName' source='Name'>
	<subtype>ID</subtype>
	<subtype>NOTATION</subtype>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='ID'>
<head>ID</head>
<p>
<termdef id='dt-ID' term='ID'><term>ID</term> represents the
<xnt href='&xmlspec;#NT-TokenizedType'>ID attribute type</xnt> from
<bibref ref='XML'/>.
The <termref def='dt-value-space'/> of <term>ID</term> is the set of
all strings that match the
<xnt href='&xmlnsspec;#NT-NCName'>NCName</xnt> production in <bibref ref='XMLNS'/>
and have been used in an XML document.  The <termref def='dt-lexical-space'/>
of <term>ID</term>
is the set of all strings that match the <xnt href='&xmlnsspec;#NT-NCName'>
Name</xnt> production in <bibref ref='XMLNS'/>.  The <termref def='dt-basetype'/>
of <term>ID</term>
is <specref ref='NCName'/>.</termdef>
</p>
<div4>
<head>Constraining facets of ID</head>
<p>
<term>ID</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
<p>
For compatibility (see <specref ref='terminology'/>)
<term>ID</term> should be used only on attributes.
</p>
<constraintnote type='svc' id='id'>
<head>ID Unique</head>
<p>
An <term>ID</term> 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.
</p>
</constraintnote>
</div4>
<!--
<datatype name='ID' source='NCName'>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='IDREF'>
<head>IDREF</head>
<p>
<termdef id='dt-IDREF' term='IDREF'><term>IDREF</term> represents the
<xnt href='&xmlspec;#NT-TokenizedType'>IDREF attribute type</xnt> from
<bibref ref='XML'/>.
The <termref def='dt-value-space'/> of <term>IDREF</term> is the set of all
strings that match the
<xnt href='&xmlnsspec;#NT-NCName'>NCName</xnt> production in <bibref ref='XMLNS'/>
and have been used in an XML document as the value of an element or attribute
of type <term>ID</term>.  The <termref def='dt-lexical-space'/>
of <term>IDREF</term>
is the set of all strings that match the <xnt href='&xmlnsspec;#NT-NCName'>
NCName</xnt> production in <bibref ref='XMLNS'/>.  The <termref def='dt-basetype'/>
of <term>IDREF</term> is <specref ref='IDREFS'/>.</termdef>
</p>
<p>
For compatibility (see <specref ref='terminology'/>) this datatype should be
used only on attributes.
</p>
<div4>
<head>Constraining facets of IDREF</head>
<p>
<term>IDREF</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
<constraintnote type='svc' id='idref'>
<head>IDREF</head>
<p>
each Name must match the value of an <specref ref='ID'/> in the XML
document; i.e. <term>IDREF</term> values must match the value of some
<specref ref='ID'/>.
</p>
</constraintnote>
</div4>
<!--
<datatype name='IDREF' source='IDREFS'>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='IDREFS'>
<head>IDREFS</head>
<p>
<termdef id='dt-IDREFS' term='IDREFS'><term>IDREFS</term> represents the
<xnt href='&xmlspec;#NT-TokenizedType'>IDREFS attribute type</xnt> from
<bibref ref='XML'/>.  It consists of a whitespace-separated list of
<specref ref='IDREF'/>s.
The <termref def='dt-value-space'/> of <term>IDREFS</term> is the set of all
strings that match the <xnt href='&xmlspec;#NT-Names'>Names</xnt> production
in <bibref ref='XML'/> (modified as required by <xspecref
href='&xmlnsspec;#Conformance'>
Conformance</xspecref> in <bibref ref='XMLNS'/>)
and have been used in an XML document as the value of an element or attribute
of type <term>ID</term>.  The <termref def='dt-lexical-space'/>
of <term>IDREFS</term>
is the set of all strings that match the <xnt href='&xmlspec;#NT-Names'>
Names</xnt> production in <bibref ref='XML'/>  (modified as required by
<xspecref href='&xmlnsspec;#Conformance'>
Conformance</xspecref> in <bibref ref='XMLNS'/>).
The <termref def='dt-basetype'/> of <term>IDREFS</term> is <specref ref='string'/>.
</termdef>
</p>
<p>
For compatibility (see <specref ref='terminology'/>) <term>IDREFS</term>
should be used only on attributes.
</p>
<div4>
<head>Constraining facets of IDREFS</head>
<p>
<term>IDREFS</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of IDREFS</head>
<p>
<term>IDREFS</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='IDREF'/></p></item>
</ulist>
</div4>
<!--
<constraintnote type='svc' id='idref'>
<head>IDREF</head>
<p>
each Name must match the value of an <specref ref='ID'/> in the XML
document; i.e. <term>IDREF</term> values must match the value of some
<specref ref='ID'/>.
</p>
</constraintnote>
-->
<!--
<datatype name='IDREFS' source='string'>
	<subtype>IDREF</subtype>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='ENTITY'>
<head>ENTITY</head>
<p>
<termdef id='dt-ENTITY' term='ENTITY'><term>ENTITY</term> represents the
<xnt href='&xmlspec;#NT-TokenizedType'>ENTITY attribute type</xnt> from
<bibref ref='XML'/>.
The <termref def='dt-value-space'/> of <term>ENTITY</term> is the set of all
strings that match the
<xnt href='&xmlnsspec;#NT-NCName'>NCName</xnt> production in <bibref ref='XMLNS'/>
and have been declared as an <xspecref href='&xsdl;#declare-entity'>Unparsed
Entity</xspecref> in a schema.  The <termref def='dt-lexical-space'/>
of <term>ENTITY</term>
is the set of all strings that match the <xnt href='&xmlnsspec;#NT-NCName'>
NCName</xnt> production in <bibref ref='XMLNS'/>.  The <termref def='dt-basetype'/>
of <term>ENTITY</term>
is <specref ref='ENTITIES'/>.</termdef>
</p>
<p>
For compatibility (see <specref ref='terminology'/>) <term>ENTITY</term>
should be used only on attributes.
</p>
<div4>
<head>Constraining facets of ENTITY</head>
<p>
<term>ENTITY</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
</div4>
<!--
<datatype name='ENTITY' source='ENTITIES'>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='ENTITIES'>
<head>ENTITIES</head>
<p>
<termdef id='dt-ENTITIES' term='ENTITIES'><term>ENTITIES</term>
represents the <xnt href='&xmlspec;#NT-TokenizedType'>
ENTITIES attribute type</xnt> from
<bibref ref='XML'/>. It consists of a whitespace-separated list of
<specref ref='ENTITY'/>s.
The <termref def='dt-value-space'/> of <term>ENTITIES</term> is the set of all
strings that match the <xnt href='&xmlspec;#NT-Names'>Names</xnt> production in
<bibref ref='XML'/>  (modified as required by <xspecref href='&xmlnsspec;#Conformance'>
Conformance</xspecref> in <bibref ref='XMLNS'/>)
and have been declared as an
<xspecref href='&xsdl;#declare-entity'>Unparsed Entity</xspecref> in a schema.
The <termref def='dt-lexical-space'/> of <term>ENTITIES</term> is the set of all
strings that match
the <xnt href='&xmlspec;#NT-Names'>Names</xnt> production in <bibref ref='XML'/>
 (modified as required by <xspecref href='&xmlnsspec;#Conformance'>
Conformance</xspecref> in <bibref ref='XMLNS'/>).
The <termref def='dt-basetype'/> of <term>ENTITIES</term> is <specref ref='string'/>.
</termdef>
</p>
<p>
For compatibility (see <specref ref='terminology'/>) <term>ENTITIES</term>
should be used only on attributes.
</p>
<div4>
<head>Constraining facets of ENTITIES</head>
<p>
<term>ENTITIES</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of ENTITIES</head>
<p>
<term>ENTITIES</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='ENTITY'/></p></item>
</ulist>
</div4>
<!--
<datatype name='ENTITIES' source='string'>
	<subtype>ENTITY</subtype>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='NOTATION'>
<head>NOTATION</head>
<p>
<termdef id='dt-NOTATION' term='NOTATION'><term>NOTATION</term> represents the
<xnt href='&xmlspec;#NT-NotationType'>NOTATION attribute type</xnt> from
<bibref ref='XML'/> and allows the identification of the format of unparsed
entities by name.
The <termref def='dt-value-space'/> of <term>NOTATION</term> is the set of all
<xspecref href='&xsdl;#declare-notation'>notations declared</xspecref> in
a schema.
The <termref def='dt-lexical-space'/> of <term>NOTATION</term>
is the set of all strings that match the <xnt href='&xmlnsspec;#NT-NCName'>
NCName</xnt> production in <bibref ref='XMLNS'/>.  The <termref def='dt-basetype'/>
of <term>NOTATION</term> is <specref ref='NCName'/>.
</termdef>
</p>
<!--
<p>
To use this datatype one or more notation names must be
<xspecref href='&xsdl;#declare-notation'>declared in the schema</xspecref>.
These names can then be used as values for attributes or elements declared as 
<term>NOTATION</term>s.
</p>
<p>
Schema processors must provide the application with the name and external
identifier(s) of any notation name that appears as a value.
</p>
-->
<p>
For compatibility (see <specref ref='terminology'/>) <term>NOTATION</term>
should be used only on attributes.
</p>
<div4>
<head>Constraining facets of NOTATION</head>
<p>
<term>NOTATION</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-length'/></p></item>
<item><p><termref def='dt-maxlength'/></p></item>
<item><p><termref def='dt-minlength'/></p></item>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
</ulist>
</div4>
<!--
<datatype name='NOTATION' source='NCName'>
	<facet>length</facet>
	<facet>minlength</facet>
	<facet>maxlength</facet>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>pattern</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='integer'>
<head>integer</head>
<p>
<termdef id='dt-integer' term='integer'><term>integer</term>
is the standard mathematical concept of the integer numbers.
The <termref def='dt-value-space'/> of <term>integer</term> is the infinite set
{...,-2,-1,0,1,2,...}
<!--, although computer implementations
restrict this to a finite set.
-->
The <termref def='dt-basetype'/> of <term>integer</term> is <specref ref='decimal'/>.
</termdef>
</p>
<div4 id='integer-lexical-representation'>
<head>Lexical representation</head>
<p>
<term>integer</term> values have a single, standard lexical representation.
This consists of a string of digits with an optional leading sign.
If the sign is omitted, "+" is assumed.  For example: -1, 0,
12678967543233, +100000.
</p>
</div4>
<div4><head>Constraining facets of integer</head>
<p>
<term>integer</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of integer</head>
<p>
<term>integer</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='non-negative-integer'/></p></item>
<item><p><specref ref='non-positive-integer'/></p></item>
</ulist>
</div4>
<!--
<datatype name='integer' source='decimal'>
	<subtype>non-negative-integer</subtype>
	<subtype>non-positive-integer</subtype>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='non-negative-integer'>
<head>non-negative-integer</head>
<p>
<termdef id='dt-non-negative-integer' term='non-negative-integer'>
<term>non-negative-integer</term>
is the standard mathematical concept of the non-negative integers.
The <termref def='dt-value-space'/> of <term>non-negative-integer</term>
is the infinite set
{0,1,2,...}
<!--, although computer implementations
restrict this to a finite set
-->
.
The <termref def='dt-basetype'/> of <term>non-negative-integer</term>
is <specref ref='integer'/>.
</termdef>
</p>
<div4 id='non-negative-integer-lexical-representation'>
<head>Lexical representation</head>
<p>
<term>non-negative-integer</term> values have a single, standard lexical representation.
This consists of a string of digits with an optional leading "+" sign.
If the sign is omitted, "+" is assumed.  For example: 1, 0,
12678967543233, +100000.
</p>
</div4>
<div4>
<head>Constraining facets of non-negative-integer</head>
<p>
<term>non-negative-integer</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of non-negative-integer</head>
<p>
<term>non-negative-integer</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='positive-integer'/></p></item>
</ulist>
</div4>
<!--
<datatype name='non-negative-integer' source='integer'>
	<subtype>positive-integer</subtype>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='positive-integer'>
<head>positive-integer</head>
<p>
<termdef id='dt-positive-integer' term='positive-integer'>
<term>positive-integer</term>
is the standard mathematical concept of the positive integers.
The <termref def='dt-value-space'/> of <term>positive-integer</term>
is the infinite set
{1,2,...}.
<!--, although computer implementations
restrict this to a finite set.-->
The <termref def='dt-basetype'/>
of <term>positive-integer</term>
is <specref ref='non-negative-integer'/>.
</termdef>
</p>
<div4 id='positive-integer-lexical-representation'>
<head>Lexical representation</head>
<p>
<term>positive-integer</term> values have a single, standard lexical representation.
This consists of a string of digits with an optional leading "+" sign.
For example: 1, 12678967543233, +100000.
</p>
</div4>
<div4>
<head>Constraining facets of positive-integer</head>
<p>
<term>positive-integer</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
</div4>
<!--
<datatype name='positive-integer' source='non-negative-integer'>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='non-positive-integer'>
<head>non-positive-integer</head>
<p>
<termdef id='dt-non-positive-integer' term='non-positive-integer'>
<term>non-positive-integer</term>
is the standard mathematical concept of the non-positive integers.
The <termref def='dt-value-space'/> of <term>non-positive-integer</term>
is the infinite set {...,-2,-1,0}.
<!--
although computer implementations
restrict this to a finite set.
-->
The <termref def='dt-basetype'/> of <term>non-positive-integer</term>
is <specref ref='integer'/>.
</termdef>
</p>
<div4 id='non-positive-integer-lexical-representation'>
<head>Lexical representation</head>
<p>
<term>non-positive-integer</term> values have a single, standard lexical representation.
This consists of a string of digits with a leading "-" sign.
For example: -1, 0, -12678967543233, -100000.
</p>
</div4>
<div4>
<head>Constraining facets of non-positive-integer</head>
<p>
<term>non-positive-integer</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
</div4>
<div4>
<head>Subtypes of non-positive-integer</head>
<p>
<term>non-positive-integer</term> has the following subtypes:
</p>
<ulist>
<item><p><specref ref='negative-integer'/></p></item>
</ulist>
</div4>
<!--
<datatype name='non-positive-integer' source='integer'>
	<subtype>negative-integer</subtype>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id='negative-integer'>
<head>negative-integer</head>
<p>
<termdef id='dt-negative-integer' term='negative-integer'>
<term>negative-integer</term>
is the standard mathematical concept of the negative integers.
The <termref def='dt-value-space'/> of <term>negative-integer</term>
is the infinite set
{...,-2,-1}.
<!--, although computer implementations
restrict this to a finite set.
-->
The <termref def='dt-basetype'/>
of <term>negative-integer</term>
is <specref ref='non-positive-integer'/>.
</termdef>
</p>
<div4 id='negative-integer-lexical-representation'>
<head>Lexical representation</head>
<p>
<term>negative-integer</term> values have a single, standard lexical representation.
This consists of a string of digits with a leading "-" sign.
For example: -1, -12678967543233, -100000.
</p>
</div4>
<div4>
<head>Constraining facets of negative integer</head>
<p>
<term>negative-integer</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
</div4>
<!--
<datatype name='negative-integer' source='non-positive-integer'>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id="date">
<head>date</head>
<p>
<termdef id="dt-date" term="date"><term>date</term>
represents a <specref ref="timeDuration"/> that starts at midnight
of a specified day and lasts for 24 hours.
The <termref def='dt-value-space'/> of <term>date</term> is the set of
Gregorian calendar dates as defined in &sect; 5.2.1 of <bibref ref="ISO8601"/>.
The <termref def='dt-basetype'/> of <term>date</term> is
<specref ref="recurringInstant"/>.
<!--
<term>date</term> is generated from
<specref ref="recurringInstant"/> by setting the value of the
<term>period</term> facet equal to 24 hours.
  -->
</termdef>
</p>
<div4 id="date-lexical-repr">
<head>Lexical Representation</head>
<p>
The lexical representation for <term>date</term> is the reduced (right truncated)
lexical representation for <specref ref="recurringInstant"/>: CCYY-MM-DD.
To accomodate year values greater than 9999 additional digits can be added
to the left of this representation.
For example, to indicate May the 31st, 1999, one would write: 1999-05-31.
See also <specref ref="isoformats"/>.
</p>
<p>
Left truncated
representations can be used to represent recurring dates.  If the CC is
omitted it signifies a date that occurs every century.  If the YY is also
omitted it signifies a date every year and so on. Every two character "unit" of
the representation that is omitted is indicated by a single hyphen "-".
For example, ---05 signifies the fifth day of every month.
</p>
<p>
Right truncated, or reduced precision, date representations can be used to
represent a specific month (CCYY-MM), a specific year (CCYY), or a specific
century (YY).
</p>  
</div4>
<div4>
<head>Constraining facets of date</head>
<p>
<term>date</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
</div4>
<!--
<datatype name='date' source='recurringInstant'>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
<div3 id="time">
<head>time</head>
<p>
<termdef id="dt-time" term="time"><term>time</term>
represents a recurring instant of time that recurs every day.
The <termref def='dt-value-space'/> of <term>time</term> is the space
of <emph>time of day</emph> values as defined in &sect; 5.3 of
<bibref ref='ISO8601'/>.
The <termref def='dt-basetype'/> of <term>time</term> is
<specref ref="recurringInstant"/>.
</termdef>
</p>
<p>
<term>time</term> can be considered to be a shorthand to designate a
specific truncated representation for <specref ref="recurringInstant"/>.
<!--
<term>time</term> is generated from <specref ref="recurringInstant"/> by
setting the value of the <emph>period</emph> facet equal to 24 hours.
  -->
</p>
<div4 id="time-lexical-repr">
<head>Lexical Representation</head>
<p>
The lexical representation for <term>time</term> is the left truncated lexical
representation for <specref ref="timeInstant"/>: hh:mm:ss.sss.
For example, to indicate 1:20 pm for Eastern Standard Time
which is 5 hours behind Coordinated Universal Time, one
would write: 13:20:00-05:00. See also <specref ref="isoformats"/>.
</p>
</div4>
<div4>
<head>Constraining facets of time</head>
<p>
<term>time</term> has the following constraining facets:
</p>
<ulist>
<item><p><termref def='dt-maxInclusive'/></p></item>
<item><p><termref def='dt-maxExclusive'/></p></item>
<item><p><termref def='dt-minInclusive'/></p></item>
<item><p><termref def='dt-minExclusive'/></p></item>
<item><p><termref def='dt-pattern'/></p></item>
<item><p><termref def='dt-enumeration'/></p></item>
</ulist>
</div4>
<!--
<datatype name='time' source='recurringInstant'>
	<facet>minExclusive</facet>
	<facet>maxExclusive</facet>
	<facet>minInclusive</facet>
	<facet>maxInclusive</facet>
	<facet>enumeration</facet>
</datatype>
-->
</div3>
</div2>
</div1>
<div1 id='defining-generated-datatypes'>
<head>Defining Generated Datatypes</head>
<p>
A <termref def='dt-generated'/> datatype can be defined from a
<termref def='dt-primitive'/> datatype (or another
<termref def='dt-generated'/> datatype)
by adding optional constraining facets.  For example, it may be useful
to define a datatype called <emph>i4</emph> (signed 4-byte integer) from the
<termref def='dt-built-in'/>
datatype <specref ref='integer'/> by supplying <termref def='dt-maxInclusive'/>
and <termref def='dt-minInclusive'/> facets.  In this case, <emph>i4</emph>
is the name of the new <termref def='dt-user-generated'/> datatype,
<specref ref='integer'/> is its
<termref def='dt-basetype'/> and <termref def='dt-maxInclusive'/> and
<termref def='dt-minInclusive'/> are the <termref def='dt-constraining'/> facets.
</p>
<note role='example'>
<eg><![CDATA[<datatype name="i4" source="integer">
	<minInclusive value='-2147483648'/>
	<maxInclusive value='2147483648'/>
</datatype>]]></eg>
</note>
<p>
This section defines the abstract syntax used for defining <termref def='dt-generated'/>
datatypes.
This abstract syntax is used for defining both <termref def='dt-built-in'/>
<termref def='dt-generated'/>
and <termref def='dt-user-generated'/> datatypes; the only difference between
the <termref def='dt-built-in'/>
and <termref def='dt-user-generated'/>
datatypes being that the datatype definitions for <termref def='dt-built-in'/>
<termref def='dt-generated'/>
datatypes are
included in the <specref ref='schema'/> while the datatype definitions for
<termref def='dt-user-generated'/> datatypes appear in schemas written by users.
</p>
<p>
<termdef id='key-abstractSyntax' term='abstract syntax'> An <term>abstract
syntax</term> provides a formal specification of the information
provided for each <termref def='dt-generated'/> datatype definition. </termdef>
The abstract syntax is presented using a simplified BNF. Defined terms are to
the left. Their components are to the right, with a small amount of
meta-syntax: ()s for grouping, | to separate alternatives, ? for optionality, *
and + for iteration.
</p>
<p>
<termdef id='key-concreteSyntax' term='concrete syntax'>The <term>concrete
syntax</term> for <termref def='dt-generated'/> datatype definitions is the exact
element and attribute names used in definitions.</termdef>.
The concrete syntax is a key feature of its proposed design.
The concrete syntax is the form in which the schema
language is used by datatype designers. Though its elements
and attributes are often different from the terms of the abstract
syntax bnf, the features and expressive power of the two are congruent.
</p>
<p>
We include a preliminary concrete syntax in this draft, via examples, as well as
in <specref ref='schema'/> (defined using the schema language of
<bibref ref='structural-schemas'/>) and <specref ref='dtd-for-datatypeDefs'/>.
The emphasis in this version has been to stay quite close to the abstract syntax.
</p>
<ednote>
<edtext>
The abstract syntax proposed here (and hence, the concrete syntax) are
preliminary, as they allow datatype definitions which are logically inconsistent
(e.g., they allow <termref def='dt-numeric'/> facets on
<termref def='dt-non-numeric'/> datatypes). This will be corrected
in future drafts, as the XML Schema language comes to allow the specification
of tighter constraints.
</edtext>
</ednote>
<ednote>
<edtext>
This section needs  more explanatory text describing the productions and
their relationship to the conceptual framework described in sections
<specref ref='typesystem'/> and <specref ref='built-in-datatypes'/>.
</edtext>
</ednote>
<scrap>
<head>Datatype definitions</head>
<prod id='nt-datatypedef'>
<lhs>datatypeDefn</lhs>
<rhs>
	<xnt href='&xmlnsspec;#NT-NCName'>NCName</xnt>
	<nt def='nt-basetype'>basetype</nt>
	<nt def='nt-facets'>facets</nt>
</rhs>
<constraint def='uniquename'/>
</prod>
<prod id='nt-basetype'>
<lhs>basetype</lhs>
<rhs>
	<nt def='nt-datatypename'>datatypename</nt>
</rhs>
</prod>
<prod id='nt-facets'>
<lhs>facets</lhs>
<rhs>
	<nt def='nt-ordered'>ordered</nt>?
	<nt def='nt-unordered'>unordered</nt>?
</rhs>
<constraint def='c-basetype'/>
</prod>
</scrap>
<p>
The following is the definition for a possible <termref def='dt-built-in'/>
<termref def='dt-generated'/> datatype "currency".  This datatype definition
would appear in the schema which defines datatypes for XML Schemas
and shows that a <termref def='dt-generated'/> datatype can have the same
<termref def='dt-value-space'/> as its <termref def='dt-basetype'/>,
which might mean that
it is just an "alias" or "renaming" of <termref def='dt-basetype'/>.  In this case,
the specification would probably also define some
"semantics" for currency which went beyond those of decimal.
</p>
<note role='example'>
<eg><![CDATA[<datatype name="currency" source="decimal"/>]]></eg>
</note>
<constraintnote id='uniquename' type='cos'>
<head>Unique datatype definitions</head>
<p>
The name of the datatype being defined must be unique among the datatypes
defined in the containing schema.
</p>
</constraintnote>
<constraintnote id='c-basetype' type='cos'>
<head>Appropriate facets</head>
<p>
If the <termref def='dt-value-space'/> of the <termref def='dt-basetype'/>
is <termref def='dt-ordered'/>, then only <termref def='dt-ordered'/>
facets may appear in a datatype definition.
</p>
</constraintnote>
<scrap>
<head>Datatype names</head>
<prod id='nt-datatypename'>
<lhs>datatypename</lhs>
<rhs>
	<nt def='nt-builtinname'>builtinname</nt> |
	<nt def='nt-usergenname'>usergenname</nt>
</rhs>
</prod>
<prod id='nt-builtinname'>
<lhs>builtinname</lhs>
<rhs>Name | QName | NCName |</rhs>
<rhs>ID | IDREF |IDREFS |</rhs>
<rhs>NMTOKEN | NMTOKENS |</rhs>
<rhs>ENTITY | ENTITIES |</rhs>
<rhs>string | uri |</rhs>
<rhs>timeInstant | timeDuration | recurringInstant</rhs>
<rhs>binary |</rhs>
<rhs>float | double | decimal |integer |</rhs>
<rhs>non-negative-integer | positive-integer |</rhs>
<rhs>non-positive-integer | negative-integer |</rhs>
<rhs>date | time | language</rhs>
<!--
					<constraint def="dtns"/>
  -->
</prod>
<prod id='nt-usergenname'>

<lhs>usergenname</lhs>
<rhs>
	<xnt href='&xsdl;#nt-datatypeRef'>datatypeRef</xnt>
</rhs>
<!--
					<constraint def="dtqname"/>
  -->
</prod>
</scrap>
<note>
<p>
The <nt def='nt-datatypename'>datatypename</nt> production
above is not to be confused with that labeled
<xnt href='&xsdl;#nt-datatypeName'>datatypeName</xnt> in
<bibref ref='structural-schemas'/>.
</p>
</note>
<!--
			<constraintnote id="dtns" type="dt">
				<head>datatype namespace prefix</head>
				<p>
					The <bibref ref="XMLNS"/> prefix "dt" is used throughout the
					productions and examples of this specification as the prefix
					associated with the namespace defined by this specification.
					A schema instance may define whatever prefix it desires as
					being associated with the datatype namespace, in which case
					that prefix should be used in <nt def="builtinname"/>.
				</p>
			</constraintnote>
  -->
<!--
			<constraintnote id="dtqname" type="dt">
				<head>External datatype name</head>
				<p>
					The namespace qualified name specified must be the name of a datatype
					defined in the schema associated with the namespace prefix
					used in the qualified name.
				</p>
			</constraintnote>
  -->
<!--
			<issue id="QNames-in-attribute-values">
				<p>
					This syntax uses namespace qualified names in attribute values,
					which differs from the approach taken in XSDL.  Should it be
					modified to be consist with that approach?
				</p>
			</issue>
  -->
<scrap>
<head>Facets</head>
<prod id='nt-ordered'>
<lhs>ordered</lhs>
<rhs>
	<nt def='nt-bounds'>bounds</nt>?
	<nt def='nt-numeric'>numeric</nt>?
	<nt def='nt-dateTime'>dateTime</nt>?
</rhs>
</prod>
<prod id='nt-unordered'>
<lhs>unordered</lhs>
<rhs>
	<nt def='nt-pattern'>pattern</nt>?
	<nt def='nt-enumeration'>enumeration</nt>?
	<nt def='nt-length'>length</nt>?
	<nt def='nt-minlength'>minlength</nt>?
	<nt def='nt-maxlength'>maxlength</nt>?
	<nt def='nt-encoding'>encoding</nt>?
</rhs>
</prod>
</scrap>
<scrap>
<head>Ordered facets</head>
<prod id='nt-bounds'>
<lhs>bounds</lhs>
<rhs>    (<nt def='nt-minincl'>minInclusive</nt> | <nt def='nt-maxincl'>maxInclusive</nt>)?
         (<nt def='nt-minExcl'>minExclusive</nt> | <nt def='nt-maxExcl'>maxExclusive</nt>)?
</rhs>
</prod>
<prod id='nt-maxincl'>
<lhs>maxInclusive</lhs>
<rhs>
	<nt def='nt-literal-value'>literalValue</nt>
</rhs>
<constraint def='literal-type'/>
</prod>
<prod id='nt-minincl'>
<lhs>minInclusive</lhs>
<rhs>
	<nt def='nt-literal-value'>literalValue</nt>
</rhs>
<constraint def='literal-type'/>
</prod>
<prod id='nt-maxExcl'>
<lhs>minExclusive</lhs>
<rhs>
	<nt def='nt-literal-value'>literalValue</nt>
</rhs>
<constraint def='literal-type'/>
</prod>
<prod id='nt-minExcl'>
<lhs>maxExclusive</lhs>
<rhs>
	<nt def='nt-literal-value'>literalValue</nt>
</rhs>
<constraint def='literal-type'/>
</prod>
</scrap>
<constraintnote id='literal-type' type='cos'>
<head>Literal type</head>
<p>
The literal value give must be of the same type as the datatype
as the basetype given in the datatype definition in which this facet
appears.
</p>
</constraintnote>
<scrap>
<head>Numeric facets</head>
<prod id='nt-numeric'>
<lhs>numeric</lhs>
<rhs>
	<nt def='nt-precision'>precision</nt>?
	<nt def='nt-scale'>scale</nt>?
</rhs>
</prod>
<prod id='nt-precision'>
<lhs>precision</lhs>
<rhs>
	<nt def='nt-int-literal'>integerLiteral</nt>
</rhs>
</prod>
<prod id='nt-scale'>
<lhs>scale</lhs>
<rhs>
	<nt def='nt-int-literal'>integerLiteral</nt>
</rhs>
</prod>
</scrap>
<scrap>
<head>dateTime facets</head>
<prod id='nt-dateTime'>
<lhs>dateTime</lhs>
<rhs>
	<nt def='nt-period'>period</nt>?
</rhs>
</prod>
<prod id='nt-period'>
<lhs>period</lhs>
<rhs>
	<nt def='nt-timeDurationLiteral'>timeDurationLiteral</nt>
</rhs>
</prod>
</scrap>

<note role='example'>
<p>
The following is the definition of a <termref def='dt-user-generated'/> datatype
which could be used to represent monetary amounts, such as in a financial
management application which does not have figures above $1M
and only allow 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 <termref def='dt-basetype'/> in a manner
specific to the <termref def='dt-basetype'/>
(different than specifying max/min values as before)
</p>
<eg><![CDATA[<datatype name="amount" source="decimal">
	<precision value='8'/>
	<scale value='2'/>
</datatype>]]></eg>
<p>
This type could just as well have been defined with the
potential <termref def='dt-built-in'/> <termref def='dt-generated'/>
type "currency" (defined above) as its <termref def='dt-basetype'/>.
</p>
</note>
<scrap>
<head>Unordered facets</head>
<prod id='nt-length'>
<lhs>length</lhs>
<rhs>
	<nt def='nt-int-literal'>integerLiteral</nt>
</rhs>
</prod>
<prod id='nt-minlength'>
<lhs>minlength</lhs>
<rhs>
	<nt def='nt-int-literal'>integerLiteral</nt>
</rhs>
</prod>
<prod id='nt-maxlength'>
<lhs>maxlength</lhs>
<rhs>
	<nt def='nt-int-literal'>integerLiteral</nt>
</rhs>
</prod>
<prod id='nt-enumeration'>
<lhs>enumeration</lhs>
<rhs>
	<nt def='nt-literal'>literal</nt>+
</rhs>
</prod>
<prod id='nt-pattern'>
<lhs>pattern</lhs>
<rhs>
	regularExpression |	IS08601picture
</rhs>
</prod>
<!--
<prod id='nt-lexical'>
<lhs>lexical</lhs>
<rhs>
	LexicalSpec
</rhs>
<constraint def='lex-spec'/>
</prod>
-->
<prod id='nt-encoding'>
<lhs>encoding</lhs>
<rhs>
	'hex' | 'base64'
</rhs>
</prod>
</scrap>
<!--
<constraintnote id="lex-spec" type="dt">
<head>Lexical specification</head>
<p>
The lexical specification must be of the "correct" kind, i.e.,
a dateTime lexical for datatypes generated from <specref ref="timeInstant"/>.
</p>
</constraintnote>
-->
<note role='example'>
<p>
The following example is a datatype definition for a
<termref def='dt-user-generated'/>
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 <termref def='dt-value-space'/>.  The enumerated values must be
type-valid literals for the <termref def='dt-basetype'/>.
</p>
<eg><![CDATA[<datatype name="holidays" source="date">
	<annotation>
		<info>some US holidays</info>
	</annotation>
	<enumeration value='--01-01'>
		<annotation>
			<info>New Year's day</info>
		</annotation>
	</enumeration>
	<enumeration value='--07-04'/>
		<annotation>
			<info>4th of July</info>
		</annotation>
	</enumeration>
	<enumeration value='--12-25'/>
		<annotation>
			<info>Christmas</info>
		</annotation>
	</enumeration>
</datatype>]]></eg>
</note>
<scrap>
<head>Literals</head>
<prod id='nt-literal'>
<lhs>literal</lhs>
<rhs>
	<nt def='nt-literal-value'>literalValue</nt>
</rhs>
</prod>
<prod id='nt-literal-value'>
<lhs>literalValue</lhs>
<rhs>
	<nt def='nt-string-literal'>stringLiteral</nt> |
	<nt def='nt-numeric-literal'>numericLiteral</nt> |
	<nt def='nt-dateTime-literal'>dateTimeLiteral</nt> |
	<nt def='nt-uri-literal'>uriLiteral</nt> |
	<nt def='nt-language-litera