<!-- DTD for XML Schemas: Part 1: Structures -->
<!-- $Id: structures.dtd 5951 2006-05-30 22:18:48Z bsnyder $ -->
<!-- Note this DTD is NOT the normative structures DTD - - the
     prose copy in the structures REC is the normative version (which
     shouldn't differ from this one except for this comment and entity
     expansions, but just in case -->
<!ENTITY % versionEntities SYSTEM "versionInfo.ent">
%versionEntities; <!-- get path and date entities -->

<!-- The the datatype element and its components
     are defined in XML Schema: Part 2: Datatypes -->
<!-- Note %p is defined in datatypes.dtd -->
<!ENTITY % xs-datatypes PUBLIC 'datatypes'
                     '../WD-xmlschema-2-20000225/datatypes.dtd' >
%xs-datatypes;

<!ENTITY % s ''> <!-- if %p is defined (e.g. as foo:) then you must
                      also define %s as the suffix for the appropriate
                      namespace declaration (e.g. :foo) -->
<!ENTITY % nds 'xmlns%s;'>

<!-- Define all the element names, with optional prefix -->
<!ENTITY % schema "%p;schema">
<!ENTITY % complexType "%p;complexType">
<!ENTITY % element "%p;element">
<!ENTITY % unique "%p;unique">
<!ENTITY % key "%p;key">
<!ENTITY % keyref "%p;keyref">
<!ENTITY % selector "%p;selector">
<!ENTITY % field "%p;field">
<!ENTITY % group "%p;group">
<!ENTITY % all "%p;all">
<!ENTITY % choice "%p;choice">
<!ENTITY % sequence "%p;sequence">
<!ENTITY % any "%p;any">
<!ENTITY % anyAttribute "%p;anyAttribute">
<!ENTITY % sic "%p;sic">
<!ENTITY % attribute "%p;attribute">
<!ENTITY % attributeGroup "%p;attributeGroup">
<!ENTITY % include "%p;include">
<!ENTITY % import "%p;import">
<!ENTITY % notation "%p;notation">

<!-- 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 % schemaAttrs ''>
<!ENTITY % complexTypeAttrs ''>
<!ENTITY % elementAttrs ''>
<!ENTITY % groupAttrs ''>
<!ENTITY % allAttrs ''>
<!ENTITY % choiceAttrs ''>
<!ENTITY % sequenceAttrs ''>
<!ENTITY % anyAttrs ''>
<!ENTITY % anyAttributeAttrs ''>
<!ENTITY % attributeAttrs ''>
<!ENTITY % attributeGroupAttrs ''>
<!ENTITY % uniqueAttrs ''>
<!ENTITY % keyAttrs ''>
<!ENTITY % keyrefAttrs ''>
<!ENTITY % includeAttrs ''>
<!ENTITY % importAttrs ''>
<!ENTITY % notationAttrs ''>

<!ENTITY % complexDerivationChoice "(extension|restriction|reproduction)">
<!ENTITY % complexDerivationSet "CDATA">
      <!-- #all or space-separated list drawn from derivationChoice -->
<!ENTITY % blockSet "CDATA">
      <!-- #all or space-separated list drawn from
                      derivationChoice + 'equivClass' and 'list' -->

<!ENTITY % mgs '%all; | %choice; | %sequence;'>
<!ENTITY % cs '%choice; | %sequence;'>

<!-- the duplication below is to produce an unambiguous content model
     which allows annotation everywhere -->
<!ELEMENT %schema; ((%include; | %import; | %annotation;)*,
                    (%simpleType; | %complexType;
                     | %element;
                     | %attributeGroup; | %group;
                     | %notation; ),
                    (%annotation;
                     | %simpleType; | %complexType;
                     | %element;
                     | %attributeGroup; | %group;
                     | %notation; )* )>
<!ATTLIST %schema;
     targetNamespace    %URIref;               #IMPLIED
     version            CDATA                  #IMPLIED
     %nds;              %URIref;               #FIXED '&XMLSchemaNS;'
     %dtnds;            %URIref;               #FIXED '&XMLSchemaNS;/datatypes'
     finalDefault       %complexDerivationSet; ''
     blockDefault       %blockSet;             ''
     id                 ID                     #IMPLIED
     %schemaAttrs;>
<!-- Note the xmlns declaration is NOT in the Schema for Schemas,
     because at the Infoset level where schemas operate,
     xmlns(:prefix) is NOT an attribute! -->
 
<!-- The id attribute here and below is for use in external references
     from non-schemas using simple fragment identifiers.
     It is NOT used for schema-to-schema reference, internal or
     external. -->

<!-- a type is a named content type specification which allows attribute
     declarations-->
<!-- -->

<!ELEMENT %complexType; ((%annotation;)?,
                 ((%facet;)*|
                  ((%element;| %mgs; | %group; | %any;)*,
                   (%attribute;| %attributeGroup;)*,
                   (%anyAttribute;)?)))>

<!ATTLIST %complexType;
          name      %NCName;                        #IMPLIED
          id        ID                              #IMPLIED
          content   (textOnly|mixed|elementOnly|empty) #IMPLIED
          abstract  %boolean;                       'false'
          final     %complexDerivationSet;          ''
          block     %complexDerivationSet;          ''
          derivedBy %complexDerivationChoice;       #IMPLIED 
          base      %QName;                         #IMPLIED
          %complexTypeAttrs;>

<!-- facets only if derivedBy='restriction' -->
<!-- (element|group|any) only if content=mixed or =elementOnly
     and NO derivedBy at all, i.e. a root type -->
<!-- content defaults to base's if there is a complex base,
     textonly if there's a simple base,
     'mixed' if no base (because that's the urType's content)
             and no content daughters,
     'elementOnly' otherwise --> 
<!-- should we replace content='empty' with content='elementOnly'
     final='#all' plus no content? -->

<!-- If one top-level group, that IS the content model, otherwise
     an implicit group obtains.
     This is
       <sequence minOccurs='1' maxOccurs='1'>
     unless content='mixed', in which case it's
       <choice minOccurs='0' maxOccurs='*'> -->

<!-- If anyAttribute appears in one or more referenced attributeGroups
     and/or explicitly, the intersection of the permissions is used -->

<!-- A text-only type with no attributes differs from a datatype with
     the same base qualified the same way in regard to the impact on
     attributes of anyAttribute -->

<!-- an element is declared by either:
 a name and a type (either nested or referenced via the type attribute)
or:
 a ref to an existing element declaration -->

<!ELEMENT %element; ((%annotation;)?, (%complexType;| %simpleType;)?,
                     (%unique; | %key; | %keyref;)*)>
<!-- type or datatype only if no type|ref attribute -->
<!-- ref not allowed at top level -->
<!ATTLIST %element;
            name        %NCName;               #IMPLIED
            id          ID                     #IMPLIED
            ref         %QName;                #IMPLIED
            type        %QName;                #IMPLIED
            minOccurs   %non-negative-integer; '1'
            maxOccurs   CDATA                  #IMPLIED
            nullable    %boolean;              'false'
            equivClass  %QName;                #IMPLIED
            abstract    %boolean;              'false'
            final       %complexDerivationSet; ''
            block       %blockSet;             ''
            default     CDATA                  #IMPLIED
            fixed       CDATA                  #IMPLIED
            %elementAttrs;>
<!-- type and ref are mutually exclusive.
     name and ref are mutually exculsive, one is required -->
<!-- In the absence of type AND ref, type defaults to type of
     equivClass, if any, else the ur-type, i.e. unconstrained -->
<!-- maxOccurs defaults to 1 or minOccurs, whichever is greater -->
<!-- default and fixed are mutually exclusive -->

<!ELEMENT %group; (%mgs;)?>
<!ATTLIST %group; 
          name        %NCName;               #IMPLIED
          ref         %QName;                #IMPLIED
          minOccurs   %non-negative-integer; '1'
          maxOccurs   CDATA                  #IMPLIED
          id          ID                     #IMPLIED
          %groupAttrs;>

<!ELEMENT %all; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)>
<!ATTLIST %all;
          minOccurs   %non-negative-integer; '1'
          maxOccurs   CDATA                  #IMPLIED
          id          ID                     #IMPLIED
          %allAttrs;>

