<?xml version='1.0'?>
<?xml:stylesheet type='text/xsl' href='XMLspec-19990503.msxsl'?>
<!DOCTYPE spec PUBLIC "-//HST//DTD Specification::19990423//EN" "xmlspec-19990429.dtd" [
   <!ENTITY SchemaWG "W3C XML Schema Working Group">
   <!ENTITY XSP1 "<emph>XML Schema: Structures</emph>">
   <!ENTITY XSP2 "<emph>XML Schemas: Datatypes</emph>">
   <!ENTITY draft.year "1999">
   <!ENTITY draft.month "May">
   <!ENTITY draft.day "6">
   <!ENTITY doc.date "&draft.day; &draft.month; &draft.year;">
   <!ENTITY w3c.doc.date "&draft.day;-&draft.month;-&draft.year;">
   <!ENTITY draft.YY "1999">
   <!ENTITY draft.MM "05">
   <!ENTITY draft.DD "06">
   <!ENTITY iso.doc.date "&draft.YY;&draft.MM;&draft.DD;">
   <!ENTITY draft.base "http://www.w3.org/&draft.YY;/&draft.MM;/&draft.DD;">
   <!ENTITY WD-XSP1 "structures">
   <!ENTITY XSP1.base "&draft.base;-xmlschema-1/">
   <!ENTITY XSP1.URI "&XSP1.base;&WD-XSP1;">
   <!ENTITY XSP1.version "0.4">
   <!ENTITY WD-XSP2 "datatypes">
   <!ENTITY XSP2.base "&draft.base;-xmlschema-2/">
   <!ENTITY XSP2.URI "&XSP2.base;&WD-XSP2;">
   <!ENTITY doc.audience "and external review.">
   <!ENTITY doc.distribution "For distribution">
 ]>
