<?xml version='1.0'?>
<!-- XML Schema schema for XML Schemas: Part 2: Datatypes -->
<!-- Note this schema is NOT the normative datatypes schema - - the
     prose copy in the datatypes REC is the normative version (which
     shouldn't differ from this one except for this comment and entity
     expansions, but just in case -->
<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 19991216//EN" "../structures/structures.dtd" [
<!ATTLIST element xmlns:x CDATA #IMPLIED><!-- keep this schema XML1.0 valid -->
]>
<schema xmlns="&XMLSchemaNS;" targetNamespace="&XMLSchemaNS;" version="$Id: datatypes.xsd,v 1.30 2000/02/23 18:02:05 ht Exp $">
  <annotation>
   <documentation>Note that the namespace declaration for the builtins
                  namespace is in structures.dtd so it can be customised</documentation>
  </annotation>

  <annotation>
   <documentation>Import the builtins, and rename them all into this namespace
                  as well</documentation>
  </annotation>

 <!-- get access to the xml: attribute groups for xml:lang -->
 <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/XML/1998/xml.xsd"/>

  <import namespace="&XMLSchemaNS;/datatypes" schemaLocation="&XSP2.base;/builtins.xsd"/>

  <simpleType name="urSimpleType" base="&dtp;urSimpleType"/>
  <simpleType name="string" base="&dtp;string"/>
  <simpleType name="boolean" base="&dtp;boolean"/>
  <simpleType name="float" base="&dtp;float"/>
  <simpleType name="double" base="&dtp;double"/>
  <simpleType name="decimal" base="&dtp;decimal"/>
  <simpleType name="timeInstant" base="&dtp;timeInstant"/>
  <simpleType name="timeDuration" base="&dtp;timeDuration"/>
  <simpleType name="recurringInstant" base="&dtp;recurringInstant"/>
  <simpleType name="binary" base="&dtp;binary"/>
  <simpleType name="uri-reference" base="&dtp;uri-reference"/>
  <simpleType name="language" base="&dtp;language"/>
  <simpleType name="integer" base="&dtp;integer"/>
  <simpleType name="non-negative-integer" base="&dtp;non-negative-integer"/>
  <simpleType name="positive-integer" base="&dtp;positive-integer"/>
  <simpleType name="non-positive-integer" base="&dtp;non-positive-integer"/>
  <simpleType name="negative-integer" base="&dtp;negative-integer"/>
  <simpleType name="byte" base="&dtp;byte"/>
  <simpleType name="int" base="&dtp;int"/>
  <simpleType name="long" base="&dtp;long"/>
  <simpleType name="short" base="&dtp;short"/>
  <simpleType name="unsigned-byte" base="&dtp;unsigned-byte"/>
  <simpleType name="unsigned-int" base="&dtp;unsigned-int"/>
  <simpleType name="unsigned-long" base="&dtp;unsigned-long"/>
  <simpleType name="unsigned-short" base="&dtp;unsigned-short"/>
  <simpleType name="date" base="&dtp;date"/>
  <simpleType name="time" base="&dtp;time"/>
  <simpleType name="NMTOKENS" base="&dtp;NMTOKENS"/>
  <simpleType name="NMTOKEN" base="&dtp;NMTOKEN"/>
  <simpleType name="Name" base="&dtp;Name"/>
  <simpleType name="ID" base="&dtp;ID"/>
  <simpleType name="IDREFS" base="&dtp;IDREFS"/>
  <simpleType name="IDREF" base="&dtp;IDREF"/>
  <simpleType name="ENTITIES" base="&dtp;ENTITIES"/>
  <simpleType name="ENTITY" base="&dtp;ENTITY"/>
  <simpleType name="NCName" base="&dtp;NCName"/>
  <simpleType name="QName" base="&dtp;QName"/>
  <simpleType name="NOTATION" base="&dtp;NOTATION"/>

  <complexType name="openAttrs" content="empty">
   <annotation>
    <documentation>This type is extended by almost all schema types
                   to allow attributes from other namespaces to be
                   added to user schemas.</documentation>
   </annotation>
   <anyAttribute namespace="##other"/>
  </complexType>

  <complexType name="annotated" base="openAttrs" derivedBy="extension" content="elementOnly">
   <annotation>
    <documentation>This type is extended by all types which allow annotation
          other than &lt;schema> itself</documentation>
   </annotation>
   <element ref="annotation" minOccurs="0"/>
   <attribute name="id" type="ID"/>
  </complexType>

  <complexType name="simpleType" base="annotated" derivedBy="extension" abstract="true">
    <element ref="facet" minOccurs="0" maxOccurs="*"/>
    <attribute name="name" type="NCName" minOccurs="0">
      <annotation>
       <documentation>Can be restricted to required or forbidden</documentation>
      </annotation>
    </attribute>
    <attribute name="base" type="QName" minOccurs="1"/>
    <attribute name="final">
     <simpleType base="&dtp;string">
      <annotation>
       <documentation>#all or (possibly empty) subset of {list,
                      restriction, reproduction}</documentation>
       <documentation>A utility type, not for public use</documentation>
       <documentation>Should be a sequence drawn from the values of
                      the set below, or #all -- regexp
                      is only an approximation</documentation>
      </annotation>
      <pattern value="#all?|(extension|list| )*"/>
     </simpleType>
    </attribute>
    <attribute name="abstract" type="boolean"/>
    <attribute name="derivedBy" default="restriction">
     <simpleType base="&dtp;NMTOKEN">
      <enumeration value="list"/>
      <enumeration value="restriction"/>
      <enumeration value="reproduction"/>
     </simpleType>
    </attribute>
  </complexType>

  <complexType name="namedDatatype" base="simpleType">
   <annotation>
    <documentation>This was formerly for the top-level datatype element,
          as ref'ed in &lt;schema</documentation>
   </annotation>
   <attribute name="name" minOccurs="1">
    <annotation><documentation>Required at the top level</documentation></annotation>
   </attribute>   
  </complexType>

  <complexType name="anonDatatype" base="simpleType">
   <annotation>
    <documentation>This was for the nested datatype element,
          as formerly used in &lt;element</documentation>
   </annotation>
   <attribute name="name" maxOccurs="0">
    <annotation><documentation>Forbidden when nested</documentation></annotation>
   </attribute>   
  </complexType>

  <element name="simpleType" equivClass="schemaTop" type="simpleType"/>

  <complexType name="facet" base="annotated" derivedBy="extension">
    <attribute name="value" minOccurs="1"/>
  </complexType>

  <element name="facet" type="facet" abstract="true"/>

  <element name="minBound" abstract="true" equivClass="facet"/>

  <element name="minExclusive" equivClass="minBound"/>
  <element name="minInclusive" equivClass="minBound"/>

  <element name="maxBound" abstract="true" equivClass="facet"/>

  <element name="maxExclusive" equivClass="maxBound"/>
  <element name="maxInclusive" equivClass="maxBound"/>

  <complexType name="numFacet" base="facet" derivedBy="restriction">
    <attribute name="value" type="non-negative-integer"/>
  </complexType>

  <element name="precision" type="numFacet" equivClass="facet"/>
  <element name="scale" type="numFacet" equivClass="facet"/>

  <element name="length" type="numFacet" equivClass="facet"/>
  <element name="minlength" type="numFacet" equivClass="facet"/>
  <element name="maxlength" type="numFacet" equivClass="facet"/>

  <!-- the following datatype is used to limit the
       possible values for the encoding facet on
           the binary datatype -->
  <element name="encoding" equivClass="facet">
   <complexType base="facet" derivedBy="restriction">
     <attribute name="value">
      <simpleType base="&dtp;NMTOKEN">
       <annotation>
	<documentation>A utility type, not for public use</documentation>
       </annotation>
	<enumeration value="hex">
	  <annotation>
	    <documentation>each (8-bit) byte is encoded as a sequence
		  of 2 hexidecimal digits</documentation>
	  </annotation>
	</enumeration>
	<enumeration value="base64">
	  <annotation>
	    <documentation>value is encoded in Base64 as defined
                           in the MIME RFC</documentation>
	  </annotation>
	</enumeration>
      </simpleType>
     </attribute>
   </complexType>
  </element>

  <element name="period" equivClass="facet">
   <complexType base="facet" derivedBy="restriction">
     <attribute name="value" type="timeDuration"/>
   </complexType>
  </element>

  <element name="enumeration" equivClass="facet"/>

  <element name="pattern" equivClass="facet"/>

  <element name="annotation" xmlns:x="http://www.w3.org/XML/1998/namespace">
   <complexType>
    <choice minOccurs="0" maxOccurs="*">
     <element name="appinfo">
       <complexType content="mixed">
         <any minOccurs="0" maxOccurs="*" processContents="lax"/>
         <attribute name="source" type="uri-reference"/>
       </complexType>
     </element>
     <element name="documentation">
       <complexType content="mixed">
         <any minOccurs="0" maxOccurs="*" processContents="lax"/>
         <attribute name="source" type="uri-reference"/>
         <attributeGroup ref="x:lang"/>
       </complexType>
     </element>
    </choice>
   </complexType>
  </element>

</schema>