<!ELEMENT %choice; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)>
<!ATTLIST %choice;
          minOccurs   %non-negative-integer; '1'
          maxOccurs   CDATA                  #IMPLIED
          id          ID                     #IMPLIED
          %choiceAttrs;>

<!ELEMENT %sequence; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)>
<!ATTLIST %sequence;
          minOccurs   %non-negative-integer; '1'
          maxOccurs   CDATA                  #IMPLIED
          id          ID                     #IMPLIED
          %sequenceAttrs;>

<!-- an anonymous grouping in a model, or
     a top-level named group definition, or a reference to same -->

<!-- Note that if order is 'all', group is not allowed inside.
     If order is 'all' THIS group must be alone (or referenced alone) at
     the top level of a content model -->
<!-- If order is 'all', minOccurs==maxOccurs==1 on element/any inside -->
<!-- Should allow minOccurs=0 inside order='all' . . . -->

<!ELEMENT %any; EMPTY>
<!ATTLIST %any;
            namespace       CDATA                  '##any'
            processContents (skip|lax|strict)      'strict'
            minOccurs       %non-negative-integer; '1'
            maxOccurs       CDATA                  #IMPLIED
            %anyAttrs;>

<!-- namespace is interpreted as follows:
                  ##any      - - any non-conflicting WFXML at all

                  ##other    - - any non-conflicting WFXML from namespace other
                                  than targetNamespace

                  ##local    - - any unqualified non-conflicting WFXML/attribute
                  one or     - - any non-conflicting WFXML from
                  more URI        the listed namespaces
                  references

                  ##targetNamespace may appear in the above list, with the
                   obvious meaning -->