<spec> 
  <header> 
    <title>XML Schema Part 1: Structures</title>
    <version>&XSP1.version;</version> 
    <w3c-designation></w3c-designation> 
    <w3c-doctype>W3C Working Draft</w3c-doctype> 
    <pubdate> 
      <day>&draft.day;</day> 
      <month>&draft.month;</month> 
      <year>&draft.year;</year> 
    </pubdate> 
    <publoc> <loc href="&XSP1.base;">&XSP1.base;</loc><loc
      href="&XSP1.URI;.xml">&XSP1.URI;.xml</loc> <loc
      href="&XSP1.URI;.html">&XSP1.URI;.html</loc> <loc
      href="&XSP1.URI;.xsd">&XSP1.URI;.xsd</loc> <loc
      href="&XSP1.URI;.dtd">&XSP1.URI;.dtd</loc> 
    </publoc> 
    <latestloc><loc href="http://www.w3.org/TR/xmlschema-1/">http://www.w3.org/TR/xmlschema-1/</loc> 
    </latestloc> 
    <authlist> 
      <author> 
        <name>David Beech</name> 
        <affiliation>Oracle</affiliation> 
        <email href="mailto:dbeech@us.oracle.com">dbeech@us.oracle.com</email> 
      </author> 
      <author> 
        <name>Scott Lawrence</name> 
        <affiliation>Agranat Systems</affiliation> 
        <email href="mailto:lawrence@agranat.com">lawrence@agranat.com</email> 
      </author> 
      <author> 
        <name>Murray Maloney</name> 
        <affiliation>Commerce One</affiliation> 
        <email href="mailto:murray@muzmo.com">murray@muzmo.com</email> 
      </author> 
      <author> 
        <name>Noah Mendelsohn</name> 
        <affiliation>Lotus</affiliation> 
        <email
         href="mailto:noah_mendelsohn@lotus.com">noah_mendelsohn@lotus.com</email> 
      </author> 
      <author> 
        <name>Henry S. Thompson</name> 
        <affiliation>University of Edinburgh</affiliation> 
        <email href="mailto:ht@cogsci.ed.ac.uk">ht@cogsci.ed.ac.uk</email> 
      </author> 
    </authlist> 
    <status> 
      <p>This is a W3C Working Draft for review by members of the W3C and other
        interested parties in the general public.</p> 
      <p>It has been reviewed by the XML Schema Working Group and the Working
        Group has agreed to its publication. Note that not that all sections of the
        draft represent the current consensus of the WG. Different sections of the
        specification may well command different levels of consensus in the WG. Public
        comments on this draft will be instrumental in the WG&apos;s deliberations.</p>
      
      <p>Please review and send comments to
        <loc
         href="http://lists.w3.org/Archives/Public/www-xml-schema-comments/">www-xml-schema-comments@w3.org</loc>
        </p> 
      <p>The facilities described herein are in a preliminary state of design.
        The Working Group anticipates substantial changes, both in the mechanisms
        described herein, and in additional functions yet to be described. The present
        version should not be implemented except as a check on the design and to allow
        experimentation with alternative designs. <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 &quot;work in progress&quot;. </p> 
    </status> 
    <abstract>
      <p><emph> XML Schema: Structures</emph> is part one of a two part draft
        of the specification for the XML Schema definition language. This document
        proposes facilities for describing the structure and constraining the contents
        of XML 1.0 documents. The schema language, which is itself represented in XML
        1.0, provides a superset of the capabilities found in XML 1.0 document type
        definitions (DTDs.)</p> 
    </abstract>
    <pubstmt> 
      <p>Boston, Mountain View, Toronto, et al.: World-Wide Web Consortium, XML
        Working Group, 1999.</p> 
    </pubstmt> 
    <sourcedesc> 
      <p>Created in electronic form using XML.</p> 
    </sourcedesc> 
    <langusage> 
      <language id="EN">English</language> 
      <language id="ebnf">Extended Backus-Naur Form (formal grammar) 
      </language> 
      <language>Extensible Markup Language (XML)</language> </langusage>
    <revisiondesc> 
      <slist> 
        <sitem>1999-05-03: MCM: Updated schema and DTD. Package and test. 
        </sitem> 
        <sitem>1999-05-03 Integration of final editors&apos; concerns for WD1.
          Includes HT work on constraints.</sitem> 
        <sitem>1999-05-02 NRM General cleanup of first few chapters. Remove
          chapter 4 redundancy (tuple discussion) with new validity rules. </sitem> 
        <sitem>1999-05-02: HST: still chipping away at validity. Redefined the
          XSDL/XDTL entities.</sitem> 
        <sitem>19940502: MCM: mostly annotating the schema. Also moved info
          about abstract grammar into Chapter 2. Chapter 3 now starts right into defining
          a schema. Edited text entities to make them easier to manage.</sitem> 
        <sitem>19940501: HST: various</sitem> 
        <sitem>1999-04-30: NRM : revisions to chapter 4</sitem> 
        <sitem>1999-04-28: DB (pp HST) : promised edits for improved
          consistency and definition of &apos;schema&apos;; suggested modifications to
          3.4.9/10 and 3.5 </sitem> 
        <sitem>1999-04-39: HST : integrated DB&apos;s edits, completely rewrote
          6.1, replaced virtually all &lt;B&gt; with correct &lt;...ref&gt; </sitem> 
        <sitem>1999-04-28: DB (pp HST) : promised edits for improved
          consistency and definition of &apos;schema&apos;; suggested modifications to
          3.4.9/10 and 3.5 </sitem> 
        <sitem>1999-04-23: HST : Got all productions sorted using
          &apos;nt&apos; and correct IDs.</sitem> 
        <sitem>1999-04-21 : HST : Added lots of IDs and constraint heads:
          Validates w/o error</sitem> 
        <sitem>1999-04-21 : HST : Converted with no content changes to speak of
          from MCM-XSDL-19990416.html. This version has only ID/IDREF related errors
          left.</sitem> 
      </slist> 
    </revisiondesc> 
  </header> 
  <body> 
    <div1 id="intro"> 
      <head>Introduction</head> 
      <p>This structural part (&XSP1;) of the XML Schema definition language is
        a distillation of eight months of work by the &SchemaWG;, including four weeks
        of intensive work by a group of five editors. This Working Draft draws heavily
        on the work of <bibref ref="ref-dcd"/>, <bibref ref="ref-ddml"/>,
        <bibref ref="ref-sox"/>, <bibref ref="ref-xdr"/> and
        <bibref ref="ref-xml-data"/>. Requirements for &XSP1; can be found in
        <bibref ref="ref-xsreq"/>.</p> 
      <p>Chapter 2 presents a <specref ref="concepts"/> for &XSP1;, including
        an introduction to schema constraints, types, schema composition, and symbol
        spaces. The abstract and concrete syntax of &XSP1; are introduced, along with
        other terminology used throughout the specification. </p> 
      <p>Chapter 3 <specref ref="declare"/> reconstructs the core functionality
        of XML 1.0, plus a number of extensions, in line with our stated requirements
        <bibref ref="ref-xsreq"/>. This chapter discusses the declaration and use of
        datatypes, archetypes, element types, content models, attributes, attribute
        groups, model groups, refinement, entities and notations.</p> 
      <p>Chapter 4 presents <specref ref="composition"/>, including the
        validation of namespace qualified instance documents, import, inclusion and
        export of declarations and definitions, schema paths, access to schemas, and
        related rules for schema-based validity. </p> 
      <p>Chapter 5 is a placeholder for <specref ref="doc"/>, which will
        eventually provide a standardized means for including documentation in the
        definition of a schema. </p> 
      <p>Chapter 6 discusses <specref ref="conformance"/>, including the rules
        by which instance documents are validated, and responsibilities of schema-aware
        processors. </p> 
      <p>The normative addenda include a <specref ref="normative-schemaDTD"/>
        and a <specref ref="normative-schemaSchema"/>, which is an XML Schema schema
        for &XSP1;, a <specref ref="normative-glossary"/> and
        <specref ref="normative-references"/>. Non-normative appendixes include a
        <specref ref="sampleSchema"/> and acknowledgments [<specref
        ref="acknowledgments"/>]. </p> 
      <div2 id="intro-docConventions"> 
        <head>Documentation Conventions</head> 
        <p>This Working Draft document was produced using an
          <bibref ref="ref-xml"/> DTD and an <bibref ref="ref-xsl"/> stylesheet.</p> 
        <p>The following highlighting is used to present technical material in
          this document: </p> 
        <p> <termdef id="key-sampledef" term="term">A <term>term</term> is
          something we use a lot</termdef>. </p> 
 
        <scrap lang="ebnf" id="example">

          <head>Sample Abstract Syntax Production</head> 
          <prod id="nt-left" role="prefig"> 
            <lhs>left</lhs> 
            <rhs>right1 right2</rhs> 
          </prod> 
 
        </scrap>

        <note role="example">
          <p>A non-normative example illustrating use of the schema language,
            or a related instance. </p> 
          <eg xml:space="preserve">&lt;schema name=&apos;http://www.muzmo.com/XMLSchema/1.0/mySchema.xsd&apos; &gt;</eg>
          <p>And an explanation of the example.</p> 
      </note>
      <p>The following highlighting is used for non-normative commentary in
        this document:</p> 
      <issue id="dummy">
        <p>A recorded issue.</p> 
      </issue>
 
      <ednote>
        <edtext>Notes shared among the editorial team.</edtext> 
      </ednote>

      <note>
        <p>General comments directed to all readers. </p> 
      </note>
    </div2> 
    <div2 id="intro-purpose"> 
      <head>Purpose</head> 
      <p>The purpose of &XSP1; is to provide an inventory of XML markup
        constructs with which to write schemas. </p> 
      <p>The purpose of an &XSP1; schema is to define and describe a class of
        XML documents by using these constructs to constrain and document the meaning,
        usage and relationships of their constituent parts: datatypes, elements and
        their content, attributes and their values, entities and their contents and
        notations. Schema constructs may also provide for the specification of implicit
        information such as default values. Schemas are intended to document their own
        meaning, usage, and function through a common documentation vocabulary. </p> 
      <p>Thus, &XSP1; can be used to define, describe and catalogue XML
        vocabularies for classes of XML documents. </p> 
      <p>Any application that consumes well-formed XML can use the &XSP1;
        formalism to express syntactic, structural and value constraints applicable to
        its document instances. The &XSP1; formalism will allow a useful level of
        constraint checking to be described and validated for a wide spectrum of XML
        applications. </p> 
      <p>The language defined by this specification does not attempt to provide
        <emph>all</emph> the facilities that might be needed by <emph>any</emph>
        application. Some applications may require constraint capabilities not
        expressible in this language, and so may need to perform their own additional
        validations. </p> 
    </div2> 
    <div2 id="intro-relatedWork"> 
      <head>Relationship To Other Work</head> 
      <p>The definition of &XSP1; is a part of the
        <loc href="http://www.w3.org/XML/Activity.html">W3C XML Activity</loc>. It is
        in various ways related to other ongoing parts of that Activity and other W3C
        WGs </p> 
      <glist> 
        <gitem> 
          <label>XML Datatype Language</label>
          <def> 
            <p>&XSP1; has a dependency on the data typing mechanisms defined in
              its companion <bibref ref="ref-xsp2"/>, published simultaneously with this
              recommendation. </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label>Document Object Model </label>
          <def> 
            <p>&XSP1; has not yet identified requirements or dependencies. </p>
            
          </def> 
        </gitem> 
        <gitem> 
          <label>HTML </label>
          <def> 
            <p>&XSP1; has a requirement to support modularization of HTML. </p>
            
          </def> 
        </gitem> 
        <gitem> 
          <label>Internationalization Working Group </label>
          <def> 
            <p>See
              <loc
               href="http://www.w3.org/XML/Group/1999/03/xml-schema-i18n-notes">http://www.w3.org/XML/Group/1999/03/xml-schema-i18n-notes
                </loc> </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label>RDF Schema </label>
          <def> 
            <p>&XSP1; has not yet documented requirements or dependencies. </p>
            
          </def> 
        </gitem> 
        <gitem> 
          <label>WAI </label>
          <def> 
            <p>&XSP1; has a requirement to support accessibility. </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label>XML Information Set </label>
          <def> 
            <p>&XSP1; has significant dependencies on
              <bibref ref="ref-xmlinfo"/>.</p> 
            <p>&XSP1; defines its own <termref def="gloss-sic">Information Set
              Contributions</termref>.</p> 
            <p>&XSP1; will have requirements for subsequent Information Set
              Working Drafts .</p> 
          </def> 
        </gitem> 
        <gitem> 
          <label>XML Linking WG </label>
          <def> 
            <p>&XSP1; has not yet identified requirements or dependencies. </p>
            
          </def> 
        </gitem> 
        <gitem> 
          <label>XML Syntax </label>
          <def> 
            <p>&XSP1; must interoperate with XML 1.0 and subsequent revisions. 
            </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label>XSL WG </label>
          <def> 
            <p>&XSP1; has a requirement to support dimensions and aggregate
              datatypes. </p> 
          </def> 
        </gitem> 
      </glist> 
    </div2> 
    <div2 id="intro-terminology"> 
      <head>Terminology</head> 
      <p>The terminology used to describe &XSP1; 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 &XSP1; processors: </p> 
      <glist> 
        <gitem> 
          <label><termdef id="key-may" term="may"><term>may</term></termdef> 
          </label>
          <def> 
            <p>Conforming documents and processors are permitted to but need
              not behave as described. </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label><termdef id="key-must" term="must"><term>must</term></termdef>
            </label>
          <def> 
            <p>Conforming documents and processors are required to behave as
              described; otherwise they are in <termref def="key-error">error</termref>. </p>
            
          </def> 
        </gitem> 
        <gitem> 
          <label><termdef id="key-error"
            term="error"><term>error</term></termdef> </label>
          <def> 
            <p>A violation of the rules of this specification; results are
              undefined. Conforming software may detect and report an error and may recover
              from it. </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label><termdef id="key-fatalError" term="fatal error"><term>fatal
            error</term></termdef> </label>
          <def> 
            <p>An <termref def="key-error">error</termref> which a conforming
              processor must detect and report to the application. </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label><termdef id="key-match"
            term="match"><term>match</term></termdef> </label>
          <def> 
            <p>(Of strings or names:) Two strings or names being compared must
              be character for character the same. </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label><termdef id="key-identical"
            term="identical">identical</termdef></label>
          <def> 
            <p>(Of <pt>URI</pt>s or <nt def="nt-schemaName">schemaName</nt>s:)
              <emph>identical</emph>, according to the rules for identity in
              <bibref ref="ref-xml-namespaces"/>.</p> 
          </def> 
        </gitem> 
      </glist> 
    </div2> 
  </div1> 
  <div1 id="concepts"> 
    <head>Conceptual Framework</head> 
    <p> This specification uses a number of terms that are common to many of
      the fields of endeavor that have influenced the development of XML Schema.
      Unfortunately, it is often the case that these terms do not have the same
      definitions in all of those fields. This section attempts to provide
      definitions of terms as they are used to describe the conceptual framework, and
      the remainder of the specification.</p> 
    <div2 id="concepts-kindsOfDocs"> 
      <head>Kinds of XML Documents</head> 
      <p>Since XML schemas are themselves specified as XML documents, it is
        useful to clarify the relationships between certain kinds of XML documents: 
      </p> 
      <glist> 
        <gitem> 
          <label><termdef id="key-instance"
            term="Instance"><term>Instance</term></termdef> </label>
          <def> 
            <p>An XML document whose structure conforms to some schema. See
              <specref ref="composition-instances"/> for the means by which an instance
              identifies the schema(s) to which it conforms. </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label><termdef id="key-schema"
            term="Schema"><term>Schema</term></termdef> </label>
          <def> 
            <p>A set of rules for constraining the structure and articulating
              the information set of XML documents. </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label><termdef id="key-schema-definition"
            term="Schema Definition"><term>Schema Definition</term></termdef> </label>
          <def> 
            <p>An XML document that defines a schema. See
              <specref ref="composition-schemaAccess"/> for the means by which schema
              definition documents are accessed during processing. The term &quot;Schema
              Definition&quot; may also be abbreviated to &quot;schema&quot; where no
              confusion is likely. </p> 
          </def> 
        </gitem> 
      </glist> 
      <p>Note that it is possible to specify a schema definition to which
        schema definitions themselves must conform, and this is given in
        <specref ref="normative-schemaSchema"/>. An XML 1.0 DTD to which schema
        definitions must conform is also provided in
        <specref ref="normative-schemaDTD"/>. </p> 
      <p>Any schema definition is therefore also an instance. The editors will
        make an attempt to always use the most precise of these terms, but the reader
        should note that rules specified herein for instances do apply to all of the
        following kinds of XML document: 
        <ulist> 
          <item> 
            <p>Documents that are not schema definitions;</p> 
          </item> 
          <item> 
            <p>Schema definitions applicable to documents that are not schema
              definitions;</p> 
          </item> 
          <item> 
            <p>The schema definition applicable to schema definitions. </p> 
          </item> 
        </ulist> Likewise, rules for schemas do apply to the schema definition
        for schema definitions, which is an instance of itself.</p> 
    </div2> 
    <div2 id="concepts-schemaConstraints"> 
      <head>On schemas, constraints and contributions</head> 
      <p>The <bibref ref="ref-xml"/> specification describes two kinds of
        constraints on XML documents: <emph>well-formedness</emph> and
        <emph>validity</emph> constraints. Informally, the well-formedness constraints
        are those imposed by the definition of XML itself (such as the rules for the
        use of the &lt; and &gt; characters and the rules for proper nesting of
        elements), while validity constraints are the further constraints on document
        structure provided by a particular DTD. </p> 
      <p>Three kinds of normative statements about the impact of &XSP1;
        components on instances are distinguished in this specification:</p> 
      <glist> 
        <gitem> 
          <label><termdef id="gloss-cos"
            term="Constraint on Schemas"><term>Constraint on Schemas</term></termdef> 
          </label>
          <def> 
            <p>Constraints on the form and content of schemas themselves, above
              and beyond those expressed in <specref ref="normative-schemaSchema"/>; </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label><termdef id="gloss-svc"
            term="Schema-Validity Constraint"><term>Schema-Validity
            Constraint</term></termdef> </label>
          <def> 
            <p>Constraints on the form of instances which they must satisfy to
              be <termref def="key-schema-valid">schema-valid</termref>; </p> 
          </def> 
        </gitem> 
        <gitem> 
          <label><termdef id="gloss-sic"
            term="Schema Information Set Contribution"><term>Schema Information Set
            Contribution </term></termdef></label>
          <def> 
            <p>Augmentations to the information sets of instances which follow
              as a consequence of schema-validation. </p> 
          </def> 
        </gitem> 
      </glist> 
      <note>
        <p><termref def="gloss-sic">Schema Information Set
          Contribution</termref>s are not as new as might at first appear: XML 1.0
          validation augments the XML 1.0 information set in similar ways, e.g. by
          providing values for attributes not present in instances, and by implicitly
          exploiting type information for normalization or access, e.g. consider the
          effect of <code>NMTOKENS</code> on attribute whitespace, and the semantics of
          <code>ID</code> and <code>IDREF</code>. By including <termref
          def="gloss-sic">Schema Information Set Contribution</termref>s, we are trying
          to make explicit something XML 1.0 left implicit.</p> 
      </note>
      <p>&XSP1; not only reconstructs the DTD constraints of XML 1.0 using XML
        instance syntax, it also adds the ability to define new kinds of constraints.
        For example, although the author of an XML 1.0 DTD may declare an element type
        as containing character data, elements, or mixed content, there is no mechanism
        with which to constrain the contents of elements to only character data of a
        particular form, such as only integers in a specified range. </p> 
      <p>This specification supports the expression of just such constraints by
        including in the mechanism for the declaration of element types the option of
        specifying that its contents must consist of a valid string expression of a
        particular datatype. A number of other mechanisms are added which improve the
        expressive power, usability and maintainability of schemas as a means to
        defining the structure of XML documents. </p> 
    </div2> 
    <div2 id="concepts-types"> 
      <head>On &apos;types&apos;</head> 
      <p>The use of the word &apos;type&apos; has caused confusion in earlier
        discussions of schema technologies. Here, the word is used in several different
        contexts for a constraint on the form of (parts of) an element or attribute in
        an instance document. So, there are types that are suitable for constraining
        individual attributes, others that apply to entire elements (of which
        attributes may be a part), and so on. We use the words &apos;define&apos; and
        &apos;definition&apos; when speaking of types, and the words
        &apos;declare&apos; and &apos;declaration&apos; when specifying for an
        attribute or element type the type which constrains its form in instance
        documents. </p> 
    </div2> 
    <div2 id="concepts-schemaComponents"> 
      <head>Schemas and their component parts</head> 
      <p>The next chapter <specref ref="declare"/> sets out the &XSP1; approach
        to schemas and formal definitions of their component parts. Here we informally
        summarize the key constructs used in defining schemas. An asterisk (*) in the
        &apos;Named?&apos; column indicates that the name will appear in instances --
        other names are for schema use only. </p> 
      <table border="solid" cellpadding="5" cellspacing="0" width="100%">
        <tbody>
          <tr>
            <th align="left" valign="top" rowspan="1" colspan="1"> &XSP1;
              Feature </th> 
            <th align="left" valign="top" rowspan="1" colspan="1"> Purpose 
            </th> 
            <th align="left" valign="top" rowspan="1" colspan="1"> Named? </th>
            
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1"><specref
              ref="declare-schema"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> A wrapper
              containing all the definitions and declarations comprising a schema document. 
            </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Yes </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1"><specref
              ref="declare-datatype"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> A type
              (content constraint), such as &apos;integer&apos;, that applies to character
              data in an instance document, whether it appears as an attribute value or the
              contents of an element. The mechanisms for defining datatypes are set out
              elsewhere, in &XSP2;. </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Yes </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1"><specref
              ref="declare-archetype"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> A complete
              set of constraints for elements in instance documents, applying to both
              contents and attributes. </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Yes </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1">
              <specref ref="declare-elementType"/></td>
            <td align="left" valign="top" rowspan="1" colspan="1"> An
              association between a name for an element and an archetype. An element type
              declaration for &apos;A&apos; is comparable to a DTD declaration
              <code>&lt;!ELEMENT A .....&gt;</code>.</td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Yes* (local
              or global) </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1"><specref
              ref="declare-attribute"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> An
              association between a a name for an attribute and a datatype, together with
              occurrence constraints such as &apos;required&apos; or &apos;default&apos;. The
              association is local to its surrounding archetype.</td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Yes* (local)
              </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1"> Content type
              </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Either a
              datatype or a content model. A content type applies to the contents of elements
              in an instance document (but not their attribute values). It provides a
              unifying abstraction for the constraints which apply to the contents of
              elements, but introduces no additional features. </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> No </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1"><specref
              ref="declare-contentModel"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> A type
              (content constraint) that applies to the contents of elements in an instance
              document. Content models do not include attribute declarations.</td>
            <td align="left" valign="top" rowspan="1" colspan="1"> No </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1">
              <specref ref="declare-elementOnly"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Components
              for constructing content models which allow only element content. Includes
              facilities for grouping, sequencing, as well as for declaration of and
              reference to element types. </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> No (but see
              below) </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1">
              <specref ref="declare-attributeGroup"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> An
              association between a name and a reusable collection of attribute declarations.
              </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Yes </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1"><specref
              ref="declare-namedModelGroup"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Model groups
              are part of the content model building block abstraction, but are unnamed and
              cannot be referenced for reuse. A named model group is an association between a
              name and a model group, allowing for reuse.</td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Yes </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1"><specref
              ref="declare-refinement"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> One
              archetype may be defined as refining one or more other archetypes, acquiring
              content type and/or attributes therefrom.</td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Yes </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1"><specref
              ref="composition-schemaImport"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Extends the
              current schema with definitions and/or declarations from an external schema,
              retaining the association with the original schema.</td>
            <td align="left" valign="top" rowspan="1" colspan="1"> No </td>
          </tr>
          <tr>
            <td align="left" valign="top" rowspan="1" colspan="1"><specref
              ref="composition-schemaInclude"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> Integrates
              definitions and/or declarations from an external schema into the schema being
              defined, as if they had been defined locally.</td>
            <td align="left" valign="top" rowspan="1" colspan="1"> No </td>
          </tr>
        </tbody>
      </table>
    </div2> 
    <div2 id="concepts-nameSymbolSpaces"> 
      <head>Names and Symbol Spaces</head> 
      <p>As indicated in the third column of the tables above, most of the
        components listed are given names, which provide for references within the
        schema, and sometimes from one schema to another. For example, an attribute
        definition can refer to a named datatype, such as &apos;integer&apos;. A
        content model can refer to an element type, and so on. </p> 
      <p>If all such names were assigned from the same &apos;pool&apos;, then
        it would be impossible to have e.g. a datatype named &apos;integer&apos; and an
        element type with the name &apos;integer&apos; in the same schema.
        <termdef id="key-symbolSpace" term="symbol space">Accordingly we introduce the
        idea of a <term>symbol space</term> (avoiding &apos;name space&apos; to avoid
        confusion with &apos;Namespaces in XML&apos; <bibref
        ref="ref-xml-namespaces"/>).</termdef></p> 
      <p>There is a single distinct symbol space within a given schema for each
        of the abstractions named above other than &apos;Attribute&apos; and
        &apos;Element type&apos;: within a given symbol space, names are unique, but
        the same name may appear in more than one symbol space without conflict. In
        particular note that the same name can refer to both an archetype and an
        element type, without conflict or necessary relation between the two. </p> 
      <p>Attributes and local element type declarations are special, in that
        every archetype defines its own attribute and local element type symbol spaces.
        </p> 
    </div2> 
    <div2 id="declare-syntaxes"> 
      <head>Abstract and Concrete Syntax</head> 
      <p>&XSP1; is presented here primarily in the form of an
        <termdef id="key-abstractSyntax" term="abstract syntax"> <term>abstract
        syntax</term>, which provides a formal specification of the information
        provided for each declaration and definition in the schema language. </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. Terms in italics are primitives, not expanded here, either
        because they are defined elsewhere (e.g. <pt>URI</pt>, defined by
        <bibref ref="ref-uri"/>) or because they can only be grounded once a concrete
        syntax is decided on (e.g. <pt>choice</pt>). </p> 
      <p>An abstract syntax production prefixed with a number in brackets (e.g.
        [3]) is normative; other abstract syntax is either for purposes of explanation,
        or is a duplicate (for convenience) of a normative definition to be found
        elsewhere.</p> 
      <p>The abstract syntax illustrates the expressive power of the language,
        and the relationships among its component parts. The abstract syntax can be
        used to evaluate the expressive power of &XSP1;, but not its look and feel. In
        particular, please note that neither ordering within or between productions or
        choice of names is significant, and that any particular concrete syntax is not
        constrained by these.</p> 
      <p>The <termdef id="key-concreteSyntax"
        term="concrete syntax"><term>concrete syntax</term> of &XSP1;, the exact
        element and attribute names used in a schema</termdef>, are a key feature of
        its proposed design. The concrete syntax is the form in which the schema
        language is used by schema authors. 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. The concrete syntax profoundly
        affects the convenience and usability of the schema language. </p> 
      <p>We include a preliminary concrete syntax in this draft, via examples
        and in <specref ref="normative-schemaSchema"/> and
        <specref ref="normative-schemaDTD"/>. The emphasis in this version has been to
        stay quite close to the abstract syntax. </p> 
    </div2> 
  </div1> 
  <div1 id="declare"> 
    <head>Schema Definitions and Declarations</head> 
    <p>The principal purpose of &XSP1; is to provide a means for defining
      schemas that constrain the contents of instance documents and augment the
      information sets thereof. </p> 
    <div2 id="declare-schema"> 
      <head>The Schema</head> 
      <p>A schema contains some preamble information and a set of definitions
        and declarations. </p> 
 
      <scrap lang="ebnf" id="RuleSet.XS3">

        <head>Schema top level</head> 
        <prod id="nt-schema"> 
          <lhs>schema</lhs> 
          <rhs><nt def="nt-preamble">preamble</nt> <nt def="nt-dds">dds</nt>* 
          </rhs> 
        </prod> 
        <prod id="nt-dds"> 
          <lhs>dds</lhs> 
          <rhs><nt def="nt-datatypeDefn">datatypeDefn</nt> |
            <nt def="nt-archetypeDefn">archetypeDefn</nt> | <nt
            def="nt-elementTypeDecl">elementTypeDecl</nt> | <nt
            def="nt-attrGroupDefn">attrGroupDefn</nt> | <nt
            def="nt-modelGroupDefn">modelGroupDefn</nt> | <nt
            def="nt-notationDecl">notationDecl</nt> | <nt
            def="nt-entityDecl">entityDecl</nt></rhs> 
        </prod> 
        <prod id="nt-preamble"> 
          <lhs>preamble</lhs> 
          <rhs><nt def="nt-xmlSchemaRef">xmlSchemaRef</nt> <nt
            def="nt-schemaIdentity">schemaIdentity</nt> <nt
            def="nt-schemaVersion">schemaVersion</nt> <nt def="nt-model">model</nt>
            <nt def="nt-export">export</nt>? <nt def="nt-import">import</nt>?
            <nt def="nt-include">include</nt>?</rhs> 
        </prod> 
        <prod id="nt-xmlSchemaRef"> 
          <lhs>xmlSchemaRef</lhs> 
          <rhs><pt>URI</pt> </rhs> 
        </prod> 
        <prod id="nt-schemaIdentity"> 
          <lhs>schemaIdentity</lhs> 
          <rhs><pt>URI</pt></rhs> 
        </prod> 
        <prod id="nt-schemaVersion"> 
          <lhs>schemaVersion</lhs> 
          <rhs><pt>string-value</pt> </rhs> 
        </prod> 
        <prod id="nt-model"> 
          <lhs>model</lhs> 
          <rhs><pt>open</pt> | <pt>refinable</pt> | <pt>closed</pt> </rhs> 
        </prod> 
 
      </scrap>

      <p><nt def="nt-preamble">preamble</nt> consists of an
        <nt def="nt-xmlSchemaRef">xmlSchemaRef</nt> specifying the URI for &XSP1;; the
        <nt def="nt-schemaIdentity">schemaIdentity</nt> specifying the URI by which
        <emph>this</emph> schema is to be identified; and a <nt
        def="nt-schemaVersion">schemaVersion</nt> specification for private version
        documentation purposes and version management.</p> 
      <note role="example">
        <eg xml:space="preserve">
&lt;!DOCTYPE schema 
          PUBLIC &apos;-//W3C//DTD XML Schema Version 1.0//EN&apos;
          SYSTEM &apos;&XSP1.URI;.dtd&apos; &gt;

&lt;schema name=&apos;file:/usr/schemas/xmlschema/mySchema.xsd&apos; 
        version=&apos;M.n&apos; 
        xmlns=&apos;&XSP1.URI;.xsd&apos;&gt;

  ...

