<!ELEMENT schema ((import*, include*, export?,  
                  (comment | datatype | archetype | elementType   
                  | attrGroup | modelGroup | notation 
                  | textEntity | externalEntity | unparsedEntity)* ))>
<!ATTLIST schema
                 name        CDATA       #IMPLIED
                 version     CDATA       #IMPLIED
                 xmlns       CDATA       "http://www.w3.org/1999/05/06-xmlschema-1/structures.xsd"
                 model      (open|refinable|closed) "closed" >

<!ELEMENT import (( elementTypeRef | archetypeRef | datatypeRef 
                  | modelGroupRef | attrGroupRef | entityRef 
                  | notationRef )* ) >

<!ATTLIST import
                 schemaAbbrev     NMTOKEN      #REQUIRED 
                 schemaName       CDATA        #REQUIRED 
                 datatypes        (true|false) "true"  
                 archetypes       (true|false) "true"  
                 elementTypes     (true|false) "true"  
                 attrGroups       (true|false) "true"  
                 modelGroups      (true|false) "true"  
                 entities         (true|false) "true"  
                 notations        (true|false) "true" >

<!ELEMENT export EMPTY >
<!ATTLIST export 
                 datatypes        (true|false) "true"  
                 archetypes       (true|false) "true"  
                 elementTypes     (true|false) "true"  
                 attrGroups       (true|false) "true"  
                 modelGroups      (true|false) "true"  
                 entities         (true|false) "true"  
                 notations        (true|false) "true" >

<!ELEMENT include (( elementTypeRef | archetypeRef | datatypeRef 
                  | modelGroupRef | attrGroupRef | entityRef 
                  | notationRef )* ) >

<!ATTLIST include
                 schemaName       CDATA        #REQUIRED 
                 datatypes        (true|false) "true"  
                 archetypes       (true|false) "true"  
                 elementTypes     (true|false) "true"  
                 attrGroups       (true|false) "true"  
                 modelGroups      (true|false) "true"  
                 entities         (true|false) "true"  
                 notations        (true|false) "true" >