<!ELEMENT %anyAttribute; EMPTY>
<!ATTLIST %anyAttribute;
            namespace    CDATA   '##any'
            %anyAttributeAttrs;>
<!-- namespace is interpreted as for 'any' above -->


<!-- for use inside basetype to copy down corresponding content
     model particle from the basetype's content model -->
<!ELEMENT %sic; EMPTY>

<!ELEMENT %attribute; ((%annotation;)?, (%simpleType;)?)>
<!ATTLIST %attribute;
          name      %NCName;      #REQUIRED
          type      %QName;       #IMPLIED
          maxOccurs (0|1)         '1'
          minOccurs (0|1)         '0'
          default   CDATA         #IMPLIED
          fixed     CDATA         #IMPLIED
          %attributeAttrs;>
<!-- default and fixed are mutually exclusive -->
<!-- type attr and datatype content are mutually exclusive -->

<!-- an attributeGroup is a named collection of attribute decls, or a
     reference thereto -->
<!ELEMENT %attributeGroup; ((%annotation;)?,
                       (%attribute; | %attributeGroup;)*,
                       (%anyAttribute;)?) >
<!ATTLIST %attributeGroup;
                 name       %NCName;       #IMPLIED
                 id         ID             #IMPLIED
                 ref        %QName;        #IMPLIED
                 %attributeGroupAttrs;>

<!-- ref iff no content, no name.  ref iff not top level -->

<!-- better reference mechanisms -->
<!ELEMENT %unique; ((%annotation;)?, %selector;, (%field;)+)>
<!ATTLIST %unique; name     %NCName;       #REQUIRED
                   id       ID             #IMPLIED
                   %uniqueAttrs;>

<!ELEMENT %key;    ((%annotation;)?, %selector;, (%field;)+)>
<!ATTLIST %key;    name     %NCName;       #REQUIRED
                   id       ID             #IMPLIED
                   %keyAttrs;>

<!ELEMENT %keyref; ((%annotation;)?, %selector;, (%field;)+)>
<!ATTLIST %keyref;
                   name     %NCName;       #REQUIRED
                   id       ID             #IMPLIED
                   refer    %QName;        #REQUIRED
                   %keyrefAttrs;>

<!ELEMENT %selector; (#PCDATA)>
<!ELEMENT %field; (#PCDATA)>

<!-- Schema combination mechanisms -->
<!ELEMENT %include; EMPTY>
<!ATTLIST %include; schemaLocation %URIref; #REQUIRED
                    %includeAttrs;>

<!ELEMENT %import; EMPTY>
<!ATTLIST %import; namespace      %URIref; #REQUIRED
                   schemaLocation %URIref; #IMPLIED
                   %importAttrs;>

<!ELEMENT %notation; EMPTY>
<!ATTLIST %notation;
                 name        %NCName;    #REQUIRED
                 id          ID          #IMPLIED
                 public      CDATA       #REQUIRED
                 system      %URIref;    #IMPLIED
                 %notationAttrs;>

<!NOTATION XMLSchemaStructures PUBLIC 'structures'
           '&XSP1.URI;.xsd' >
<!NOTATION XML PUBLIC 'REC-xml-1998-0210'
               'http://www.w3.org/TR/1998/REC-xml-19980210' >