&lt;/schema&gt;
</eg>
        <p>Note that the abstract syntax <nt def="nt-xmlSchemaRef">xmlSchemaRef</nt> is
          realised via a default namespace declaration in the concrete syntax.</p> 
    </note>
    <p>The schema&apos;s <nt def="nt-model">model</nt> property is discussed in
      <specref ref="declare-refinement"/>. The schema&apos;s <nt
      def="nt-export">export</nt>, <nt def="nt-import">import</nt> and
      <nt def="nt-include">include</nt> properties are discussed in
      <specref ref="composition"/>.</p> 
    <p>The schema&apos;s declarations and definitions, discussed in detail in
      <specref ref="declare"/>, provide for the creation of new schema components: 
    </p> 
 
    <scrap lang="ebnf" id="RuleSet.XS4">

      <head>Summary of Definitions and Declarations</head> 
      <prod id="nt-datatypeDefn2" role="prefig"> 
        <lhs>datatypeDefn</lhs> 
        <rhs><pt>NCName</pt> <nt def="nt-datatypeSpec">datatypeSpec</nt> </rhs>
        
      </prod> 
      <prod id="nt-archetypeDefn2" role="prefig"> 
        <lhs>archetypeDefn</lhs> 
        <rhs><pt>NCName</pt> <nt def="nt-archetypeSpec">archetypeSpec</nt> 
        </rhs> 
      </prod> 
      <prod id="nt-elementTypeDecl2" role="prefig"> 
        <lhs>elementTypeDecl</lhs> 
        <rhs><pt>NCName</pt> <nt def="nt-elementTypeSpec">elementTypeSpec</nt> 
        </rhs> 
      </prod> 
      <prod id="nt-modelGroupDefn2" role="prefig"> 
        <lhs>modelGroupDefn</lhs> 
        <rhs><pt>NCName</pt> <nt def="nt-modelGroupSpec">modelGroupSpec</nt> 
        </rhs> 
      </prod> 
      <prod id="nt-attrGroupDefn2" role="prefig"> 
        <lhs>attrGroupDefn</lhs> 
        <rhs><pt>NCName</pt> <nt def="nt-attrGroupSpec">attrGroupSpec</nt> 
        </rhs> 
      </prod> 
      <prod id="nt-entityDecl2" role="prefig"> 
        <lhs>entityDecl</lhs> 
        <rhs><pt>NCName</pt> <nt def="nt-entitySpec">entitySpec</nt> </rhs> 
      </prod> 
      <prod id="nt-notationDecl2" role="prefig"> 
        <lhs>notationDecl</lhs> 
        <rhs><pt>NCName</pt> <nt def="nt-notationSpec">notationSpec</nt> </rhs>
        
      </prod> 
 
    </scrap>

    <note role="example">
      <p>The following illustrates the basic model for declaring all &XSP1;
        components:</p> 
      <eg xml:space="preserve">
 &lt;datatype name=&apos;myDatatype&apos;&gt;
  ...
 &lt;/datatype&gt;

 &lt;archetype name=&apos;myArchetype&apos;&gt;
  ...
 &lt;/archetype&gt;

 &lt;elementType name=&apos;myElementType&apos;&gt;
  ...
 &lt;/elementType&gt;

 &lt;attrGroup name=&apos;myAttrGroup&apos;&gt;
  ...
 &lt;/attrGroup&gt;

 &lt;modelGroup name=&apos;myModelGroup&apos;&gt;
  ...
 &lt;/modelGroup&gt;

 &lt;notation name=&apos;myNotation&apos; ... /&gt;

 &lt;textEntity name=&apos;myTextEntity&apos;&gt;
  ...
 &lt;/textEntity&gt;

 &lt;externalEntity name=&apos;myExternalEntity&apos; ... /&gt;

 &lt;unparsedEntity name=&apos;myUnparsedEntity&apos; ... /&gt;

&lt;/schema&gt;
</eg>
      <p>When creating a new component, we declare that its name is associated
        with the specification for that component. Each new component definition
        creates a new entry in the symbol space for that kind of component. </p> 
  </note>
  <constraintnote type="cos" id="cos-unique">
    <head>Unique Definition</head> 
    <p>The same <termref def="gloss-NCName">NCName</termref> must not appear in
      two definitions or declarations of the same type.</p> 
  </constraintnote>
  <issue id="no-evolution">
    <p> This draft does not deal with the requirement &quot;for addressing the
      evolution of schemata&quot; (see <bibref ref="ref-xsreq"/>).</p> 
  </issue>
</div2> 
<div2 id="declare-documentRoot"> 
  <head>The Document and its Root</head> 
  <note>
    <p>We have not so far seen any need to reconstruct the XML 1.0 notion of
      <emph>root</emph>. For the connection from document instances to schemas, see
      <specref ref="conformance-schemaValidity"/>.</p> 
  </note>
</div2> 
<div2 id="refSchemaConstructs"> 
  <head>References to Schema Constructs</head> 
  <p> Uniform means are provided for reference to a broad variety of schema
    constructs, both within a single schema and to features imported (<specref
    ref="composition-schemaImport"/>) from external schemas. The name used to
    reference any component of &XSP1; from within a schema consists of an
    <termref def="gloss-NCName">NCName</termref> and an optional
    <nt def="nt-schemaRef">schemaRef</nt>, a reference to an external
    <termref def="key-schema-definition">schema definition</termref>. In a few
    cases, some qualification may be added to a reference: this is made clear as
    the individual reference forms are introduced below. </p> 
 
  <scrap lang="ebnf" id="RuleSet.XS2">

    <head>Example: Component Names and References</head> 
    <prod id="nt-schemaRef"> 
      <lhs>schemaRef</lhs> 
      <rhs>(<nt def="nt-schemaAbbrev">schemaAbbrev</nt> |
        <nt def="nt-schemaName">schemaName</nt>)</rhs> 
    </prod> 
    <prod id="nt-schemaAbbrev"> 
      <lhs>schemaAbbrev</lhs> 
      <rhs><pt>NCName</pt></rhs> 
    </prod> 
    <prod id="nt-schemaName"> 
      <lhs>schemaName</lhs> 
      <rhs><pt>URI</pt></rhs> 
    </prod> 
    <prod id="nt-datatypeRef2" role="prefig"> 
      <lhs>datatypeRef</lhs> 
      <rhs><nt def="nt-datatypeName">datatypeName</nt>
        <nt def="nt-datatypeQual">datatypeQual</nt></rhs> 
    </prod> 
    <prod id="nt-datatypeName2" role="prefig"> 
      <lhs>datatypeName</lhs> 
      <rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
    </prod> 
    <prod id="nt-archetypeRef2" role="prefig"> 
      <lhs>archetypeRef</lhs> 
      <rhs><nt def="nt-archetypeName">archetypeName</nt></rhs> 
    </prod> 
    <prod id="nt-archetypeName2" role="prefig"> 
      <lhs>archetypeName</lhs> 
      <rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
    </prod> 
    <prod id="nt-elementTypeRef2" role="prefig"> 
      <lhs>elementTypeRef</lhs> 
      <rhs><nt def="nt-elementTypeName">elementTypeName</nt> </rhs> 
    </prod> 
    <prod id="nt-elementTypeName2" role="prefig"> 
      <lhs>elementTypeName</lhs> 
      <rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
    </prod> 
    <prod id="nt-attrGroupRef2" role="prefig"> 
      <lhs>attrGroupRef</lhs> 
      <rhs><nt def="nt-attrGroupName">attrGroupName</nt>
        <nt def="nt-attrGroupQual">attrGroupQual</nt></rhs> 
    </prod> 
    <prod id="nt-attrGroupName2" role="prefig"> 
      <lhs>attrGroupName</lhs> 
      <rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
    </prod> 
    <prod id="nt-modelGroupRef2" role="prefig"> 
      <lhs>modelGroupRef</lhs> 
      <rhs><nt def="nt-modelGroupName">modelGroupName</nt></rhs> 
    </prod> 
    <prod id="nt-modelGroupName2" role="prefig"> 
      <lhs>modelGroupName</lhs> 
      <rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
    </prod> 
    <prod id="nt-entityRef2" role="prefig"> 
      <lhs>entityRef</lhs> 
      <rhs><nt def="nt-entityName">entityName</nt></rhs> 
    </prod> 
    <prod id="nt-entityName2" role="prefig"> 
      <lhs>entityName</lhs> 
      <rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
    </prod> 
    <prod id="nt-notationRef2" role="prefig"> 
      <lhs>notationRef</lhs> 
      <rhs><nt def="nt-notationName">notationName</nt></rhs> 
    </prod> 
    <prod id="nt-notationName2" role="prefig"> 
      <lhs>notationName</lhs> 
      <rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
    </prod> 
 
  </scrap>

  <p>The BNF above illustrates the reference mechanisms used in this
    specification.</p> 
  <note role="example">
    <eg xml:space="preserve">
&lt;archetypeRef name=&apos;Address&apos;/&gt;

&lt;elementTypeRef name=&apos;BLOCKQUOTE&apos; schemaAbbrev=&apos;HTML&apos;/&gt;

&lt;datatypeRef name=&apos;quantityi&apos; schemaName=&apos;http://www.w3.org/xsl.xsd&apos;/&gt;
</eg>
    <p>The first of these is a local reference, the other two refer to schemas
      elsewhere. The <nt def="nt-elementTypeRef">elementTypeRef</nt> example assumes
      the <nt def="nt-schemaAbbrev">schemaAbbrev</nt> <code>HTML</code> has been
      declared for import; the <nt def="nt-datatypeRef">datatypeRef</nt> example
      similarly assumes that the given (imaginary as of this writing) URL has been
      declared for import. See <specref ref="composition-schemaImport"/>for a
      discussion of importing.</p> 
</note>
<constraintnote type="cos" id="cos-cons-import">
  <head>Consistent Import</head> 
  <p>A <nt def="nt-schemaAbbrev">schemaAbbrev</nt> or <nt
    def="nt-schemaName">schemaName</nt> in a <nt def="nt-schemaRef">schemaRef</nt>
    must be declared in an <specref ref="composition-schemaImport"/> of the current
    schema, and the <termref def="gloss-NCName">NCName</termref> qualified by that
    <nt def="nt-schemaRef">schemaRef</nt> must be an import (<specref
    ref="composition-importRestrictions"/>) of the appropriate type per that
    declaration.</p> 
</constraintnote>
<constraintnote type="cos" id="cos-ref-oneway">
  <head>One Reference Only</head> 
  <p>The concrete syntax uses <code>schemaAbbrev</code> and
    <code>schemaName</code> attributes to realise <nt
    def="nt-schemaName">schemaName</nt>. It is an error for both these attributes
    to appear on the same element in a schema.</p> 
</constraintnote>
<p><termdef id="key-identify" term="identify">A <B>...Ref</B>
  <term>identifies</term> a <B>...Spec</B> provided there is a definition or
  declaration of that <B>...Spec</B> in the appropriate schema whose
  <termref def="gloss-NCName">NCName</termref> matches the
  <termref def="gloss-NCName">NCName</termref> of the <B>...Ref</B>&apos;s
  <B>...Name</B>. If there is no <nt def="nt-schemaRef">schemaRef</nt> in the
  <B>...Name</B>, the appropriate schema is the current schema or a schema it
  <termref def="key-eventually-include">eventually includes</termref>; if there
  is a <nt def="nt-schemaRef">schemaRef</nt>, the URI contained in or abbreviated
  by it must <termref def="key-suc-res">resolve successfully</termref> to a
  schema, which is then the appropriate schema</termdef>. The
  <specref ref="cos-ident-ref"/> <termref def="gloss-cos">Constraint on
  Schemas</termref> may also obtain.</p> 
</div2> 
<div2 id="declare-typesElementsAttributes"> 
<head>Types, Elements and Attributes</head> 
<p>Like XML 1.0 DTDs, &XSP1; provides facilities for constraining the contents
  of elements and the values of attributes, and for augmenting the information
  set of instances, e.g. with defaulted values and type information.
  <termdef id="SC" term="SC">We refer hereafter to the combination of schema
  constraints and information set contributions with the abbreviation
  <term>SC</term></termdef>. Compared to DTDs, &XSP1; provides for a richer set
  of <termref def="SC">SC</termref>s, and improved capabilities for sharing
  <termref def="SC">SC</termref>s across sets of elements and attributes.</p> 
<div3 id="declare-datatype"> 
  <head>Datatype Definition</head> 
  <p>We start with <termdef id="key-datatype" term="datatype">the simple
    datatypes whose expression in XML documents consists entirely of character
    data. As in the current draft of &XSP2;, wherever we speak of
    <term>datatype</term>s in this draft, we shall mean these simple
    datatypes.</termdef> The treatment of aggregate datatypes (collections and
    structures) has not yet been resolved.</p> 
 
  <scrap lang="ebnf" id="RuleSet.XS5">

    <head>Datatypes</head> 
    <prod id="nt-datatypeDefn"> 
      <lhs>datatypeDefn</lhs> 
      <rhs><pt>NCName</pt> <nt def="nt-datatypeSpec">datatypeSpec</nt> </rhs> 
    </prod> 
    <prod id="nt-datatypeSpec"> 
      <lhs>datatypeSpec</lhs> 
      <rhs> 
        <com>[defined by XML Schemas: Datatypes]</com>
        <nt def="nt-exportControl">exportControl</nt>?</rhs> 
    </prod> 
    <prod id="nt-datatypeQual"> 
      <lhs>datatypeQual</lhs> 
      <rhs><nt def="nt-specialize">specialize</nt>?
        <nt def="nt-valueConstraint">valueConstraint</nt>?</rhs> 
    </prod> 
    <prod id="nt-specialize"> 
      <lhs>specialize</lhs> 
      <rhs><nt def="nt-facet">facet</nt>+</rhs> 
    </prod> 
    <prod id="nt-facet"> 
      <lhs>facet</lhs> 
      <rhs> 
        <com>is defined by XML Schemas: Datatypes. It might be a range
          restriction, min/max constraint, etc.</com> </rhs> 
    </prod> 
    <prod id="nt-valueConstraint"> 
      <lhs>valueConstraint</lhs> 
      <rhs><pt>default</pt> | <pt>fixed</pt> </rhs> 
    </prod> 
    <prod id="nt-datatypeRef"> 
      <lhs>datatypeRef</lhs> 
      <rhs><nt def="nt-datatypeName">datatypeName</nt>
        <nt def="nt-datatypeQual">datatypeQual</nt></rhs> 
    </prod> 
    <prod id="nt-datatypeName"> 
      <lhs>datatypeName</lhs> 
      <rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>? </rhs> 
    </prod> 
    <prod id="nt-schemaRef2" role="prefig"> 
      <lhs>schemaRef</lhs> 
      <rhs>(<nt def="nt-schemaAbbrev">schemaAbbrev</nt> |
        <nt def="nt-schemaName">schemaName</nt>)</rhs> 
    </prod> 
    <prod id="nt-schemaAbbrev2" role="prefig"> 
      <lhs>schemaAbbrev</lhs> 
      <rhs><pt>NCName</pt></rhs> 
    </prod> 
    <prod id="nt-schemaName2" role="prefig"> 
      <lhs>schemaName</lhs> 
      <rhs><pt>URI</pt></rhs> 
    </prod> 
 
  </scrap>

  <p>&XSP1; incorporates the datatype definition mechanisms specified by
    <bibref ref="ref-xsp2"/> in order to express <termref def="SC">SC</termref>s on
    attribute values and the character data contents of elements. </p> 
  <p>The first production above is for defining datatypes;
    <nt def="nt-datatypeSpec">datatypeSpec</nt> serves to indicate where this
    chapter connects with &XSP2;. <nt def="nt-exportControl">exportControl</nt> is
    defined in <specref ref="composition-schemaExport"/>.</p> 
  <p>The other productions provide for using datatypes once they have been
    defined, see below under <nt def="nt-contentType">contentType</nt> and
    <nt def="nt-attrDecl">attrDecl</nt>.</p> 
  <p>We assume that it is appropriate to allow for some local specialization of
    datatypes at the point of use, and provide for that here (<nt
    def="nt-specialize">specialize</nt>). </p> 
  <p>As explained in <specref ref="refSchemaConstructs"/>, a
    <nt def="nt-schemaRef">schemaRef</nt>, if included allows for the referenced
    definition to be located in some other schema. </p> 
  <note role="example">
    <eg xml:space="preserve">&lt;datatype name=&apos;myDatatype&apos;&gt;
 &lt;basetype name=&quot;...&quot;/&gt;
  [ ... TBD]
&lt;/datatype&gt;

&lt;datatypeRef name=&apos;myDatatype&apos;/&gt;

&lt;datatypeRef name=&apos;integer&apos;/&gt;

&lt;datatypeRef name=&apos;quantity&apos; schemaName=&apos;http://www.w3.org/xsl.xsd&apos;&gt;
 &lt;fixed&gt;12pt&lt;/fixed&gt;
