<!-- DTD for XML Schemas: Part 2: Datatypes -->
<!-- $Id$ -->
<!-- Note this DTD is NOT the normative datatypes DTD - - 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 -->
<!ENTITY % p ''> <!-- can be overriden in the internal subset of a
                      schema document to establish a namespace prefix -->
<!ENTITY % dts ':dt'>
<!ENTITY % dtp 'dt:'>
<!ENTITY % dtpv '"%dtp;"'>
<!ENTITY % dtnds 'xmlns%dts;'>
<!ENTITY dtp %dtpv;>

<!-- Define all the element names, with optional prefix -->
<!ENTITY % simpleType "%p;simpleType">
<!ENTITY % maxExclusive "%p;maxExclusive">
<!ENTITY % minExclusive "%p;minExclusive">
<!ENTITY % maxInclusive "%p;maxInclusive">
<!ENTITY % minInclusive "%p;minInclusive">
<!ENTITY % precision "%p;precision">
<!ENTITY % scale "%p;scale">
<!ENTITY % length "%p;length">
<!ENTITY % minlength "%p;minlength">
<!ENTITY % maxlength "%p;maxlength">
<!ENTITY % enumeration "%p;enumeration">
<!ENTITY % pattern "%p;pattern">
<!ENTITY % encoding "%p;encoding">
<!ENTITY % period "%p;period">

<!-- Customisation entities for the ATTLIST of each element type.
     Define one of these if your schema takes advantage of the
     anyAttribute='##other' in the schema for schemas -->

<!ENTITY % simpleTypeAttrs ''>
<!ENTITY % maxExclusiveAttrs ''>
<!ENTITY % minExclusiveAttrs ''>
<!ENTITY % maxInclusiveAttrs ''>
<!ENTITY % minInclusiveAttrs ''>
<!ENTITY % precisionAttrs ''>
<!ENTITY % scaleAttrs ''>
<!ENTITY % lengthAttrs ''>
<!ENTITY % minlengthAttrs ''>
<!ENTITY % maxlengthAttrs ''>
<!ENTITY % enumerationAttrs ''>
<!ENTITY % patternAttrs ''>
<!ENTITY % encodingAttrs ''>
<!ENTITY % periodAttrs ''>
<!ENTITY % appinfoAttrs ''>
<!ENTITY % documentationAttrs ''>


<!-- annotation elements -->
<!ENTITY % annotation "%p;annotation">
<!ENTITY % appinfo "%p;appinfo">
<!ENTITY % documentation "%p;documentation">


<!-- Define some entities for informative use as attribute types -->
<!ENTITY % URIref "CDATA">
<!ENTITY % QName "CDATA">
<!ENTITY % NCName "NMTOKEN">
<!ENTITY % non-negative-integer "NMTOKEN">
<!ENTITY % boolean "(true|false)">
<!ENTITY % simpleDerivationChoice "(list|restriction|reproduction)">
<!ENTITY % simpleDerivationSet "CDATA">
      <!-- #all or space-separated list drawn from derivationChoice -->

<!-- Note that the use of 'facet' below is less restrictive than is
     really intended:  There should in fact be no more than one of each of
     minInclusive, minExclusive, maxInclusive, maxExclusive,
     precision, scale,
     length, maxlength, minlength, encoding, period within datatype,
     and the min- and max- variants of Inclusive and Exclusive are
     mutually exclusive.
     On the other hand,  pattern and enumeration may repeat -->
<!ENTITY % minBound '(%minInclusive; | %minExclusive;)'>
<!ENTITY % maxBound '(%maxInclusive; | %maxExclusive;)'>
<!ENTITY % bounds '%minBound; | %maxBound;'>
<!ENTITY % numeric '%precision; | %scale;'>
<!ENTITY % ordered '%bounds; | %numeric;'>
<!ENTITY % unordered
   '%pattern; | %enumeration; | %length; | %maxlength; | %minlength;
    | %encoding; | %period;'>
<!ENTITY % facet '%ordered; | %unordered;'>
<!ENTITY % facetAttr 'value CDATA #REQUIRED'>
<!ENTITY % facetModel '(%annotation;)?'>
<!ELEMENT %simpleType; ((%annotation;)?,(%facet;)*)>
<!ATTLIST %simpleType;
    name      %NCName;                 #IMPLIED
    base      %QName;                  #REQUIRED
    abstract  %boolean;                'false'
    final     %simpleDerivationSet;    ''
    derivedBy %simpleDerivationChoice; 'restriction'
    %simpleTypeAttrs;>
<!-- name is required at top level -->

<!ELEMENT %maxExclusive; %facetModel;>
<!ATTLIST %maxExclusive; %facetAttr;
          %maxExclusiveAttrs;>
<!ELEMENT %minExclusive; %facetModel;>
<!ATTLIST %minExclusive; %facetAttr;
          %minExclusiveAttrs;>

<!ELEMENT %maxInclusive; %facetModel;>
<!ATTLIST %maxInclusive; %facetAttr;
          %maxInclusiveAttrs;>
<!ELEMENT %minInclusive; %facetModel;>
<!ATTLIST %minInclusive; %facetAttr;
          %minInclusiveAttrs;>

<!ELEMENT %precision; %facetModel;>
<!ATTLIST %precision; %facetAttr;
          %precisionAttrs;>
<!ELEMENT %scale; %facetModel;>
<!ATTLIST %scale; %facetAttr;
          %scaleAttrs;>

<!ELEMENT %length; %facetModel;>
<!ATTLIST %length; %facetAttr;
          %lengthAttrs;>
<!ELEMENT %minlength; %facetModel;>
<!ATTLIST %minlength; %facetAttr;
          %minlengthAttrs;>
<!ELEMENT %maxlength; %facetModel;>
<!ATTLIST %maxlength; %facetAttr;
          %maxlengthAttrs;>

<!-- This one can be repeated -->
<!ELEMENT %enumeration; %facetModel;>
<!ATTLIST %enumeration; %facetAttr;
          %enumerationAttrs;>

<!-- This one can be repeated -->
<!ELEMENT %pattern; %facetModel;>
<!ATTLIST %pattern; %facetAttr;
          %patternAttrs;>

<!ELEMENT %encoding; %facetModel;>
<!ATTLIST %encoding; %facetAttr;
          %encodingAttrs;>
<!ELEMENT %period; %facetModel;>
<!ATTLIST %period; %facetAttr;
          %periodAttrs;>

<!-- Annotation is either application information or documentation -->
<!-- By having these here they are available for datatypes as well
     as all the structures elements -->

<!ELEMENT %annotation; (%appinfo; | %documentation;)*>

<!-- User must define annotation elements in internal subset for this
     to work -->
<!ELEMENT %appinfo; ANY>   <!-- too restrictive -->
<!ATTLIST %appinfo;
          source     %URIref;      #IMPLIED
          %appinfoAttrs;>
<!ELEMENT %documentation; ANY>   <!-- too restrictive -->
<!ATTLIST %documentation;
          source     %URIref;   #IMPLIED
          xml:lang   CDATA      #IMPLIED
          %documentationAttrs;>