<!-- -->
<!-- comments contain text -->
<!-- -->
<!ELEMENT comment (#PCDATA) >

<!-- The datatype element is defined in XML Schema: Part 2: Datatypes -->
<!ENTITY % xs-datatypes PUBLIC "datatypes"
                     "http://www.w3.org/1999/05/06-xmlschema-2/datatypes.dtd" >
%xs-datatypes;


<!ELEMENT datatypeRef ((%ordered; | %unordered;)*, (default|fixed)*) >
<!ATTLIST datatypeRef
                 name            NMTOKEN    #REQUIRED
                 schemaAbbrev    NMTOKEN    #IMPLIED
                 schemaName      CDATA      #IMPLIED >

<!ELEMENT default (#PCDATA) >
<!ELEMENT fixed (#PCDATA) >



<!ENTITY % modelElt "all|choice|elementTypeRef|elementType|sequence" >
<!ENTITY % model    "any|empty|%modelElt;|mixed" >
<!-- -->
<!-- an archetype is a named content type specification -->
<!-- -->
<!ELEMENT archetype ( refines?,
                     ( datatypeRef |
                      (%model; | modelGroupRef) )?,
                     (attrDecl | attrGroupRef)* ) >
<!ATTLIST archetype
                 name        NMTOKEN     #REQUIRED
                 export     (true|false) "true"
                 model      (open|refinable|closed) #IMPLIED >

<!ELEMENT refines (archetypeRef)* >

<!ELEMENT archetypeRef EMPTY >
<!ATTLIST archetypeRef 
                 name      NMTOKEN    #REQUIRED 
                 schemaAbbrev    NMTOKEN    #IMPLIED
                 schemaName CDATA      #IMPLIED >

<!-- -->
<!-- an elementType is a named element and its content type -->   
<!-- -->
<!ELEMENT elementType ( refines?,
                       ( datatypeRef | archetypeRef |
                        (%model; | modelGroupRef) )?,
                       (attrDecl | attrGroupRef)* ) >
<!ATTLIST elementType
                 name        NMTOKEN       #REQUIRED
                 export     (true|false)   "true"
                 model      (open|refinable|closed) #IMPLIED >

<!ELEMENT elementTypeRef EMPTY >
<!ATTLIST elementTypeRef 
                 name      NMTOKEN    #REQUIRED
                 schemaAbbrev    NMTOKEN    #IMPLIED
                 schemaName CDATA      #IMPLIED
                 minOccur    CDATA      "1" 
                 maxOccur    CDATA      #IMPLIED >

<!-- -->
<!-- a model is a named content model (without attributes) -->
<!-- -->
<!ELEMENT modelGroup  (%modelElt;) >
<!ATTLIST modelGroup
                 name        NMTOKEN     #REQUIRED
                 export     (true|false) "true" >

<!ELEMENT modelGroupRef EMPTY >
<!ATTLIST modelGroupRef 
                 name        NMTOKEN    #REQUIRED
                 schemaAbbrev      NMTOKEN    #IMPLIED
                 schemaName   CDATA      #IMPLIED
                 minOccur    CDATA      "1" 
                 maxOccur    CDATA      #IMPLIED >

<!ELEMENT any EMPTY >
<!ELEMENT empty EMPTY >
<!ELEMENT mixed (elementTypeRef|elementType)* >

<!ELEMENT sequence (modelGroupRef | sequence | choice | all
                    | elementType | elementTypeRef)+ >
<!ATTLIST sequence
                 minOccur    CDATA      "1" 
                 maxOccur    CDATA      #IMPLIED >

<!ELEMENT choice (modelGroupRef | sequence | choice | all
                  | elementType | elementTypeRef)+ >
<!ATTLIST choice
                 minOccur    CDATA      "1" 
                 maxOccur    CDATA      #IMPLIED >

<!ELEMENT all (modelGroupRef | sequence | choice | all
               | elementType | elementTypeRef)+ >
<!ATTLIST all
                 minOccur    CDATA      "1" 
                 maxOccur    CDATA      #IMPLIED >

<!-- -->
<!-- an attrDecl names an attribute specification -->
<!-- the datatypeRef default is "string" -->
<!-- the attrValue allows * for NMTOKEN lists -->
<!-- -->
<!ELEMENT attrDecl (datatypeRef?) >
<!ATTLIST attrDecl
                 name        NMTOKEN     #REQUIRED
                 required   (true|false) "false"  >

<!-- an attrGroup is a named collection of attrDecls -->
<!ELEMENT attrGroup (attrDecl | attrGroupRef)+ >
<!ATTLIST attrGroup
                 name        NMTOKEN     #REQUIRED
                 export     (true|false) "true" >

<!ELEMENT attrGroupRef EMPTY >
<!ATTLIST attrGroupRef 
                 name      NMTOKEN    #REQUIRED
                 schemaAbbrev    NMTOKEN    #IMPLIED
                 schemaName CDATA      #IMPLIED >

<!--  -->
<!-- Entities and notations in XML Schema -->
<!--  -->

<!-- the three kinds of entities share a symbol space  -->
<!ELEMENT entityRef EMPTY >
<!ATTLIST entityRef 
                 name      NMTOKEN    #REQUIRED
                 schemaAbbrev    NMTOKEN    #IMPLIED
                 schemaName CDATA      #IMPLIED >

<!-- a textEntity can be referenced in documents of this type -->
<!ELEMENT textEntity (#PCDATA) >
<!ATTLIST textEntity
                 name        NMTOKEN     #REQUIRED
                 export      (true|false) #FIXED "true" >

<!-- an externalEntity can be referenced in documents of this type -->
<!ELEMENT externalEntity EMPTY >
<!ATTLIST externalEntity
                 name        NMTOKEN     #REQUIRED
                 export     (true|false) #FIXED "true" 
                 public      CDATA       #IMPLIED
                 system      CDATA       #REQUIRED
                 notation    NMTOKEN     #FIXED "XML">

<!-- declares notation to be a 1st class element or entity content types -->
<!ELEMENT notation EMPTY >
<!ATTLIST notation
                 name        NMTOKEN     #REQUIRED
                 export     (true|false) #FIXED "true"
                 public      CDATA       #REQUIRED
                 system      CDATA       #IMPLIED>

<!ELEMENT notationRef EMPTY >
<!ATTLIST notationRef 
                 name      NMTOKEN    #REQUIRED
                 schemaAbbrev    NMTOKEN    #IMPLIED
                 schemaName CDATA      #IMPLIED >

<!-- an unparsedEntity can be referenced in documents of this type  -->
<!ELEMENT unparsedEntity EMPTY >
<!ATTLIST unparsedEntity
                 name        NMTOKEN     #REQUIRED
                 export     (true|false) #FIXED "true"
                 public      CDATA       #IMPLIED
                 system      CDATA       #REQUIRED
                 notation    NMTOKEN     #REQUIRED >

<!NOTATION XMLSchemaStructures PUBLIC "structures" "http://www.w3.org/1999/05/06-xmlschema-1/structures.xsd" >
<!NOTATION XML PUBLIC "REC-xml" "http://www.w3.org/TR/1998/REC-xml-19980210" >