&lt;/datatypeRef&gt;</eg>
    <p>The first example awaits the &XSP2; concrete syntax to be filled in. 
    </p> 
    <p>The first <nt def="nt-datatypeRef">datatypeRef</nt> example references
      the definition above it. The second references a datatype pre-defined by
      &XSP2;. The third references a datatype in an (imaginary) XSL schema and fixes
      its value.</p> 
</note>
<constraintnote type="cos" id="cos-builtin">
  <head>Avoid Built-ins</head> 
  <p>The <termref def="gloss-NCName">NCName</termref> must not be the same as
    the name of any of the built-in datatypes (see <bibref ref="ref-xsp2"/>).</p> 
</constraintnote>
<p><termdef id="key-satisfy-dt" term="dt-satisfy">A string (possibly empty)
  <term>dt-satisfies</term> a <nt def="nt-datatypeSpec">datatypeSpec</nt> and an
  optional <nt def="nt-datatypeQual">datatypeQual</nt> if</termdef></p> 
<ulist> 
  <item> 
    <p>The string is a valid instance of the datatype defined by that
      <nt def="nt-datatypeSpec">datatypeSpec</nt>, as specialized by the
      <nt def="nt-datatypeQual">datatypeQual</nt>&apos;s <nt
      def="nt-specialize">specialize</nt> (if present) (see <bibref ref="ref-xsp2"/>
      for a definition of when a string is a valid instance of a (possibly
      specialized) <nt def="nt-datatypeSpec">datatypeSpec</nt>; </p> 
  </item> 
</ulist> 
<p>and</p> 
<ulist> 
  <item> 
    <p>If there is a <nt def="nt-datatypeQual">datatypeQual</nt> and it
      includes a <pt>fixed</pt>, the string matches that fixed value. </p> 
  </item> 
</ulist> 
<constraintnote type="sic" id="sic-datatype">
  <head>Datatype Info</head> 
  <p>When a string <termref def="key-satisfy-dt">dt-satisfies</termref> a
    <nt def="nt-datatypeRef">datatypeSpec</nt> and an optional
    <nt def="nt-datatypeQual">datatypeQual</nt>, the containing attribute or
    element information item will be augmented to indicate the
    <nt def="nt-datatypeSpec">datatypeSpec</nt> and the <nt
    def="nt-specialize">specialize</nt> (if any) which it satisfied.</p> 
</constraintnote>
<note>
  <p>Timing constraints were such that this text may not align completely with
    &XSP2;</p> 
</note>
</div3> 
<div3 id="declare-archetype"> 
<head>Archetype Definition</head> 
<p><termdef id="archetype" term="archetype"><term>Archetype</term> definitions
  gather together all <termref def="SC">SC</termref>s pertinent to elements in
  instance documents, their attributes and their contents.</termdef> They are
  called archetypes because there may be more than one element type which shares
  the same <termref def="SC">SC</termref>s (see
  <specref ref="declare-elementType"/>), and which therefore can be constrained
  by a common archetype. </p> 
 
<scrap lang="ebnf" id="RuleSet.XS6">

  <head>Archetypes</head> 
  <prod id="nt-archetypeDefn"> 
    <lhs>archetypeDefn</lhs> 
    <rhs><pt>NCName</pt> <nt def="nt-archetypeSpec">archetypeSpec</nt> </rhs> 
  </prod> 
  <prod id="nt-archetypeSpec"> 
    <lhs>archetypeSpec</lhs> 
    <rhs><nt def="nt-refinement">refinement</nt>* <nt
      def="nt-contentType">contentType</nt> ( <nt def="nt-attrDecl">attrDecl</nt> |
      <nt def="nt-attrGroupRef">attrGroupRef</nt> )* <nt def="nt-model">model</nt>
      <nt def="nt-exportControl">exportControl</nt></rhs> 
  </prod> 
  <prod id="nt-contentType"> 
    <lhs>contentType</lhs> 
    <rhs><nt def="nt-datatypeRef">datatypeRef</nt> | <nt
      def="nt-contentModel">contentModel</nt> | <nt
      def="nt-modelGroupRef">modelGroupRef</nt></rhs> 
  </prod> 
  <prod id="nt-model2" role="prefig"> 
    <lhs>model</lhs> 
    <rhs><pt>open</pt> | <pt>refinable</pt> | <pt>closed</pt> </rhs> 
  </prod> 
  <prod id="nt-archetypeRef"> 
    <lhs>archetypeRef</lhs> 
    <rhs><nt def="nt-archetypeName">archetypeName</nt> </rhs> 
  </prod> 
  <prod id="nt-archetypeName"> 
    <lhs>archetypeName</lhs> 
    <rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
  </prod> 
 
</scrap>

<p>The first three productions above provide the basic structure of the
  definition, the last two provide for reference to the things defined. But note
  that the name of an archetype is not <emph>ipso facto</emph> the name of
  elements whose appearance in instances will be associated with the
  <termref def="SC">SC</termref>s of that type. The connection between an element
  type name and an archetype is made by an <nt
  def="nt-elementTypeDecl">elementTypeDecl</nt>, see below. </p> 
<p>Alongside <specref ref="declare-attribute"/> for permitted attributes,
  <termref def="SC">SC</termref>s for contents are defined in an archetype (<nt
  def="nt-contentType">contentType</nt>). For elements which may contain only
  character data, content type <termref def="SC">SC</termref>s are specified by
  reference to a <specref ref="declare-datatype"/>. Note that doing this by way
  of <nt def="nt-datatypeRef">datatypeRef</nt> means that the character data
  <termref def="SC">SC</termref>s may provide for specialization and even
  defaulting in a manner similar to attribute values. For other kinds of
  elements, a <specref ref="declare-contentModel"/> is required. </p> 
<issue id="elt-default">
  <p>The extension of defaulting to element content is tentative. </p> 
</issue>
<note role="example">
  <p> 
    <eg xml:space="preserve">
&lt;archetype name=&apos;myArchetype&apos;&gt;
    &lt;datatypeRef name=&apos;myDatatype&apos;/&gt;
    &lt;attrDecl ...&gt;. . .&lt;/attrDecl&gt;
&lt;/archetype&gt;
</eg>
    A simple archetype with character data content constrained by reference to
    a datatype defined in the same schema and one attribute. 
</p> 
</note>
<constraintnote type="cos" id="cos-attrg-unique">
<head>AttrGroup Unique</head> 
<p>The same <nt def="nt-attrGroupDefn">attrGroupDefn</nt> must not be
  referenced by two or more <nt def="nt-attrGroupRef">attrGroupRef</nt>s in the
  same <nt def="nt-archetypeSpec">archetypeSpec</nt>.</p> 
</constraintnote>
<constraintnote type="cos" id="cos-attrg-ided">
<head>AttrGroup Identified</head> 
<p>Every <nt def="nt-attrGroupRef">attrGroupRef</nt> in a
  <nt def="nt-archetypeSpec">archetypeSpec</nt> must <termref
  def="key-identify">identify</termref> an <nt
  def="nt-attrGroupSpec">attrGroupSpec</nt>.</p> 
</constraintnote>
<p><termdef id="key-attr-decl-set" term="attribute declaration set">The
<term>attribute declaration set</term> of an <nt
def="nt-archetypeSpec">archetypeSpec</nt> consists of all its
<termref def="key-effective">effective</termref> <nt
def="nt-attrDecl">attrDecls</nt> together with all the <nt
def="nt-attrDecl">attrDecls</nt> contained in the <nt
def="nt-attrGroupSpec">attrGroupSpecs</nt> <termref
def="key-identify">identified</termref> by any <nt
def="nt-attrGroupRef">attrGroupRefs</nt> it contains.</termdef></p> 
<p><termdef id="key-attr-fullname"
term="full name of an attribute declaration">The <term>full name</term> of an
<nt def="nt-attrDecl">attrDecl</nt> in an <termref
def="key-attr-decl-set">attribute declaration set</termref> is its
<termref def="gloss-NCName">NCName</termref> plus its <nt
def="nt-schemaName">schemaName</nt>, i.e. if it appeared directly in the
<nt def="nt-archetypeSpec">archetypeSpec</nt>, the empty string, if it was
acquired by <nt def="nt-refinement">refinement</nt> or if it came from an
<nt def="nt-attrGroupSpec">attrGroupSpec</nt>, then the <nt
def="nt-schemaName">schemaName</nt> from the <nt
def="nt-schemaRef">schemaRef</nt> which <termref
def="key-identify">identified</termref> the relevant <nt
def="nt-archetypeSpec">archetypeSpec</nt> or <nt
def="nt-attrGroupSpec">attrGroupSpec</nt> respectively, if any, otherwise the
empty string.</termdef></p> 
<constraintnote type="cos" id="cos-attr-unique">
<head>Attribute Locally Unique</head> 
<p>The same <termref def="key-attr-fullname">full name</termref> must not
  appear more than once in any <nt
  def="nt-archetypeSpec">archetypeSpec</nt>&apos;s
  <termref def="key-attr-decl-set">attribute declaration set</termref>.</p> 
</constraintnote>
<p><termdef id="key-satisfy-as" term="arch-satisfy">An element item
<term>a-satisfies</term> an <nt def="nt-archetypeSpec">archetypeSpec</nt> if
the element item&apos;s attribute items taken together as a set
<termref def="key-satisfy-attrs">attrs-satisfy</termref> the
<nt def="nt-archetypeSpec">archetypeSpec</nt>&apos;s
<termref def="key-attr-decl-set">attribute declaration set</termref>, and
either </termdef></p> 
<ulist> 
<item> 
  <p>The <nt def="nt-archetypeSpec">archetypeSpec</nt>&apos;s
    <nt def="nt-contentType">contentType</nt> is a <nt
    def="nt-datatypeRef">datatypeRef</nt>, the <nt
    def="nt-datatypeRef">datatypeRef</nt> <termref
    def="key-identify">identifies</termref> a <nt
    def="nt-datatypeSpec">datatypeSpec</nt>, the element item contains only
    comment, processing instruction and character information items and the string
    formed by concatenating the characters of each of the character information
    item children, if any, or else the empty string, <termref
    def="key-satisfy-dt">dt-satisfies</termref> that <nt
    def="nt-datatypeSpec">datatypeSpec</nt> as qualified by the
    <nt def="nt-datatypeRef">datatypeRef</nt>&apos;s <nt
    def="nt-datatypeQual">datatypeQual</nt> if any;</p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
  <p>the <nt def="nt-contentType">contentType</nt> is a
    <nt def="nt-contentModel">contentModel</nt>, and the sequence of character and
    element items contained by the element item <termref
    def="key-satisfy-cm">model-satisfies</termref> its <termref
    def="key-effective">effective</termref> <nt
    def="nt-contentModel">contentModel</nt>.</p> 
</item> 
</ulist> 
<issue id="sic-elt-default">
<p>The above definitions do not provide for handling a default on an
  archetype&apos;s datatypeRef. Preferred solution: empty element items
  <emph>ipso facto</emph> satisfy datatypeRefs with defaults and are augmented
  with the default value. This would have the consequence that you cannot provide
  the empty string as the explicit value of an element item if it&apos;s governed
  by a datatypeRef with a default.</p> 
</issue>
<constraintnote type="sic" id="sic-archetype">
<head>Archetype Info</head> 
<p>When an element item <termref def="key-satisfy-as">a-satisfies</termref> a
  <nt def="nt-archetypeSpec">archetypeSpec</nt>, that element information item
  will be augmented to indicate the <nt def="nt-archetypeSpec">archetypeSpec</nt>
  which it satisfied.</p> 
</constraintnote>
<note role="example">
<p>Why is the separation of element type and archetype provided for? In certain
  XML instance documents, the same attribute and content <termref
  def="SC">SC</termref>s are appropriate for more than one named element.
  Consider the following instance fragment:</p> 
<eg xml:space="preserve">
&lt;ShippingAddress id=&apos;a32&apos; saleable=&apos;yes&apos;&gt;
  &lt;Street&gt;1 Main Street&lt;/Street&gt;
  &lt;City&gt;New York&lt;/City&gt;
  &lt;Zip NineDigit=&apos;FALSE&apos;&gt;12345&lt;/Zip&gt;
&lt;/ShippingAddress&gt;

&lt;BillingAddress id=&apos;a29&apos; saleable=&apos;no&apos;&gt;
  &lt;Street&gt;2 Rose Lane&lt;/Street&gt;
  &lt;City&gt;Anytown&lt;/City&gt;
  &lt;Zip NineDigit=&apos;TRUE&apos;&gt;12345-6789&lt;/Zip&gt;
&lt;/BillingAddress&gt;</eg>
<p>This fragment contains two elements, <code>ShippingAddress</code> and
  <code>BillingAddress</code>, that have similar attributes and content. By
  defining a single appropriate archetype and declaring two element types which
  reference it, that commonality can be precisely expressed. </p> 
</note>
<note>
<p>This draft does not provide any mechanism for applying any <termref
def="SC">SC</termref>s to element items whose namespace does not
<termref def="key-nominate">nominate</termref> a schema. This may be addressed
in a later draft: in the meantime a workaround is possible as follows:</p> 
<p>Suppose we wish to use some Dublin Core terms in a schema, but all we know
is the URI for the Dublin Core document. Perhaps we want to schema-validate 
<eg>&lt;mybook&gt;&lt;dc:creator xmlns:dc=&apos;...&apos;&gt;Rafael
 Sabattini&lt;/dc:creator&gt;&lt;/mybook&gt;</eg>
where <code>mybook</code> is already known to be covered by my schema. The
workaround is to replace the real Dublin Core URI with a local URL for a tiny
schema which simply defines <code>creator</code>, and references the real URI
for documentation. 
</p> 
</note>
</div3> 
<div3 id="declare-attribute"> 
<head>Attribute Declaration</head> 
<p>Attribute declarations associate a name (which will appear as an attribute
in start tags in instances) with <termref def="SC">SC</termref>s for the
presence and value thereof. </p> 
 
<scrap lang="ebnf" id="RuleSet.XS7">

<head>Attributes</head> 
<prod id="nt-attrDecl"> 
<lhs>attrDecl</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-datatypeRef">datatypeRef</nt>?
<pt>required</pt> <nt def="nt-exportControl">exportControl</nt></rhs> 
</prod> 
<prod id="nt-datatypeRef3" role="prefig"> 
<lhs>datatypeRef</lhs> 
<rhs><nt def="nt-datatypeName">datatypeName</nt> <nt
def="nt-datatypeQual">datatypeQual</nt></rhs> 
</prod> 
<prod id="nt-datatypeQual2" role="prefig"> 
<lhs>datatypeQual</lhs> 
<rhs><nt def="nt-specialize">specialize</nt>? <nt
def="nt-valueConstraint">valueConstraint</nt>?</rhs> 
</prod> 
<prod id="nt-valueConstraint2" role="prefig"> 
<lhs>valueConstraint</lhs> 
<rhs><pt>default</pt> | <pt>fixed</pt> </rhs> 
</prod> 
<prod id="nt-datatypeName3" role="prefig"> 
<lhs>datatypeName</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>? </rhs> 
</prod> 
<prod id="nt-schemaRef3" role="prefig"> 
<lhs>schemaRef</lhs> 
<rhs>(<nt def="nt-schemaAbbrev">schemaAbbrev</nt> | <nt
def="nt-schemaName">schemaName</nt>)</rhs> 
</prod> 
 
</scrap>

<note>
<p>Note that the <nt def="nt-datatypeRef">datatypeRef</nt> productions are
repeated here for easy reference.</p> 
</note>
<p>Attribute declarations provide for: </p> 
<ulist> 
<item> 
<p>Requiring instances to have attributes; </p> 
</item> 
<item> 
<p>Constraining attribute values to express a datatype; </p> 
</item> 
</ulist> 
<note role="example">
<eg xml:space="preserve">&lt;attrDecl name=&apos;myAttribute&apos;/&gt;

&lt;attrDecl name=&apos;anotherAttribute&apos;&gt;
 &lt;datatypeRef name=&apos;integer&apos;&gt;
  &lt;default&gt;42&lt;/default&gt;
 &lt;/datatypeRef&gt;
&lt;/attrDecl&gt;

&lt;attrDecl name=&apos;yetAnotherAttribute&apos; required=&apos;true&apos;&gt;
 &lt;datatypeRef name=&apos;integer&apos;/&gt;
&lt;/attrDecl&gt;

&lt;attrDecl name=&apos;stillAnotherAttribute&apos;&gt;
 &lt;datatypeRef name=&apos;string&apos;&gt;
  &lt;fixed&gt;Hello world!&lt;/fixed&gt;
 &lt;/datatypeRef&gt;
&lt;/attrDecl&gt;
</eg>
<p>Four attributes are declared: one with no explicit <termref
def="SC">SC</termref>s at all; two defined by reference to a built-in type, one
with a default and one required to be present in instances; and one with a
fixed value.</p> 
</note>
<p>When attribute declarations are used in an archetype specification, each
archetype provides its own symbol space for attribute names. E.g. an attribute
named <code>title</code> within one archetype need not have the same
<nt def="nt-datatypeRef">datatypeRef</nt> as one declared within another
archetype.</p> 
<p><termdef id="key-attr-satisfy" term="attr-satisfy">An attribute item
<term>attr-satisfies</term> an <nt def="nt-attrDecl">attrDecl</nt> if
</termdef></p> 
<ulist> 
<item> 
<p>The <nt def="nt-attrDecl">attrDecl</nt> contains no <nt
def="nt-datatypeRef">datatypeRef</nt> and the attribute item&apos;s value
string <termref def="key-satisfy-dt">dt-satisfies</termref> the default
<nt def="nt-datatypeSpec">datatypeSpec</nt> for attributes</p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
<p>the <nt def="nt-attrDecl">attrDecl</nt>&apos;s <nt
def="nt-datatypeRef">datatypeRef</nt> <termref
def="key-identify">identifies</termref> a <nt
def="nt-datatypeSpec">datatypeSpec</nt> and the attribute item&apos;s value
string <termref def="key-satisfy-dt">dt-satisfies</termref> that
<nt def="nt-datatypeSpec">datatypeSpec</nt> as qualified by the
<nt def="nt-datatypeRef">datatypeRef</nt>&apos;s <nt
def="nt-datatypeQual">datatypeQual</nt> if any</p> 
</item> 
</ulist> 
<p>where the attribute item&apos;s value consists of only character information
items and by its &quot;value string&quot; is meant the string formed by
concatenating the characters of each of those character information item
children, if any, or else the empty string.</p> 
<issue id="default-attr-datatype">
<p>What <emph>is</emph> the default attribute <nt
def="nt-datatypeSpec">datatypeSpec</nt>?</p> 
</issue>
<p><termdef id="key-satisfy-attrs" term="attrs-satisfy">The attribute items of
an element item <term>attrs-satisfy</term> an <termref
def="key-attr-decl-set">attribute declaration set</termref> if</termdef></p> 
<ulist> 
<item> 
<p><B>1)</B> for each attribute item either</p> 
<ulist> 
<item> 
<p><B>1a) </B>there is an <nt def="nt-attrDecl">attrDecl</nt> in the
  <termref def="key-attr-decl-set">attribute declaration set</termref> whose
  <termref def="key-attr-fullname">full name</termref> consists of an
  <termref def="gloss-NCName">NCName</termref> which matches the attribute
  item&apos;s name and either</p> 
<ulist> 
  <item> 
    <p><B>1a1) </B>the attribute item has no namespace and the
      <nt def="nt-attrDecl">attrDecl</nt>&apos;s <termref
      def="key-attr-fullname">full name</termref> has no <termref
      def="nt-schemaName">schemaName</termref></p> 
  </item> 
</ulist> 
<p>or</p> 
<ulist> 
  <item> 
    <p><B>1a2) </B>the attribute item&apos;s namespace and the
      <nt def="nt-attrDecl">attrDecl</nt>&apos;s <termref
      def="key-attr-fullname">full name</termref>&apos;s <termref
      def="nt-schemaName">schemaName</termref> are <termref
      def="key-identical">identical</termref></p> 
  </item> 
</ulist> 
<p>and the attribute item <termref
  def="key-attr-satisfy">attr-satisfies</termref> the declaration</p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
<p><B>1b) </B>the <nt def="nt-archetypeSpec">archetypeSpec</nt> being
  <termref def="key-satisfy-as">a-satisfied</termref> by the attribute
  item&apos;s parent element item is <pt>open</pt></p> 
</item> 
</ulist> 
</item> 
</ulist> 
<p>and</p> 
<ulist> 
<item> 
<p><B>2) </B>every <nt def="nt-attrDecl">attrDecl</nt> in the
<termref def="key-attr-decl-set">attribute declaration set</termref> which is
<pt>required</pt> is used to <termref
def="key-attr-satisfy">attr-satisfy</termref> an attribute item in the context
of (1a) above</p> 
</item> 
</ulist> 
<constraintnote type="sic" id="sic-attr-default">
<head>Attribute Value Default</head> 
<p>For every <nt def="nt-attrDecl">attrDecl</nt> in the
<termref def="key-attr-decl-set">attribute declaration set</termref>
<emph>not</emph> used to <termref def="key-attr-satisfy">attr-satisfy</termref>
an attribute item in the context of (1a) above which has a
<nt def="nt-datatypeRef">datatypeRef</nt> which has a <pt>default</pt>, an
attribute item with the default value is added to the parent element item.</p> 
</constraintnote>
<issue id="namespace-declare">
<p>We&apos;ve got a problem with namespace declarations: they&apos;re not
attributes at the infoset level, so they can appear without compromising
validity, EXCEPT if there is a fixed or required declaration, and defaults
should have the apparently desired effect.</p> 
</issue>
</div3> 
<div3 id="declare-attributeGroup"> 
<head>Attribute Group Definition</head> 
<p>&XSP1; can name a group of attributes so that they may be incorporated as a
whole into archetype definitions: </p> 
 
<scrap lang="ebnf" id="RuleSet.XS8">

<head>Attribute groups</head> 
<prod id="nt-attrGroupDefn"> 
<lhs>attrGroupDefn</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-attrGroupSpec">attrGroupSpec</nt></rhs> 
</prod> 
<prod id="nt-attrGroupSpec"> 
<lhs>attrGroupSpec</lhs> 
<rhs><nt def="nt-attrDecl">attrDecl</nt>* <nt
def="nt-exportControl">exportControl</nt></rhs> 
</prod> 
<prod id="nt-attrGroupRef"> 
<lhs>attrGroupRef</lhs> 
<rhs><nt def="nt-attrGroupName">attrGroupName</nt> <nt
def="nt-attrGroupQual">attrGroupQual</nt></rhs> 
</prod> 
<prod id="nt-attrGroupName"> 
<lhs>attrGroupName</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
</prod> 
<prod id="nt-attrGroupQual"> 
<lhs>attrGroupQual</lhs> 
<rhs><nt def="nt-attrDecl">attrDecl</nt></rhs> 
</prod> 
 
</scrap>

<p>Attribute group definitions: </p> 
<ulist> 
<item> 
<p>provide a construct to replace some uses of
<termref def="gloss-parameterEntity">parameter entities</termref>. </p> 
</item> 
<item> 
<p>allow for the definition of <termref def="SC">SC</termref>s that relate
values of one attribute to others within the group. </p> 
</item> 
</ulist> 
<note role="example">
<eg xml:space="preserve">&lt;attrGroup name=&apos;myAttrGroup&apos;&gt;
    &lt;attrDecl .../&gt;
    ...
&lt;/attrGroup&gt;

&lt;archetype name=&apos;myElementType&apos;&gt;
    &lt;empty/&gt;
    &lt;attrGroupRef name=&apos;myAttrGroup&apos;/&gt;
&lt;/archetype&gt;
</eg>
<p>Define and refer to an attribute group. The effect is as if the attribute
declarations in the group were present in the archetype definition.</p> 
</note>
<note id="cos-qual">
<p>There needs to be a Constraint on Schema which constrains the attrDecls
which appear with an attrGroupRef: the name is the same as one of the attrDecls
in the group, datatype and defaulting preserves substitutability, etc.</p> 
</note>
</div3> 
<div3 id="declare-contentModel"> 
<head>Element Content Model</head> 
<p>When content of elements is not constrained by reference to a datatype
(<specref ref="declare-datatype"/>), it can have any, empty, element-only or
mixed content. In the latter cases, the form of the content is specified in
more detail. </p> 
 
<scrap lang="ebnf" id="RuleSet.XS9">

<head>Content model</head> 
<prod id="nt-contentModel"> 
<lhs>contentModel</lhs> 
<rhs><pt>any</pt> | <pt>empty</pt> | <nt def="nt-mixed">mixed</nt> |
<nt def="nt-eltOnly">eltOnly</nt></rhs> 
</prod> 
 
</scrap>

<p>A content model constrains the content of an archetype or an element type:
it says nothing about attributes. </p> 
<note role="example">
<p> 
<eg xml:space="preserve">&lt;any/&gt;   
   
&lt;empty/&gt; 

&lt;mixed&gt;...&lt;/mixed&gt;

[Element only content -- see element-only below]
</eg>

</p> 
</note>
<p>Content models do not have names, but appear as a part of the definition of
an archetype, which does have a name. Model <emph>groups</emph> can be named
and used by name, see below.</p> 
<p><termdef id="key-satisfy-cm" term="model-satisfies">A sequence of character
and element items (call this <pt>CESeq</pt>) <term>model-satisfies</term> an
<termref def="key-effective">effective</termref> <nt
def="nt-contentModel">contentModel</nt> if</termdef></p> 
<ulist> 
<item> 
<p>the sequence is empty and the <termref
def="key-effective">effective</termref> <nt
def="nt-contentModel">contentModel</nt> is <pt>empty</pt>;</p> 
</item> 
<item> 
<p>the <termref def="key-effective">effective</termref>
<nt def="nt-contentModel">contentModel</nt> is <pt>any</pt> and every element
item in <pt>CESeq</pt> is <termref def="key-ind-valid">independently
valid</termref>, and for every element item in <pt>CESeq</pt> such that the
schema which its namespace item resolves to is not the current schema there is
an <nt def="nt-import">import</nt> whose <nt
def="nt-schemaName">schemaName</nt> is <termref
def="key-identical">identical</termref> to that element item&apos;s namespace
item&apos;s <pt>URI</pt> and that <nt def="nt-import">import</nt> must either
be <pt>allElementTypes</pt> or contain an <nt
def="nt-elementTypeRef">elementTypeRef</nt> whose <pt>NCName</pt> matches that
element item&apos;s name;</p> 
</item> 
<item> 
<p>the <termref def="key-effective">effective</termref>
<nt def="nt-contentModel">contentModel</nt> is <nt def="nt-mixed">mixed</nt>
and every element item in <pt>CESeq</pt> <termref
def="key-satisfy-mixed">mixed-satisfies</termref> the
<termref def="key-effective">effective</termref> <nt def="nt-mixed">mixed</nt> 
</p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
<p>the <termref def="key-effective">effective</termref>
<nt def="nt-contentModel">contentModel</nt> is <termref
def="nt-eltOnly">eltOnly</termref> and the only character items in
<pt>CESeq</pt> are whitespace character items and the sub-sequence of
<pt>CESeq</pt> consisting of all the element items therein
<termref def="key-satisfy-eo">eo-satisfies</termref> the
<termref def="key-effective">effective</termref> <termref
def="nt-eltOnly">eltOnly</termref>.</p> 
</item> 
</ulist> 
</div3> 
<div3 id="declare-mixedContent"> 
<head>Mixed Content</head> 
<p>A content model for mixed content provides for mixing elements with
character data in document instances. The allowed element types are named, but
neither their order or their number of occurrences are constrainted. </p> 
 
<scrap lang="ebnf" id="RuleSet.XS11">

<head>Mixed content</head> 
<prod id="nt-mixed"> 
<lhs>mixed</lhs> 
<rhs>( <nt def="nt-elementTypeRef">elementTypeRef</nt> |
<nt def="nt-elementTypeDecl">elementTypeDecl</nt> )*</rhs> 
</prod> 
 
</scrap>

<p>The <nt def="nt-elementTypeRef">elementTypeRef</nt>s and
<nt def="nt-elementTypeDecl">elementTypeDecl</nt>s determine the element types
which may appear as children along with character data.</p> 
<note role="example">
<eg xml:space="preserve">&lt;mixed&gt;
 &lt;elementTypeRef name=&apos;name1&apos;/&gt;
 &lt;elementTypeRef name=&apos;name2&apos;/&gt;
 &lt;elementTypeRef name=&apos;name3&apos;/&gt;
&lt;/mixed&gt;
</eg>
<p>Allows character data mixed with any number of <code>name1</code>,
<code>name2</code> and <code>name3</code> elements.</p> 
</note>
<note>
<p>The fact that <nt def="nt-mixed">mixed</nt> allows for there to be
<emph>no</emph> <nt def="nt-elementTypeRef">elementTypeRef</nt>s or
<nt def="nt-elementTypeDecl">elementTypeDecl</nt>s makes it similar to XML
1.0&apos;s <xtermref
href="http://www.w3.org/TR/REC-xml#NT-Mixed">Mixed</xtermref> production.
Indeed an empty <nt def="nt-mixed">mixed</nt> is the only way a schema can
allow character data content with no datatype constraint at all.</p> 
</note>
<constraintnote type="cos" id="cos-et-reuse">
<head>Element Type Unique in Mixed</head> 
<p>A given <termref def="gloss-NCName">NCName</termref> must not appear two or
more times among the <nt def="nt-elementTypeDecl">elementTypeDecl</nt>s and
<nt def="nt-elementTypeRef">elementTypeRef</nt>s with no <nt
def="nt-schemaRef">schemaRef</nt>s; a given <nt
def="nt-elementTypeName">elementTypeName</nt> must not appear two or more times
among the <nt def="nt-elementTypeRef">elementTypeRef</nt>s.</p> 
</constraintnote>
<p>See <specref ref="declare-elementType"/> for discussion and examples of the
appearance of <nt def="nt-elementTypeDecl">elementTypeDecl</nt> above.</p> 
<p><termdef id="key-satisfy-mixed" term="mixed-satisfy">An element item
<term>mixed-satisfies</term> a <nt def="nt-mixed">mixed</nt> if</termdef></p> 
<ulist> 
<item> 
<p>the <nt def="nt-mixed">mixed</nt> contains an <nt
def="nt-elementTypeRef">elementTypeRef</nt> which the element item
<termref def="key-satisfy-etr">ref-satisfies</termref></p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
<p>the <nt def="nt-mixed">mixed</nt> contains an <nt
def="nt-elementTypeDecl">elementTypeDecl</nt> whose <termref
def="gloss-NCName">NCName</termref> matches the element item&apos;s name, in
which case the element item must <termref
def="key-satisfy-ed">e-satisfy</termref> that <nt
def="nt-elementTypeDecl">elementTypeDecl</nt></p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
<p>the <nt def="nt-archetypeSpec">archetypeSpec</nt> which
<termref def="key-effective">effectively</termref> contains the
<nt def="nt-mixed">mixed</nt> is <pt>open</pt> and the element item is
<termref def="key-ind-valid">independently valid</termref>.</p> 
</item> 
</ulist> 
<issue id="mixed-change-current-schema">
<p>There&apos;s an implicit change in current schema in the definition of
satisfy-mixed above which should be made explicit.</p> 
</issue>
</div3> 
<div3 id="declare-elementOnly"> 
<head>Element-Only Content</head> 
<p>A content model for element-only content specifies only child elements (no
immediate character data content other than white space is allowed). The
content model consists of a simple grammar governing the allowed types of child
elements and the order in which they must appear. </p> 
 
<scrap lang="ebnf" id="RuleSet.XS10">

<head>Element-only content</head> 
<prod id="nt-eltOnly"> 
<lhs>eltOnly</lhs> 
<rhs><nt def="nt-modelElt">modelElt</nt></rhs> 
</prod> 
<prod id="nt-modelElt"> 
<lhs>modelElt</lhs> 
<rhs><nt def="nt-occur">occur</nt> ( <nt def="nt-modelGroup">modelGroup</nt> |
<nt def="nt-modelGroupRef">modelGroupRef</nt> | <nt
def="nt-elementTypeRef">elementTypeRef</nt> | <nt
def="nt-elementTypeDecl">elementTypeDecl</nt> )</rhs> 
</prod> 
<prod id="nt-occur"> 
<lhs>occur</lhs> 
<rhs><pt>min</pt> <pt>max</pt>?</rhs> 
</prod> 
<prod id="nt-modelGroup"> 
<lhs>modelGroup</lhs> 
<rhs><nt def="nt-compositor">compositor</nt> <nt
def="nt-modelElt">modelElt</nt> <nt def="nt-modelEltSeq">modelEltSeq</nt></rhs>

</prod> 
<prod id="nt-compositor"> 
<lhs>compositor</lhs> 
<rhs><pt>sequence</pt> | <pt>choice</pt> | <pt>all</pt> </rhs> 
</prod> 
<prod id="nt-modelEltSeq"> 
<lhs>modelEltSeq</lhs> 
<rhs><nt def="nt-modelElt">modelElt</nt> <nt
def="nt-modelEltSeq">modelEltSeq</nt>?</rhs> 
</prod> 
 
</scrap>

<p>The grammar for element-only content is built on model elements and model
groups (<nt def="nt-modelElt">modelElt</nt> and <nt
def="nt-modelGroup">modelGroup</nt> above). A model element provides for some
number of occurrences in an instance of either a single element (via
<nt def="nt-elementTypeRef">elementTypeRef</nt> or <nt
def="nt-elementTypeDecl">elementTypeDecl</nt>) or a group of elements (via
<nt def="nt-modelGroup">modelGroup</nt> or <nt
def="nt-modelGroupRef">modelGroupRef</nt>). A model group is two or more model
elements plus a <nt def="nt-compositor">compositor</nt>. </p> 
<p>A <nt def="nt-compositor">compositor</nt> for a model group specifies for a
given group whether it is a sequence of its model elements, a choice between
its model elements or a set of its model elements which must appear in
instances. These options reconstruct the XML 1.0 <code>,</code> connector, the
XML 1.0 <code>|</code> connector and the SGML <code>&amp;</code> connector
respectively. In the first case (sequence) all the model elements must appear
in the order given in the group; in the second case (choice), exactly one of
the model elements must appear in the element content; and in the third case
(all), all the model elements must appear in the element content, but may
appear in any order. </p> 
<p>The <nt def="nt-occur">occur</nt> specification governs how many times the
instance material allowed by a <nt def="nt-modelElt">modelElt</nt> may occur at
that point in the grammar. The absence of a <pt>max</pt> specification means
that no upper bound is placed on the number of occurrences. </p> 
<p>See <specref ref="declare-elementType"/> for further discussion and examples
of the appearance of <nt def="nt-elementTypeDecl">elementTypeDecl</nt> within
<nt def="nt-modelElt">modelElt</nt> above.</p> 
<note role="example">
<eg xml:space="preserve">&lt;elementTypeRef name=&apos;paragraph&apos;/&gt;

&lt;sequence&gt;
 &lt;elementTypeRef name=&apos;name1&apos;/&gt;
 &lt;elementTypeRef name=&apos;name2&apos; prefix=&apos;HTML&apos;/&gt;
&lt;/sequence&gt;

&lt;choice minOccur=&apos;3&apos; maxOccur=&apos;9&apos;&gt;
 &lt;elementTypeRef name=&apos;name1&apos;/&gt;
 &lt;elementTypeRef name=&apos;name2&apos;/&gt;
&lt;/choice&gt;    

&lt;all minOccur=&apos;3&apos;&gt;
 &lt;elementTypeRef name=&apos;name1&apos;/&gt;
 &lt;elementTypeRef name=&apos;name2&apos;/&gt;
&lt;/all&gt;

&lt;choice&gt;
 &lt;all&gt;
  &lt;elementTypeRef name=&apos;name1&apos;/&gt;
  &lt;elementTypeRef name=&apos;name2&apos;/&gt;    
 &lt;/all&gt;
 &lt;all&gt;
  &lt;elementTypeRef name=&apos;name3&apos;/&gt;
  &lt;elementTypeRef name=&apos;name4&apos;/&gt;    
 &lt;/all&gt;
&lt;/choice&gt;</eg>
<p>A minimal model which simply requires a <code>paragraph</code> (the default
is <code>minOccur=maxOccur=1</code>; a sequence of two elements (one from
another schema); between 3 and 9 elements, each a choice between two; at least
three pairs, in any order; one of two pairs, the elements <emph>in</emph> the
chosen pair in any order. </p> 
</note>
<p><termdef id="key-satisfy-eo" term="eltOnly-satisfy">A sequence of element
items <term>eltOnly-satisfies</term> an <termref
def="key-effective">effective</termref> <nt def="nt-eltOnly">eltOnly</nt>
if</termdef></p> 
<ulist> 
<item> 
<p>it is possible to trace out a path through the content model, obeying the
<nt def="nt-compositor">compositor</nt> and <nt def="nt-occur">occur</nt>
specifications and accepting each element item in the sequence with an
<nt def="nt-elementTypeRef">elementTypeRef</nt> or <nt
def="nt-elementTypeDecl">elementTypeDecl</nt> in the content model. Accepting
an element item from the sequence with an <nt
def="nt-elementTypeRef">elementTypeRef</nt> requires that it
<termref def="key-satisfy-etr">ref-satisfy</termref> that
<nt def="nt-elementTypeRef">elementTypeRef</nt>; accepting an element item with
an <nt def="nt-elementTypeDecl">elementTypeDecl</nt> requires that the
<nt def="nt-elementTypeDecl">elementTypeDecl</nt>&apos;s
<termref def="gloss-NCName">NCName</termref> matches the element item&apos;s
name, in which case the element item must <termref
def="key-satisfy-ed">e-satisfy</termref> that <nt
def="nt-elementTypeDecl">elementTypeDecl</nt>.</p> 
</item> 
</ulist> 
<note>
<p>The above definition of eltOnly-satisfy does not explicitly incorporate the
modifications required when the containing archetype is <emph>open</emph>, as
set out at the end of <specref ref="declare-refinement"/>, but it should be
understood as doing so.</p> 
</note>
<constraintnote type="cos" id="cos-elt-consist">
<head>Element Consistency</head> 
<p>A given <termref def="gloss-NCName">NCName</termref> must not appear both
among the <nt def="nt-elementTypeDecl">elementTypeDecl</nt>s and among the
<nt def="nt-elementTypeRef">elementTypeRef</nt>s with no <nt
def="nt-schemaRef">schemaRef</nt>s, or more than once among the
<nt def="nt-elementTypeDecl">elementTypeDecl</nt>s.</p> 
</constraintnote>
<note>
<p>Note that the above permits repeated use of the same
<nt def="nt-elementTypeRef">elementTypeRef</nt>, analogous to DTD usage.</p> 
</note>
<constraintnote type="cos" id="cos-nonambig">
<head>Unambiguous Content Model</head> 
<p> For compatibility, it is an error if a content model is such that there
exist element item sequences within which some item can match more than one
occurrence of an <nt def="nt-elementTypeRef">elementTypeRef</nt> or
<nt def="nt-elementTypeDecl">elementTypeDecl</nt> in the content model. </p> 
</constraintnote>
<issue id="still-unambig">
<p>Should this compatibility constraint be preserved?</p> 
</issue>
</div3> 
<div3 id="declare-namedModelGroup"> 
<head>Named Model Group</head> 
<p>This reconstructs another common use of <termref
def="gloss-parameterEntity">parameter entities</termref>.</p> 
 
<scrap lang="ebnf" id="RuleSet.XS12">

<head>Named model groups</head> 
<prod id="nt-modelGroupDefn"> 
<lhs>modelGroupDefn</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-modelGroupSpec">modelGroupSpec</nt></rhs> 
</prod> 
<prod id="nt-modelGroupSpec"> 
<lhs>modelGroupSpec</lhs> 
<rhs>( <nt def="nt-modelGroup">modelGroup</nt> | <nt
def="nt-modelGroupRef">modelGroupRef</nt> ) <nt
def="nt-exportControl">exportControl</nt></rhs> 
</prod> 
<prod id="nt-modelGroupRef"> 
<lhs>modelGroupRef</lhs> 
<rhs><nt def="nt-modelGroupName">modelGroupName</nt></rhs> 
</prod> 
<prod id="nt-modelGroupName"> 
<lhs>modelGroupName</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
</prod> 
 
</scrap>

<note role="example">
<eg xml:space="preserve">&lt;modelGroup name=&apos;myModelGroup&apos;&gt;
 &lt;elementTypeRef name=&apos;myElementType&apos;/&gt;
&lt;/modelGroup&gt;

&lt;elementType name=&apos;myElementType&apos;&gt;
 &lt;modelGroupRef name=&apos;myModelGroup&apos;/&gt;
 &lt;attrDecl ...&gt;. . .&lt;/attrDecl&gt;
&lt;/elementType&gt;

&lt;elementType name=&apos;anotherElementType&apos;&gt;
 &lt;choice&gt;
  &lt;elementTypeRef name=&apos;yetAnotherElementType&apos;/&gt;
  &lt;modelGroupRef name=&apos;myModelGroup&apos;/&gt;
 &lt;/choice&gt;
 &lt;attrDecl ...&gt;. . .&lt;/attrDecl&gt;
&lt;/elementType&gt;
</eg>
<p>A minimal model group is defined and used by reference, first as the whole
content model, then as one alternative in a choice. </p> 
</note>
</div3> 
<div3 id="declare-elementType"> 
<head>Element Type Declaration</head> 
<p>An <termdef id="key-elementType" term="element type"><term>element
type</term> declares the association of an element type name with an
archetype</termdef>, either by reference or by incorporation. </p> 
 
<scrap lang="ebnf" id="RuleSet.XS13">

<head>Element type declaration</head> 
<prod id="nt-elementTypeDecl"> 
<lhs>elementTypeDecl</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-elementTypeSpec">elementTypeSpec</nt></rhs> 
</prod> 
<prod id="nt-elementTypeSpec"> 
<lhs>elementTypeSpec</lhs> 
<rhs>( <nt def="nt-archetypeRef">archetypeRef</nt> | <nt
def="nt-archetypeSpec">archetypeSpec</nt> ) <nt
def="nt-exportControl">exportControl</nt> <pt>global</pt>?</rhs> 
</prod> 
<prod id="nt-elementTypeRef"> 
<lhs>elementTypeRef</lhs> 
<rhs><nt def="nt-elementTypeName">elementTypeName</nt> </rhs> 
</prod> 
<prod id="nt-elementTypeName"> 
<lhs>elementTypeName</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>? </rhs> 
</prod> 
 
</scrap>

<p>An element type declaration associates a name with an
<specref ref="declare-archetype"/>. This name will appear in tags in instance
documents; the archetype definition provides <termref def="SC">SC</termref>s on
the form of elements tagged with the specified name. An element type
declaration is comparable to an <code>&lt;!ELEMENT ...&gt;</code> declaration
in an XML 1.0 DTD. </p> 
<p>The last two productions above provide for element types to be referenced by
name from content models. </p> 
<p>As noted above element type names are in a separate
<termref def="key-symbolSpace">symbol space</termref> from the symbol space for
the names of <nt def="gloss-archetype">archetypes</nt>, so there can (but need
not be) an archetype with the same name as a top-level element type.</p> 
<p><termdef id="key-elt-fullname"
term="full name of an element type declaration">The <term>full name</term> of a
top-level <nt def="nt-elementTypeDecl">elementTypeDecl</nt> is its
<termref def="gloss-NCName">NCName</termref> plus its <nt
def="nt-schemaName">schemaName</nt>, i.e. if it appeared directly in the
current schema or an <nt def="nt-include">include</nt>, the empty string, if it
was <nt def="nt-import">imported</nt>, then the <nt
def="nt-schemaName">schemaName</nt> of that <nt def="nt-import">import</nt>,
which must <termref def="key-suc-res">successfully resolved</termref> to its
containing schema.</termdef></p> 
<p>An <nt def="nt-elementTypeDecl">elementTypeDecl</nt> may also appear within
a <nt def="nt-modelElt">modelElt</nt>. See above (<specref
ref="declare-elementOnly"/> and <specref ref="declare-mixedContent"/>) for
where this is allowed. This declares a locally-scoped association between an
element type name and an archetype. As with attribute names, locally-scoped
element type names reside in symbol spaces local to the archetype that defines
them. Note however that archetype names are always top-level names within a
schema, even when associated with locally-scoped element type names.</p> 
<note>
<p>It is not yet clear whether an archetype defined implicitly by the
appearance of an <nt def="nt-archetypeSpec">archetypeSpec</nt> directly within
an <nt def="nt-elementTypeSpec">elementTypeSpec</nt> will have an implicit
name, or if so what that name would be, or if not how, if at all, it might be
referred to.</p> 
</note>
<note role="example">
<eg xml:space="preserve">&lt;elementType name=&apos;myElementType&apos;&gt;
 &lt;datatypeRef name=&apos;myDatatype&apos;/&gt;
&lt;/elementType&gt;

&lt;elementType name=&apos;et0&apos;&gt;
 &lt;archetypeRef name=&apos;myArchetype&apos;/&gt;
&lt;/elementType&gt;

&lt;elementType name=&apos;et1&apos;&gt;
 &lt;all&gt;. . .&lt;/all&gt;
 &lt;attrDecl ...&gt;. . .&lt;/attrDecl&gt;
&lt;/elementType&gt;

&lt;elementType name=&apos;et2&apos;&gt;
 &lt;any/&gt;
&lt;/elementType&gt;

&lt;elementType name=&apos;et3&apos;&gt;
 &lt;empty/&gt;
 &lt;attrDecl ...&gt;. . .&lt;/attrDecl&gt;
&lt;/elementType&gt;

&lt;elementType name=&apos;et4&apos;&gt;
 &lt;choice&gt;. . .&lt;/choice&gt;
 &lt;attrDecl ...&gt;. . .&lt;/attrDecl&gt;
&lt;/elementType&gt;

&lt;elementType name=&apos;et5&apos;&gt;
 &lt;sequence&gt;. . .&lt;/sequence&gt;
 &lt;attrDecl ...&gt;. . .&lt;/attrDecl&gt;
&lt;/elementType&gt;

&lt;elementType name=&apos;et6&apos; model=&apos;open&apos;&gt;
 &lt;mixed/&gt;
&lt;/elementType&gt;

</eg>
<p>A pretty complete set of alternatives. Note the last one is intended to be
equivalent to the idea sometimes called WFXML, for Well-Formed XML: it allows
<emph>any</emph> content at all, whether defined in the current schema or not,
and <emph>any</emph> attributes.</p> 
<eg xml:space="preserve">&lt;elementType name=&apos;contextOne&apos;&gt;
 &lt;sequence&gt;
  &lt;elementType name=&apos;myLocalElementType&apos;
   &lt;archetypeRef name=&apos;myFirstArchetype&apos;/&gt;
  &lt;/elementType&gt;
  &lt;elementTypeRef name=&apos;globalElementType&apos;/&gt;
 &lt;/sequence&gt;
&lt;/elementType&gt;

&lt;elementType name=&apos;contextTwo&apos;
 &lt;sequence&gt;
  &lt;elementType name=&apos;myLocalElementType&apos;
   &lt;archetypeRef name=&apos;mySecondArchetype&apos;/&gt;
  &lt;/elementType&gt;
  &lt;elementTypeRef name=&apos;globalElementType&apos;/&gt;
 &lt;/sequence&gt;
&lt;/elementType&gt;
</eg>
<p>Instances of <code>myLocalElementType</code> within
<code>contextOne</code> will be constrained by <code>myFirstArchetype</code>,
while those within <code>contextTwo</code> will be constrained by
<code>mySecondArchetype</code>. </p> 

</note>
<note>
<p>The possibility that differing attribute definitions and/or content models
would apply to elements with the same name in different contexts is an
extension beyond the expressive power of a DTD in XML 1.0.</p> 
</note>
<constraintnote type="cos" id="cos-local-global">
<head>Nested May Not Be Global</head> 
<p>An <nt def="nt-elementTypeSpec">elementTypeSpec</nt> in a nested
<nt def="nt-elementTypeDecl">elementTypeDecl</nt> must not be <pt>global</pt>. 
</p> 
</constraintnote>
<constraintnote type="cos" id="cos-respect-global">
<head>Cannot Shadow Global</head> 
<p>If a top-level <nt def="nt-elementTypeSpec">elementTypeSpec</nt> is
<pt>global</pt>, then the <termref def="gloss-NCName">NCName</termref> of its
<nt def="nt-elementTypeDecl">elementTypeDecl</nt> must not be redeclared by any
nested <nt def="nt-elementTypeDecl">elementTypeDecl</nt> in the same schema or
any schema it <termref def="key-eventually-include">eventually
includes</termref>.</p> 
</constraintnote>
<p><termdef id="key-satisfy-ed" term="e-satisfy">An element item
<term>e-satisfies</term> an <nt def="nt-elementTypeDecl">elementTypeDecl</nt>
if the <nt def="nt-elementTypeDecl">elementTypeDecl</nt></termdef>:</p> 
<ulist> 
<item> 
<p>contains an <nt def="nt-archetypeSpec">archetypeSpec</nt> directly, and the
element item <termref def="key-satisfy-as">arch-satisfies</termref> that
<nt def="nt-archetypeSpec">archetypeSpec</nt>;</p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
<p>the <nt def="nt-archetypeRef">archetypeRef</nt> alternative is used in that
<nt def="nt-elementTypeDecl">elementTypeDecl</nt> and it
<termref def="key-identify">identifies</termref> an <nt
def="nt-archetypeSpec">archetypeSpec</nt> and the element item
<termref def="key-satisfy-as">a-satisfies</termref> that
<nt def="nt-archetypeSpec">archetypeSpec</nt>.</p> 
</item> 
</ulist> 
<p><termdef id="key-ind-valid" term="independently valid">An element item is
<term>independently valid</term> if there is a top-level
<nt def="nt-elementTypeDecl">elementTypeDecl</nt> whose
<termref def="gloss-NCName">NCName</termref> matches its name in the schema its
namespace item resolves to (or a schema that schema
<termref def="key-eventually-include">includes</termref>, in which case see the
definition of <termref def="key-identify">identify</termref> for details on
which declaration is used if there is more than one), and the element item must
<termref def="key-satisfy-ed">e-satisfy</termref> that
<nt def="nt-elementTypeDecl">elementTypeDecl</nt>.</termdef></p> 
<p><termdef id="key-satisfy-etr" term="ref-satisfies">An element item
<term>ref-satisfies</term> an <nt def="nt-elementTypeRef">elementTypeRef</nt>
if</termdef></p> 
<ulist> 
<item> 
<p> the <nt def="nt-elementTypeRef">elementTypeRef</nt>
<termref def="key-identify">identifies</termref> an
<nt def="nt-elementTypeDecl">elementTypeDecl</nt> whose
<termref def="gloss-NCName">NCName</termref> matches the element item&apos;s
name and either</p> 
<ulist> 
<item> 
<p>the <nt def="nt-elementTypeDecl">elementTypeDecl</nt>&apos;s
<termref def="key-elt-fullname">full name</termref> has no
<nt def="nt-schemaName">schemaName</nt>, in which case the element item&apos;s
namespace must be the same as its parent&apos;s namespace</p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
<p>the element item&apos;s namespace and the <nt
def="nt-elementTypeDecl">elementTypeDecl</nt>&apos;s
<termref def="key-elt-fullname">full name</termref>&apos;s
<nt def="nt-schemaName">schemaName</nt> are <termref
def="key-identical">identical</termref></p> 
</item> 
</ulist> 
<p>in which case the element item must also <termref
def="key-satisfy-ed">e-satisfy</termref> the <nt
def="nt-elementTypeDecl">elementTypeDecl</nt>.</p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
<p> the <nt def="nt-elementTypeRef">elementTypeRef</nt>
<termref def="key-identify">identifies</termref> an
<nt def="nt-elementTypeDecl">elementTypeDecl</nt> whose
<termref def="gloss-NCName">NCName</termref> matches the element item&apos;s
name (call this <pt>ETD1</pt> and there is a top-level
<nt def="nt-elementTypeDecl">elementTypeDecl</nt> (call this <pt>ETD2</pt>)
which contains or <termref def="key-identify">identifies</termref> an
<nt def="nt-archetypeSpec"> archetypeSpec</nt> which has an
<termref def="key-ancestor">ancestor</termref> which is itself
<termref def="key-identify">identified</termref> by <pt>ETD1</pt>, in which
case <pt>EDT1</pt> must be <termref def="key-satisfy-ed">e-satisfied</termref>
by the element item.</p> 
</item> 
</ulist> 
<note>
<p>The last clause above is <emph>much</emph> too complex, it needs to be split
apart and built up in stages. It is this which allows elements based on
refining archetypes to appear in place of those based on their ancestors.</p> 
</note>
</div3> 
</div2> 
<div2 id="declare-refinement"> 
<head>Archetype Refinement</head> 
<note>
<p>This section articulates what has only been hinted at above, namely a
considerable increase in the power and expressiveness of schema declarations,
by explaining what was provided for in the abstract syntax in the previous
section, but not explained much if at all at that point.</p> 
</note>
<p>We provide for the refinement of archetypes declared in a schema. An
archetype definition may identify one or more other archetypes from which it
specifies the creation of a (joint) refinement. </p> 
<p>We provide for interpreting archetypes as imposing constraints on instance
elements in either a closed, refinable or open fashion. </p> 
<ulist> 
<item> 
<p>The closed interpretation is as per XML 1.0, where content type and
attribute declarations specify all <emph>and only</emph> what must be present
in instances. </p> 
</item> 
<item> 
<p>The open interpretation removes the &apos;and only&apos;, i.e. it interprets
the content type and attribute declarations as requiring (non-optional) items
to be present, but <emph>not</emph> as excluding others. </p> 
</item> 
<item> 
<p>The refinable interpretation requires the declared (non-optional) items to
be present, and also admits such others as have been explicitly declared in
refinements. </p> 
</item> 
</ulist> 
<p>The relevant abstract syntax productions are as follows:</p> 
 
<scrap lang="ebnf" id="RuleSet.XS14">

<head>Refinement</head> 
<prod id="nt-preamble2" role="prefig"> 
<lhs>preamble</lhs> 
<rhs><nt def="nt-xmlSchemaRef">xmlSchemaRef</nt> <nt def="nt-schemaName">schemaName</nt>
<nt def="nt-schemaVersion">schemaVersion</nt> <nt def="nt-model">model</nt>
<nt def="nt-export">export</nt>? <nt def="nt-import">import</nt>?
<nt def="nt-include">include</nt>?</rhs> 
</prod> 
<prod id="nt-archetypeSpec2" role="prefig"> 
<lhs>archetypeSpec</lhs> 
<rhs><nt def="nt-refinement">refinement</nt>* <nt
def="nt-contentType">contentType</nt> ( <nt def="nt-attrDecl">attrDecl</nt> |
<nt def="nt-attrGroupRef">attrGroupRef</nt> )* <nt def="nt-model">model</nt>
<nt def="nt-exportControl">exportControl</nt></rhs> 
</prod> 
<prod id="nt-model3" role="prefig"> 
<lhs>model</lhs> 
<rhs><pt>open</pt> | <pt>refinable</pt> | <pt>closed</pt></rhs> 
</prod> 
<prod id="nt-refinement"> 
<lhs>refinement</lhs> 
<rhs><nt def="nt-archetypeRef">archetypeRef</nt></rhs> 
</prod> 
 
</scrap>

<note role="example">
<eg xml:space="preserve">&lt;archetype name=&apos;chair&apos; model=&apos;refinable&apos;&gt;
 &lt;refines&gt;
  &lt;archetypeRef name=&apos;furniture&apos;/&gt;
 &lt;/refines&gt;
 &lt;attrDecl name=&apos;noOfSeats&apos;&gt;. . .&lt;/attrDecl&gt;
&lt;/archetype&gt;
</eg>
<p>An archetype which not only refines another by adding an attribute, but also
is itself (further) refinable. The <code>furniture</code> archetype must have
been declared <pt>refinable</pt>(or <pt>open</pt>).</p> 
</note>
<p>We distinguish between explicit, acquired and effective validation
constraints for any archetype. <termdef id="key-explicit"
term="explicit"><term>Explicit</term> constraints are those explicitly present,
via <nt def="nt-attrDecl">attrDecl</nt>s or <nt
def="nt-contentType">contentType</nt>, in the definition of the
archetype</termdef>. <termdef id="key-acquired"
term="acquired"><term>Acquired</term> constraints come from the ancestors of an
archetype, if it has any <nt def="nt-refinement">refinement</nt>s</termdef>.
<termdef id="key-effective" term="effective">The <term>effective</term>
constraints are the union of the explicit and the acquired</termdef>. The
<termref def="key-effective">effective</termref> constraints are what actually
constrain any element type declared with reference to a refining archetype. 
</p> 
<constraintnote id="cos-refine-ok" type="cos">
<head>Allowed Refinements</head> 
<p>An archetype must not refine one or more other archetypes unless all of the
latter have been declared with either <pt>open</pt> or <pt>refinable</pt>
(explicitly or by default: the default for <nt def="nt-model">model</nt> on any
archetype which does not explicitly specify one is provided by the
<nt def="nt-model">model</nt> of the <nt def="nt-schema">schema</nt> itself,
which in turn defaults to <pt>closed</pt> for compatibility). The same archetype
must not be referenced more than once in the <nt
def="nt-refinement">refinement</nt>s list. </p> 
</constraintnote>
<issue id="default-model">
<p>Should the default model be <emph>open</emph>, <emph>refinable</emph> or
<emph>closed</emph>?</p> 
</issue>
<p>For the present, the permitted refinements and the resulting
<termref def="key-effective">effective</termref> constraints are as follows: 
</p> 
<ulist> 
<item> 
<p>For attribute declarations, any attribute name defined in the explicit
constraints must not also be defined in any of the acquired constraints, and
any attribute name defined in a constraint acquired from one ancestor must not
also be defined in a constraint acquired from another, unless they
<emph>both</emph> acquired it from a common ancestor.</p> 
<p>The <termref def="key-effective">effective</termref> attribute declarations
are defined by the simple set union of the explicit and the acquired attribute
definitions. </p> 
</item> 
</ulist> 
<ulist> 
<item> 
<p>For content models, either </p> 
<ulist> 
<item> 
<p>all the explicit and acquired content models are <termref
def="key-vacuous">vacuous</termref> in which case the
<termref def="key-effective">effective</termref> model is
<termref def="key-vacuous">vacuous</termref>;</p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
<p>all but one of the explicit and the acquired content models are
<termref def="key-vacuous">vacuous</termref>, in which case that one becomes
the <termref def="key-effective">effective</termref> model; </p> 
</item> 
</ulist> 
<p>or</p> 
<ulist> 
<item> 
<p>No element type is referenced by more than one of the explicit and acquired
content models (unless two or more acquired models share <nt
def="nt-modelElt">modelElt</nt>s acquired from a common ancestor, in which case
such <nt def="nt-modelElt">modelElt</nt>s shall be ignored in all but the first
for the purpose of constructing the <termref
def="key-effective">effective</termref> model), in which case if the
non-<termref def="key-vacuous">vacuous</termref> explicit and acquired models
are all <nt def="nt-eltOnly">eltOnly</nt> the <termref
def="key-effective">effective</termref> model is a <pt>sequence</pt> of all the
non-<termref def="key-vacuous">vacuous</termref> acquired models, in the order
in which they are specified in the <nt def="nt-refinement">refinement</nt>s
list, followed by the explicit model (if it is non-<termref
def="key-vacuous">vacuous</termref>), or else if the non-<termref
def="key-vacuous">vacuous</termref> explicit and acquired models are all
<nt def="nt-mixed">mixed</nt>, the <termref
def="key-effective">effective</termref> model is a <nt
def="nt-mixed">mixed</nt> whose <nt
def="nt-elementTypeRef">elementTypeRef</nt>s and <nt
def="nt-elementTypeDecl">elementTypeDecl</nt>s are the union of the
<nt def="nt-elementTypeRef">elementTypeRef</nt>s and
<nt def="nt-elementTypeDecl">elementTypeDecl</nt>s of all the non-<termref
def="key-vacuous">vacuous</termref> explicit and acquired models.</p> 
</item> 
</ulist> 
</item> 
</ulist> 
<p><termdef id="key-vacuous" term="vacuous">A <pt>refinable</pt> or
<pt>open</pt> <nt def="nt-mixed">mixed</nt> content model is called
<term>vacuous</term> if it has no declared <nt
def="nt-elementTypeRef">elementTypeRef</nt>s or <nt
def="nt-elementTypeDecl">elementTypeDecl</nt>s within it</termdef>. This is
because <emph>any</emph> archetype is substitutable for an archetype with a
vacuous content model and no declared attributes.</p> 
<p><termdef id="key-refine" term="refine">An archetype AT1 is said to
<term>refine</term> an archetype AT2 if and only if AT1 is declared to refine
either AT2 or (recursively) some archetype that refines AT2</termdef>.
<termdef id="key-ancestor" term="ancestor">AT2 is then said to be an
<term>ancestor</term> of AT1. </termdef></p> 
<note>
<p>Refinements are by definition substitutable for any of their ancestors.</p> 
</note>
<p><termdef id="key-substitutablity" term="substitutability">We define a
<term>substitutability</term> relation between two archetypes as follows:
</termdef></p> 
<p>One archetype is substitutable for another if any schema-valid instance of
the former is necessarily a schema-valid instance of the latter. </p> 
<p>Some simple cases: </p> 
<ulist> 
<item> 
<p>Any archetype with no attributes is substitutable for an archetype with no
attributes and a <nt def="nt-contentModel">contentModel</nt> of <pt>any</pt>; 
</p> 
</item> 
<item> 
<p>Any archetype which differs from another only by the specialization of one
or more of its attributes (and/or of its datatype if its content is character
data) is substitutable for that archetype; </p> 
</item> 
<item> 
<p>Any archetype which differs from another only by allowing only character
data content (i.e. whose <nt def="nt-contentType">contentType</nt> is
<nt def="nt-datatypeRef">datatypeRef</nt>) where the other has mixed content is
substitutable for that archetype. </p> 
</item> 
</ulist> 
<note>
<p>Refinement by definition creates substitutable archetypes:</p> 
<eg xml:space="preserve">&lt;archetype name=&apos;Address&apos; model=&apos;refinable&apos;&gt;
 &lt;sequence&gt;
  &lt;elementTypeRef name=&apos;street&apos;/&gt;
  &lt;elementTypeRef name=&apos;city&apos;/&gt;
 &lt;/sequence&gt;
&lt;/archetype&gt;

&lt;archetype name=&apos;USAddress&apos;&gt;
 &lt;refines&gt;
  &lt;archetypeRef name=&apos;Address&apos;/&gt;
 &lt;/refines&gt;
 &lt;sequence&gt;
  &lt;elementTypeRef name=&apos;state&apos;/&gt;
  &lt;elementTypeRef name=&apos;zip&apos;/&gt;
 &lt;/sequence&gt;
&lt;/archetype&gt;
</eg>
<p><code>USAddress</code> is substitutable for <code>Address</code>: the
<termref def="key-effective">effective</termref> content model (simplifying in
the obviously legitmate way) is</p> 
<eg xml:space="preserve">
&lt;sequence&gt;
  &lt;elementTypeRef name=&apos;street&apos;/&gt;
  &lt;elementTypeRef name=&apos;city&apos;/&gt;
  &lt;elementTypeRef name=&apos;state&apos;/&gt;
  &lt;elementTypeRef name=&apos;zip&apos;/&gt;
 &lt;/sequence&gt;
</eg>
<p>Here is a richer example: </p> 
<eg xml:space="preserve">&lt;archetype name=&apos;transclude&apos; model=&apos;refinable&apos;&gt;
 &lt;mixed/&gt;
 &lt;attrDecl name=&apos;xml:link&apos;&gt;
  &lt;fixed&gt;simple&lt;/fixed&gt;
 &lt;/attrDecl&gt;
 &lt;attrDecl name=&apos;actuate&apos;&gt;
  &lt;fixed&gt;auto&lt;/fixed&gt;
 &lt;/attrDecl&gt;
 &lt;attrDecl name=&apos;href&apos; required=&apos;true&apos;&gt;
  &lt;datatypeRef name=&apos;uri&apos;/&gt;
 &lt;/attrDecl&gt;
&lt;/archetype&gt;

&lt;archetype name=&apos;anchor&apos; interp=&apos;open&apos;&gt;
 &lt;mixed/&gt;
 &lt;attrDecl name=&apos;id&apos;&gt;
  &lt;datatypeRef name=&apos;ID&apos;/&gt;
 &lt;/attrDecl&gt;
&lt;/archetype&gt;

&lt;archetype name=&apos;nestHere&apos;&gt;
 &lt;refines&gt;
  &lt;archetypeRef name=&apos;transclude&apos;/&gt;
  &lt;archetypeRef name=&apos;anchor&apos;/&gt;
 &lt;/refines&gt;
 &lt;empty/&gt;
 &lt;attrDecl name=&apos;show&apos;&gt;
  &lt;fixed&gt;embed&lt;/fixed&gt;
 &lt;/attrDecl&gt;
&lt;/archetype&gt;

&lt;elementType name=&apos;nestHere&apos; archetype=&apos;nestHere&apos;/&gt;

&lt;nestHere href=&apos;http://www.ltg.ed.ac.uk/~ht/password.xml&apos; id=&apos;mpw&apos;/&gt;
</eg>
<p>The final instance element satisfies all the <termref
def="key-effective">effective</termref> constraints associated with the
<code>nestHere</code> archetype: its <code>xml:link</code>,
<code>actuate</code> and <code>href</code> attributes are constrained by
constraints acquired from <code>transclude</code>, its <code>id</code>
attribute is constrained by a constraint acquired from <code>anchor</code> and
its <code>show</code> attribute is constrained by its own explicit constraint. 
</p> 
<p>The <termref def="key-effective">effective</termref> content model for
<code>nestHere</code> is <pt>empty</pt>, under the second clause of the
discussion above: only the explicit content model is there at all, so it gets
to be the <termref def="key-effective">effective</termref> one. </p> 
<p>Note that because they are <pt>refinable</pt> and <pt>open</pt>
respectively, both <code>transclude</code> and <code>anchor</code> are
satisfied by the <code>nestHere</code> instance, i.e. the substitutability
requirement on refining archetypes is satisfied. </p> 


</note>
<note>
<p>Here&apos;s a case which merges content models and specializes an attribute
definition:</p> 
<eg xml:space="preserve">&lt;archetype name=&apos;polygon&apos; model=&apos;refinable&apos;&gt;
 &lt;elementTypeRef name=&apos;bbox&apos;/&gt;
 &lt;attrDecl name=&apos;n&apos; required=&apos;yes&apos;/&gt;
 &lt;attrDecl name=&apos;regular&apos;&gt;
  &lt;datatypeRef name=&apos;enumeratedSymbol&apos;&gt;
    &lt;enumeration&gt;
     &lt;literal&gt;yes&lt;/literal&gt;
     &lt;literal&gt;no&lt;/literal&gt;
    &lt;/enumeration&gt;
  &lt;/datatypeRef&gt;
 &lt;/attrDecl&gt;
&lt;/archetype&gt;

&lt;elementType name=&apos;regularPolygon&apos;&gt;
 &lt;refines&gt;
  &lt;archetypeRef name=&apos;polygon&apos;/&gt;
 &lt;/refines&gt;
 &lt;elementTypeRef name=&apos;side&apos;/&gt;
 &lt;attrDecl name=&apos;regular&apos;&gt;
  &lt;fixed&gt;yes&lt;/fixed&gt;
 &lt;/attrDecl&gt;
&lt;/elementType&gt;
</eg>
<p>Here we see not only the merging of two content models, with the two
<nt def="nt-elementTypeRef">elementTypeRefs</nt> being concatenated to produce
the <termref def="key-effective">effective</termref> sequence model for the
refined archetype, but also the provision in an explicit constraint of a fixed
value for an attribute consistent with its acquired constraint. (Strictly
speaking, this goes beyond the constraints on refinement set out above, but it
obviously preserves substitutability, and will be allowed as soon as more
detailed constraints are drafted.)</p> 
<eg xml:space="preserve">
&lt;regularPolygon n=&apos;3&apos;&gt;
   &lt;bbox&gt;...&lt;/bbox&gt;
   &lt;side length=&apos;3cm&apos;/&gt;
&lt;/regularPolygon&gt;</eg>


</note>
<note>
<p>The intention of the formal validity definition
<termref def="key-satisfy-etr">ref-satisfies</termref> is that element item
should be valid with respect to an <nt
def="nt-archetypeSpec">archetypeSpec</nt> that is <pt>refinable</pt> if it is
valid with respect to that <nt def="nt-archetypeSpec">archetypeSpec</nt> itself
or any <nt def="nt-archetypeSpec">archetypeSpec</nt> that refines it. It might
them be possible for validating parser to begin by checking daughters with
respect to the declared archetypeSpec if it is element only, since any
refinement can only add to the end of a sequence of daughters.</p> 
</note>
<p>There follows a semi-formal definition of validity with respect to an
<pt>open</pt> content model.</p> 
<p>To parse against an open content model:</p> 
<glist> 
<gitem> 
<label>informal statement</label>
<def> 
<p>ignore all daughters which are NOT mentioned explicitly anywhere in the
content model: what&apos;s left must match the model in the old, deterministic,
XML 1.0 way.</p> 
</def> 
</gitem> 
<gitem> 
<label>formal statement</label>
<def> 
<p>Consider the edge-labelled FSM for recognizing the declared content model
under a &apos;closed&apos; (i.e. deterministic, XML 1.0) interpretation.</p> 
<p>Call the set of all transition labels anywhere in the FSM (i.e. the tags
mentioned anywhere anywhere in the model) <emph>T</emph>.</p> 
<p>For each state <emph>s</emph> in the FSM, call the set of tags which label
transitions from that state <emph>T[s]</emph>.</p> 
<p>Then to turn the FSM into one which interprets the content model as open,
for each state s </p> 
<olist> 
<item> 
<p>add a transition to failure for every label in <emph>T-T[s]</emph>;</p> 
</item> 
<item> 
<p>add a transition to <emph>s</emph> for the complement of <emph>T</emph>,
i.e. a default loopback.</p> 
</item> 
</olist> 
</def> 
</gitem> 
</glist> 
<issue id="formal-refinement-FSM">
<p>Does refinement need this, or is it covered already?</p> 
</issue>
</div2> 
<div2 id="declare-entity"> 
<head>Entities and Notations</head> 
 
<scrap lang="ebnf" id="RuleSet.XS15">

<head>Entities and notations</head> 
<prod id="nt-entityDecl"> 
<lhs>entityDecl</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-entitySpec">entitySpec</nt></rhs> 
</prod> 
<prod id="nt-entitySpec"> 
<lhs>entitySpec</lhs> 
<rhs>( <nt def="nt-textEntitySpec">textEntitySpec</nt> |
<nt def="nt-externalEntitySpec">externalEntitySpec</nt> |
<nt def="nt-unparsedEntitySpec">unparsedEntitySpec</nt> )
<nt def="nt-exportControl">exportControl</nt>?</rhs> 
</prod> 
<prod id="nt-textEntitySpec"> 
<lhs>textEntitySpec</lhs> 
<rhs><pt>string-value</pt></rhs> 
</prod> 
<prod id="nt-externalEntitySpec"> 
<lhs>externalEntitySpec</lhs> 
<rhs><nt def="nt-systemID">systemID</nt> <nt def="nt-publicID">publicID</nt>?
exportControl?</rhs> 
</prod> 
<prod id="nt-unparsedEntitySpec"> 
<lhs>unparsedEntitySpec</lhs> 
<rhs><nt def="nt-systemID">systemID</nt> <nt
def="nt-notationRef">notationRef</nt> <nt def="nt-publicID">publicID</nt>?
<nt def="nt-exportControl">exportControl</nt>?</rhs> 
</prod> 
<prod id="nt-entityRef"> 
<lhs>entityRef</lhs> 
<rhs><nt def="nt-entityName">entityName</nt></rhs> 
</prod> 
<prod id="nt-entityName"> 
<lhs>entityName</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
</prod> 
<prod id="nt-notationDecl"> 
<lhs>notationDecl</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-notationSpec">notationSpec</nt></rhs> 
</prod> 
<prod id="nt-notationSpec"> 
<lhs>notationSpec</lhs> 
<rhs><nt def="nt-systemID">systemID</nt> <nt
def="nt-notationRef">notationRef</nt> <nt def="nt-publicID">publicID</nt>?
<nt def="nt-exportControl">exportControl</nt>?</rhs> 
</prod> 
<prod id="nt-systemID"> 
<lhs>systemID</lhs> 
<rhs><pt>URI</pt></rhs> 
</prod> 
<prod id="nt-publicID"> 
<lhs>publicID</lhs> 
<rhs> 
<com>see <bibref ref="ref-xml"/></com></rhs> 
</prod> 
<prod id="nt-notationRef"> 
<lhs>notationRef</lhs> 
<rhs><nt def="nt-notationName">notationName</nt></rhs> 
</prod> 
<prod id="nt-notationName"> 
<lhs>notationName</lhs> 
<rhs><pt>NCName</pt> <nt def="nt-schemaRef">schemaRef</nt>?</rhs> 
</prod> 
 
</scrap>

<div3 id="declare-internalParsedEntity"> 
<head>Internal Parsed Entity Declaration</head> 
<p>Internal parsed entities are a feature of XML that enables reuse of text
fragments by direct reference in an instance document. </p> 
<p>In &XSP1; documents, internal parsed entities are declared by using the
<nt def="nt-textEntitySpec">textEntitySpec</nt> production. </p> 
<note>
<eg xml:space="preserve">
&lt;textEntity name=&apos;flavor&apos;&gt;Fresh mint&lt;/textEntity&apos;&gt;
</eg>
<p><code>flavor</code> can now be used in an entity reference in instances of
the containing schema.</p> 
</note>
<p>See <specref ref="conformance-schemaValidity"/> for <termref
def="SC">SC</termref>s covering entities and entity references. </p> 
</div3> 
<div3 id="declare-externalParsedEntity"> 
<head>External Parsed Entity Declaration</head> 
<p>External parsed entities are a feature of XML that offers a method for
including well-formed XML document fragments, including text and markup, by
direct reference to the storage object of the parsed entity. </p> 
<p>In schemas, external parsed entities are declared by using the
<nt def="nt-externalEntitySpec">externalEntitySpec</nt> production. </p> 
<note>
<eg xml:space="preserve">
&lt;externalEntity name=&apos;FrontMatter&apos; 
                system=&apos;FrontMatter.xml&apos; /&gt;
&lt;externalEntity name=&apos;Chapter1&apos; 
                system=&apos;chapter1.xml&apos; /&gt;
&lt;externalEntity name=&apos;Chapter2&apos; 
                system=&apos;Chapter2.xml&apos; /&gt;
&lt;externalEntity name=&apos;BackMatter&apos; 
                system=&apos;BackMatter.xml&apos; /&gt;
</eg>
<p>These four external entities represent the supposed contents of a book:</p> 
<eg xml:space="preserve">
&lt;book&gt;
  &amp;FrontMatter;
  &amp;Chapter1;
  &amp;Chapter2;
  &amp;BackMatter;
&lt;/book&gt;
</eg>
<p>In an instance, the external entities take their familiar XML form. The
processor expands the entities for their content.</p> 

</note>
<p>Again, See <specref ref="conformance-schemaValidity"/> for <termref
def="SC">SC</termref>s covering entities and entity references.</p> 
</div3> 
<div3 id="declare-unparsedEntity"> 
<head>Unparsed Entity Declaration</head> 
<p>External unparsed entities are a feature of XML that offers a baroque method
for including binary data by indirect reference to both the storage object and
the the notation type of the unparsed entity. In schemas, external parsed
entities may be declared by using the <nt
def="nt-unparsedEntitySpec">unparsedEntitySpec</nt> production. </p> 
<note>
<eg xml:space="preserve">
&lt;unparsedEntity name=&apos;SKU-5782-pic&apos; 
                system=&apos;http://www.vendor.com/SKU-5782.jpg&apos; 
                notation=&apos;JPEG&apos; /&gt;</eg>
<eg xml:space="preserve">
&lt;picture location=&apos;SKU-5782-pic&apos;/&gt;
</eg>
<p>The picture element carries an attribute which is (presumably) governed by
the unparsed entity declaration.</p> 

</note>
<constraintnote type="svc" id="svc-attr-entity">
<head>Attribute is Entity</head> 
<p>When an attribute value is interpreted as a reference to an unparsed entity
[How?!], the attribute value must <termref
def="key-identify">identifies</termref> an <nt
def="nt-unparsedEntitySpec">unparsedEntitySpec</nt> (note that no
<nt def="nt-schemaRef">schemaRef</nt> can be specified in this case); the
<termref def="gloss-NCName">NCName</termref> of the <nt
def="nt-notationRef">notationRef</nt> of that <nt
def="nt-unparsedEntitySpec">unparsedEntitySpec</nt> must
<termref def="key-identify">identify</termref> a <nt
def="nt-notationSpec">notationSpec</nt>; the resource specified by the
<nt def="nt-systemID">systemID</nt> and <nt def="nt-publicID">publicID</nt>
attribute must be available. </p> 
</constraintnote>
<issue id="unparsed-entity-gaps">
<p> There are lots of gaps and little problems in this design for unparsed
entities.</p> 
</issue>
</div3> 
<div3 id="declare-notation"> 
<head>Notation Declaration</head> 
<p>A notation may be declared by specifying a name and an identifier for the
notation. A notation may be referenced by name in a schema as part of an
external entity declaration.</p> 
<note>
<eg xml:space="preserve">
&lt;notation name=&apos;jpeg&apos; 
          public=&apos;image/jpeg&apos; system=&apos;viewer.exe&apos; /&gt;

&lt;elementType name=&apos;picture&gt;
 &lt;attrDecl name=&apos;entity&apos;&gt;
   &lt;datatypeRef name=&apos;NOTATION&apos;/&gt;
 &lt;/attrDecl&gt;
&lt;/elementtype&gt; 
</eg>
<eg xml:space="preserve">
&lt;picture entity=&apos;SKU-5782-pic&apos;/&gt;
</eg>
<p>The notation need not ever be mentioned in the instance document.</p> 

</note>
<issue id="unparsed-entity-attributes">
<p>We need to synchronise with XML Schemas: Datatypes regarding how we declare
attributes as unparsed entities!</p> 
</issue>
</div3> 
</div2> 
</div1> 
<div1 id="composition"> 
<head>Schema Composition and Namespaces</head> 
<p>This chapter describes facilities to provide for validation of
namespace-qualified instance document elements and attributes, and potentially
(subject to enhancements to the Namespaces recommendation), entities and
notations. </p> 
<note>
<p>&apos;Namespaces in XML&apos; <bibref ref="ref-xml-namespaces"/> provides an
enabling framework for modular composition of schemas. From that document: </p>

</note>
<p> <quote><emph>We envision applications of Extensible Markup Language (XML)
where a single XML document may contain elements and attributes (here referred
to as a &apos;markup vocabulary&apos;) that are defined for and used by
multiple software modules. One motivation for this is modularity; if such a
markup vocabulary exists which is well-understood and for which there is useful
software available, it is better to re-use this markup rather than re-invent
it. </emph></quote> <quote><emph>Such documents, containing multiple markup
vocabularies, pose problems of recognition and collision. Software modules need
to be able to recognize the tags and attributes which they are designed to
process, even in the face of &apos;collisions&apos; occurring when markup
intended for some other software package uses the same element type or
attribute name. </emph></quote> <quote><emph>These considerations require that
document constructs should have universal names, whose scope extends beyond
their containing document. This specification describes a mechanism, XML Schema
namespaces, which accomplishes this. </emph> </quote></p> 
<p>&XSP1; provides facilities to enable declaration and modular composition of
schemas.</p> 
<ulist> 
<item> 
<p>Each schema is identified by a schema name, which is a namespace-compatible
<bibref ref="ref-uri"/>. </p> 
</item> 
<item> 
<p>A schema can identify archetypes, datatypes, element types, attribute
definitions, attribute groups, named model groups, entities, and notations to
be <emph>exported</emph> for use in other schemas. </p> 
</item> 
<item> 
<p>A schema can <emph>import</emph> declarations and definitions exported from
other schemas. Means are provided for using the imported features in the
importing schema. </p> 
</item> 
<item> 
<p>Namespace-compatible validation rules are defined for instance documents
using imported elements and attributes. </p> 
</item> 
<item> 
<p>Conventions are proposed for use of namespace-qualified entities and
notations in instance documents. Standardized implementation of these features
will depend on corresponding enhancements to the
<bibref ref="ref-xml-namespaces"/> recommendation. (To be supplied in a future
draft of this specification.) </p> 
</item> 
<item> 
<p>As specified herein, namespace-qualified attribute definitions are validated
only in the context of a corresponding validated elementType. A non-normative
appendix proposes changes to the <bibref ref="ref-xml-namespaces"/>
recommendation that would support more generalized export of attributes. (To be
supplied in a future draft of this specification.) </p> 
</item> 
</ulist> 
<p>As described in <specref ref="conformance"/>, full validation is supported
in the case where the transitive closure of all schemas referenced by an
instance document is available to the validating processor. Furthermore, the
schema language is compatible with partial validation, in which validation is
done only with respect to a subset of the schemas applicable to a document, or
in which a well formed document (I.e. one for which no overall schema is
provided) makes selective use of features imported from schemas which are
available. </p> 
<div2 id="composition-instances"> 
<head>Associating Instance Document Constructs with Corresponding Schemata 
</head> 
<p>During validation, the standard mechanisms of
<bibref ref="ref-xml-namespaces"/> are interpreted to create associations
between instance document prefixes and schema definitions. Thus, there is in
each valid instance document a namespace associated with each schema to which
the instance conforms. Each namespace qualified element (or eventually entity
or notation), its attributes and its content, is validated against its
declaration in the corresponding URI-named schema. In that sense, each schema
defines and is coextensive with a namespace. The means by which schemas are
located during processing is discussed below in
<specref ref="composition-schemaAccess"/>. Comprehensive rules for v