<?xml version='1.0'?>
<?xml:stylesheet type='text/xsl' href='../xmlschema.msxsl'?>
<!-- $Id: structures.xml,v 1.1 1999/09/24 18:18:56 hugo Exp $ -->
<!DOCTYPE spec PUBLIC "-//HST//DTD Specification::19990423//EN" "../xmlspec-19990429.dtd" [
   <!ENTITY SchemaWG "<loc
href='http://www.w3.org/XML/Activity#schema-wg'>W3C XML Schema Working
Group</loc>">
   <!ENTITY XSP1 "<emph>XML Schema: Structures</emph>">
   <!ENTITY XSP2 "<emph>XML Schemas: Datatypes</emph>">
   <!ENTITY draft.year "1999">
   <!ENTITY draft.month "September">
   <!ENTITY draft.day "24">
   <!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 "09">
   <!ENTITY draft.DD "24">
   <!ENTITY iso.doc.date "&draft.YY;&draft.MM;&draft.DD;">
   <!ENTITY draft.base "http://www.w3.org/&draft.year;/&draft.MM;/&draft.DD;-xmlschema">
   <!ENTITY WD-XSP1 "structures">
   <!ENTITY XSP1.base "&draft.base;">
   <!ENTITY XSP1.URI "&XSP1.base;/&WD-XSP1;/structures">
   <!ENTITY XSP1.version "0.7">
   <!ENTITY WD-XSP2 "datatypes">
   <!ENTITY XSP2.base "&draft.base;">
   <!ENTITY XSP2.URI "&XSP2.base;/&WD-XSP2;/datatypes">
   <!ENTITY doc.audience "and external review.">
   <!ENTITY doc.distribution "For distribution">
 ]>
<spec xmlns:e='http://www.jclark.com/XSLT/ElementSyntax'>
  <header>
    <title>XML Schema Part 1: Structures</title>
    <version>&XSP1.version;</version>
    <w3c-designation>&WD-XSP1;-&iso.doc.date;</w3c-designation>
    <w3c-doctype>W3C Working Draft</w3c-doctype>
    <pubdate>
      <day>&draft.day;</day>
      <month>&draft.month;</month>
      <year>&draft.year;</year>
    </pubdate>
    <notice role='publoc'><ednote><edtext>The following SHOULD be in the publoc, but
the DTD doesn't currently allow it: the stylesheet fakes it.</edtext></ednote>
     <p>(in <loc href='&XSP1.URI;.xml'>XML</loc> (with its own <loc href='&draft.base;/xmlspec-19990429.dtd'>DTD</loc>, <loc href='&draft.base;/xmlschema.xsl'>XSL stylesheet</loc> (July
XSL WD version)
and <loc href='&draft.base;/xmlschema.msxsl'>IE5 stylesheet</loc> (XSL as supported by version 5 of
Microsoft's Internet Explorer)) and <loc href='&XSP1.URI;.html'>HTML</loc>, with separate provision of the <loc href='&XSP1.URI;.xsd'>schema</loc> and <loc href='&XSP1.URI;.dtd'>DTD</loc> for schemas described herein.</p>
</notice>
    <publoc> <loc href='&XSP1.base;/&WD-XSP1;/'>&XSP1.base;/&WD-XSP1;/</loc> </publoc>
   <latestloc>   
    <loc href='http://www.w3.org/TR/xmlschema-1/'>http://www.w3.org/TR/xmlschema-1/</loc>   
 </latestloc>   
   <prevlocs>
     <loc href='http://www.w3.org/1999/05/06-xmlschema-1/'>http://www.w3.org/1999/05/06-xmlschema-1/</loc>
    </prevlocs>
    <authlist>
      <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>
      <author>
        <name>David Beech</name>
        <affiliation>Oracle</affiliation>
        <email href='dbeech@us.oracle.com'>dbeech@us.oracle.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>
    </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>
(<loc href='http://lists.w3.org/Archives/Public/www-xml-schema-comments/'>archive</loc>).   
        </p> 
      <p>This draft incorporates a substantial change to the concrete
syntax from the previous <loc href="http://www.w3.org/1999/05/06-xmlschema-1/">public working draft</loc>,
intended to simplify it and make it easier to use (the full text of
the proposal
from the
working group's task force <bibref ref='ref-simple-prop'/>, along with a cover note
containing a discussion of alternatives considered and outstanding
issues <bibref ref='ref-simple-back'/>, are available as background).</p>
      <p>Three major components of this document are marked below as
out-of-date and/or under construction:  major efforts by task forces
from within the WG are underway with respect to these, and their
reports are linked from this draft.  We felt it was important to
present this work to the public, in keeping with our obligation to
produce drafts for public inspection and comment on a regular basis,
despite the "Under Construction" signs posted below.  It is our
intention henceforth to publish interim working drafts with greater
frequency, both to keep interested parties informed of our progress,
and to emphasize the "work in progress" nature of these drafts.</p>
     <p>Sections which are <emph>not</emph> the status quo, that is on 
which the working group has not yet reached consensus, are marked with an
asterisk (<B>*</B>) at the end of the section title.
But <emph>please note</emph> that <emph>all</emph> 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 "work in progress". </p>
    </status>
    <abstract>
      <p><emph> XML Schema: Structures</emph> is part 1 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-09-02: HST: Marked non-status-quo sections as such.</sitem>
       <sitem>1999-09-01: HST: incorporated Section 2 examples from 'Simple',
modified to include some attributes.  Massaged explanatory text.</sitem>
       <sitem>1999-08-22: HST: incorporated 'Simple' section 3 changes and started to smooth over
the joints.</sitem>
       <sitem>1999-07-18: DB: updated definition of "Schema" following WG and IG email discussion.
         Changed "Schemata" to "Schemas" except where directly quoted from Requirements doc.
         Clarified in 2.5 that elements and attributes have separate symbol spaces (public comment).
         Fixed assorted typos.
       </sitem>
       <sitem>1999-06-23: HST: pushed &amp; down to lowest level, fixed incoherent
validity definition in 6.2.3.7 to agree with the note which follows.  Wrapped validation
text from 3.4 in appropriately named div4's.</sitem>
       <sitem>1999-06-20: HST: stripped out validation</sitem>
        <sitem>1999-05-03: MCM: Updated schema and DTD. Package and test.
        </sitem>
        <sitem>1999-05-03 Integration of final editors' 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 'schema'; suggested modifications to
          3.4.9/10 and 3.5 </sitem>
        <sitem>1999-04-39: HST : integrated DB'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 'schema'; suggested modifications to
          3.4.9/10 and 3.5 </sitem>
        <sitem>1999-04-23: HST : Got all productions sorted using
          'nt' 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 document sets out the structural part (&XSP1;) of the XML Schema definition language.</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, 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'/> [not yet written] and
        <specref ref='normative-references'/>. Non-normative appendixes include a
        <specref ref='sampleSchema'/> and <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>

       <e:element-syntax name='example'>
        <e:in-category name='sample-concrete-syntax-paradigm'/>
        <e:attribute name='attribute'>
         <e:data-type name='NMTOKEN'/>
        </e:attribute>
        <e:attribute name='required-attribute' required='yes'>
         <e:data-type name='ID'/>
        </e:attribute>
        <e:sequence>
         <e:element name='daughter1'/>
         <e:element name='daughter2' repeat='zero-or-more'/>
        </e:sequence>
       </e:element-syntax>
        <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='http://www.muzmo.com/XMLSchema/1.0/mySchema' &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 additional
        information such as default values. Schemas are intended to document their own
        meaning, usage, and function through a common documentation vocabulary. 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.  However, 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>
<ednote>
<edtext>Need to reference Cambridge Communique as soon as it's published.</edtext>
</ednote>
          </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 or elements within documents, it is
        useful to clarify the relationships between certain kinds of XML documents and elements:
      </p>
      <glist>
        <gitem>
          <label><termdef id='key-instance' term='Instance'><term>Instance</term></termdef> </label>
          <def>
            <p>An XML element information item which conforms to some schema.
See <bibref ref='ref-xmlinfo'/> for a discussion of information items:  in
brief, <termdef term='element information item' id='eltInfoItem'>an
<term>element information item</term> is the component of an infoset which
corresponds to an element.  From it other information items are accessible,
including attributes, namespace declaration and content.</termdef>
See <specref ref='composition-instances'/> and
<specref ref='conformance-schemaValidity'/> for the means by which an instance
identifies the schema(s) to which it conforms. Note we will often speak loosely
about an (XML) instance document, but this is just shorthand for <emph>element
information item associated with the document element of an XML
document</emph>.  Similarly, we will often speak of elements when we mean
<emph>element information item</emph>.</p>
          </def>
        </gitem>
        <gitem>
          <label><termdef id='key-schema' term='Schema'><term>XML Schema</term></termdef> </label>
          <def>
            <p>An XML element information item which, along with its descendants, satisfies all the 
              Constraints on Schemas in this specification.  An XML Schema establishes a set of rules
              for constraining the structure and articulating the information
set of XML document instances.</p>
          </def>
        </gitem>
      </glist>
      <p>Note that it is possible to specify a schema to which
        schemas themselves must conform, and this is given in
        <specref ref='normative-schemaSchema'/>. An XML 1.0 DTD to which schemas
        must conform is also provided in
        <specref ref='normative-schemaDTD'/>. </p>
      <p>Any schema is <emph>ipso facto</emph> an element information item. It
follows that the rules specified herein for
        validity apply to all of the following kinds of XML element information items:
        <ulist>
          <item>
            <p>Elements that are not schemas;</p>
          </item>
          <item>
            <p>Schemas applicable to documents that are not schemas;</p>
          </item>
          <item>
            <p>The schema applicable to schemas. </p>
          </item>
        </ulist> Likewise, rules for schemas in general apply to the particular schema 
        for schemas, which is an instance conforming to 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 and content of instances, which the instances 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 instance information sets 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 elements 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>Schemas, Types and Elements</head>
 <p>The purpose of a schema is to identify a set of components for use in XML documents
and to provide the rules for their correct combination.
 </p>
 <p>
The schema language is itself a set of elements and attributes. We will describe these, and show how they are used. But first, a quick example of an XML document.
</p>
<note role='example'><eg xml:space='preserve'><![CDATA[<?xml version='1.0'?>
<PurchaseOrder orderDate="1999-05-20">
    <shipTo type="US">
        <name>Alice Smith</name>
        <street>123 Maple Street</street>
        <city>Mill Valley</city>
        <state>CA</state>
        <zip>90952</zip>
    </shipTo>
    <shipDate>1999-05-25</shipDate>
    <comment>Get these things to me in a hurry, my lawn is going wild!</comment>
    <Items>
        <Item pno="333-333">
            <productName>Lawnmower, model BUZZ-1</productName>
            <quantity>1</quantity>
            <price>148.95</price>
            <comment>Please confirm this is the electric model</comment>
        </Item>
        <Item pno="444-444">
            <productName>Baby Monitor, model SNOOZE-2</productName>
            <quantity>1</quantity>
            <price>39.98</price>
        </Item>
    </Items>
</PurchaseOrder>]]></eg></note>
 <p>The purchase order consists of a main element with several subordinate
elements. Most of the subelements have simple atomic types such as <code>string</code> or
<code>date</code>, drawn from the repertoire of built-in datatypes defined in <bibref ref='ref-xsp2'/>, but some are complex. We use the <code>archetype</code> element
when declaring elements which allow elements in their content and/or may carry attributes. For example, we can define an archetype called <code>Address</code> as follows:
</p>
 <note role='example'><eg xml:space='preserve'><![CDATA[<archetype name="Address" >
    <element name="name"   type="string" />
    <element name="street" type="string" />
    <element name="city"   type="string" />
    <element name="state"  type="string" />
    <element name="zip"    type="number" />
    <attribute name="type" type="string" />
</archetype>]]></eg><p>The consequence of this definition is that an element whose 
type is declared to be <code>Address</code>
must consist of five elements and may have one attribute. Though
each has a distinct name, four of the elements and the attribute will simply contain a string in
a document instance while one will contain a number.
</p></note>
     <p>If we're going to use the same element in a number of places, we can
declare it once and refer to it by name elsewhere:</p>
     <note role='example'>
      <eg xml:space='preserve'><![CDATA[<element name="comment" type="string" />]]></eg>
      <p>This declaration restricts the <code>comment</code> element to text
content and no attributes.</p>
     </note>
  <p>
We can define a <code>PurchaseOrderType</code> for our
<code>PurchaseOrder</code> element, referring to the definitions of <code>Address</code> and <code>comment</code> as above, as:
</p>
 <note role='example'><eg xml:space='preserve'><![CDATA[<archetype name="PurchaseOrderType">
    <element name="shipTo"    type="Address" />
    <element name="shipDate"  type="date" />
    <element ref="comment" minOccurs='0' />
    <element name="Items"     type="Items" />
    <attribute name="orderDate" type="date" />
</archetype>]]></eg><p>The <code>shipDate</code> element daughter of
<code>PurchaseOrderType</code> is declared
above as having an atomic type, as in the
<code>Address</code> example above.  The <code>comment</code> daughter is
declared by reference to a global element declaration.  Similarly, the <code>shipTo</code>
and <code>Items</code> daughters are declared as having complex types which must be
defined elsewhere in the current schema.   The <code>comment</code> daughter and the
<code>orderDate</code> attribute are optional, the others are obligatory.
</p>
</note>
 <issue id='type-decl-syntax'>
  <p>Further integration of the concrete syntax for type definitions is
desireable, e.g. by using 'type' for both archetypes and and
datatypes, but the details of a consistent and clear way to do this
have not yet been agreed.</p></issue>

<p>Since an element declaration's <code>type</code> can identify either a datatype or an archetype, and there are separate symbol spaces for these two, the
possibility of ambiguity arises.  This is resolved in favour of the archetype, e.g. even if a datatype called <code>Address</code> existed (either
builtin or user-defined), the above declaration for <code>shipTo</code> would
refer to the user-defined archetype of that name.</p> 
     <issue id='note-two-sses'>
      <p>The separation of the datatype and archetype name symbol spaces is
primarily motivated by the decision to allow unqualified reference to the <emph>ab
initio</emph> and built-in datatypes.  Should this decision be reversed, as was
suggested in the report of the simplification Task Force, then the unification of the
two symbol spaces could proceed with minimal negative impact.  The potential for
error which arises from unexpected shadowing of an old datatype by a new
archetype would be removed.</p>
     </issue>
 <p>
<termdef term='definition' id='nt-definition'>A <term>definition</term> creates a new archetype or datatype</termdef>; <termdef id='nt-declaration' term='declaration'>a <term>declaration</term> enables the appearance in a
document instance of an element or attribute with a specific name and type</termdef>. In the schema,
we see both the definition of several types, and also several elements and
attributes declared
as usages of these types. For example, <code>Address</code> is defined to be an
archetype, while within the definition of <code>Address</code> we see five
declarations of elements and one attribute declaration. These declarations are
not themselves types, but rather an association between a name and constraints
which govern the appearance of that name in documents governed by the containing schema.</p>
 <p>
In the case of attribute declarations, the constraints are on the allowed
value, always by reference to a datatype:
</p>
 <note role='example'>
<eg xml:space='preserve'><![CDATA[<attribute name="orderDate" type="date" />]]></eg>
</note>
 <p>In the case of element declarations, the constraints are on the allowed
content and attributes, by reference to an archetype <emph>or</emph> a datatype (in which
case no attributes are allowed):
</p>
 <note role='example'><eg xml:space='preserve'><![CDATA[<element name="shipTo" type="Address" />
<element name="comment" type="string" />
]]></eg><p>Because <code>Address</code> is defined in the schema to have
certain elements as its content and to allow a certain attribute, any
<code>shipTo</code> element appearing in an instance must include those
elements and may have that attribute, while any <code>comment</code> element
may not have
any attributes, but any text content.</p></note>
 <p>As well as naming a datatype or archetype in an attribute or element
declaration, we can embed the type definition immediately within the
element declaration:</p>
     <note role='example'>
      <eg xml:space='preserve'><![CDATA[<archetype name='Items'>
 <element name='Item' minOccurs='0' maxOccurs='*'>
  <archetype>
   <element name='productName' type='string' />
   <element name='quantity' type='integer'>
    <minExclusive>0</minExclusive>
   </element>
   <element name='price' type='number' />
   <element ref='comment' minOccurs='0' />
  </archetype>
 </element>
</archetype>]]></eg>
      <p>Here not only is the archetype of the <code>Item</code> element given
in line, but also the datatype referenced by its
<code>quantity</code> daughter (the built-in <code>integer</code> datatype) is
also qualified inline by adding a subrange constraint.</p>
     </note>
   <p>Taken together the examples above constitute a complete schema for the
initial <code>PurchaseOrder</code> example instance.  They are drawn together
in a single complete schema in <specref ref='sampleSchema'/>.</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. A 'Yes' in the
        'Name apears in instances?' 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>
           <th align='left' valign='top' rowspan='1' colspan='1'>Name appears
in instances?</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 element
              containing all the definitions and declarations comprising a schema.
            </td>
            <td align='left' valign='top' rowspan='1' colspan='1'> Yes </td>
           <td valign='top'>No</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'> An atomic type
              (content constraint), such as 'integer', 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>
           <td valign='top'>No</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>
           <td valign='top'>No</td>
          </tr>
          <tr>
            <td align='left' valign='top' rowspan='1' colspan='1'>
              <specref ref='declare-element'/></td>
            <td align='left' valign='top' rowspan='1' colspan='1'> An
              association between a name for an element and a type. An element
              declaration for 'A' 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>
           <td valign='top'>Yes</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 name for an attribute and a datatype, together with
              occurrence constraints such as 'required' or 'default'. The
              association is local to its surrounding archetype.</td>
            <td align='left' valign='top' rowspan='1' colspan='1'> Yes (local)
              </td>
           <td valign='top'>Yes</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>
           <td valign='top'>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
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>
           <td valign='top'>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 and sequencing, as well as for declaration of and
              reference to elements. </td>
            <td align='left' valign='top' rowspan='1' colspan='1'> No (but see
              below) </td>
           <td valign='top'>No</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>
           <td valign='top'>No</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>
           <td valign='top'>No</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>
           <td valign='top'>No</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 elsewhere,
              retaining the association with their origin.</td>
            <td align='left' valign='top' rowspan='1' colspan='1'> No </td>
           <td valign='top'>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 elsewhere into the schema being
              defined, as if they had been defined locally.</td>
            <td align='left' valign='top' rowspan='1' colspan='1'> No </td>
           <td valign='top'>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 have names, which provide for references within the
        schema, and sometimes from one schema to another. For example, an attribute
        declaration can refer to a named datatype, such as 'integer'. A
        content model can refer to an element, and so on. </p>
      <p>If all such names were assigned from the same 'pool', then
        it would be impossible to have e.g. a datatype named 'integer' and an
        element with the name 'integer' in the same schema.
        <termdef id='key-symbolSpace' term='symbol space'>Accordingly we introduce the
        idea of a <term>symbol space</term> (avoiding 'name space' to avoid
        confusion with 'Namespaces in XML' <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 'Attribute' and
        'element': 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 a type and an
        element, without conflict or necessary relation between the two. </p>
      <p>Attributes and local element declarations are special, in that
        every archetype defines its own attribute symbol space and local element symbol 
        space, which are distinct from each other.  In addition, top-level elements
        (whose declarations are not contained within an archetype definition) reside in 
        their own symbol space.
        </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, paradigms
        and in <specref ref='normative-schemaSchema'/> and
        <specref ref='normative-schemaDTD'/>. Unlike the previous version, in
which the intention was to
        stay quite close to the abstract syntax, in this version we have begun
to take convenience and clarity into account. </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 instances 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 xml:space='preserve'><nt def='nt-preamble'>preamble</nt> <nt def='nt-dds'>dds</nt>*
          </rhs>
        </prod>
        <prod id='nt-dds'>
          <lhs>dds</lhs>
          <rhs xml:space='preserve'><nt def='nt-datatypeDefn'>datatypeDefn</nt> |
            <nt def='nt-archetypeDefn'>archetypeDefn</nt> | <nt def='nt-elementDecl'>elementDecl</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 xml:space='preserve'><nt def='nt-xmlSchemaRef'>xmlSchemaRef</nt> <nt def='nt-targetNamespace'>targetNamespace</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 xml:space='preserve'><pt>URI</pt> </rhs>
        </prod>
        <prod id='nt-targetNamespace'>
          <lhs>targetNamespace</lhs>
          <rhs><pt>URI</pt></rhs>
        </prod>
        <prod id='nt-schemaVersion'>
          <lhs>schemaVersion</lhs>
          <rhs xml:space='preserve'><pt>string-value</pt> </rhs>
        </prod>
        <prod id='nt-model'>
          <lhs>model</lhs>
          <rhs xml:space='preserve'><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-targetNamespace'>targetNamespace</nt> specifying the URI of
the namespace which this schema is about; and a <nt def='nt-schemaVersion'>schemaVersion</nt> specification for private version
        documentation purposes and version management.</p>
     <p>See <specref ref='composition'/> for discussion of schemas, instances
and namespaces.</p>
     <ednote>
      <edtext>The whole matter of instance/schema connections is still under
discussion:  the WG has not reached consensus in this area.  The referenced
section does give some indication of where our thinking in this area is going.</edtext>
     </ednote>


<e:element-syntax name='schema'>
 <e:in-category name='root'/>
 <e:attribute name='model'>
  <e:constant value='open'/>
  <e:constant value='refinable'/>
  <e:constant value='closed'/>
 </e:attribute>
 <e:attribute name='targetNS'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='version'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='xmlns'>
  <e:constant value='&XSP1.base;'/>
 </e:attribute>
 <e:sequence>
 <e:element name='import' repeat='zero-or-more'/>
 <e:element name='include' repeat='zero-or-more'/>
 <e:element name='export' repeat='zero-or-one'/>
 <e:choice repeat='zero-or-more'>
  <e:element name='attrGroup'/>
  <e:element name='comment'/>
  <e:element name='datatype'/>
  <e:element name='element'/>
  <e:element name='externalEntity'/>
  <e:element name='modelGroup'/>
  <e:element name='notation'/>
  <e:element name='textEntity'/>
  <e:element name='archetype'/>
  <e:element name='unparsedEntity'/>
 </e:choice>
</e:sequence>
</e:element-syntax>
<e:element-syntax name='comment'>
 <e:in-category name='top-level'/>
 <e:text/>
</e:element-syntax>


      <note role='example'>
        <eg xml:space='preserve'>
&lt;!DOCTYPE schema
          PUBLIC '-//W3C//DTD XML Schema Version 1.0//EN'
          SYSTEM '&XSP1.URI;.dtd' &gt;

&lt;schema targetNS='http://purl.org/metadata/dublin_core'
        version='M.n'
        xmlns='&XSP1.base;'&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>Although the schema above is a complete XML document,  <code>schema</code>
need not be the document element, but can appear within other documents. 
Indeed there is no requirement that a schema be derived from a (text) document
at all:  it could be built 'by hand' via e.g. a DOM-conformant API.</p>
    <p>The schema's <nt def='nt-model'>model</nt> property is discussed in
      <specref ref='declare-refinement'/>. The schema'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'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 xml:space='preserve'><pt>NCName</pt> <nt def='nt-datatypeSpec'>datatypeSpec</nt> </rhs>

      </prod>
      <prod id='nt-archetypeDefn2' role='prefig'>
        <lhs>archetypeDefn</lhs>
        <rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-archetypeSpec'>archetypeSpec</nt> </rhs>
      </prod>
      <prod id='nt-elementDecl2' role='prefig'>
        <lhs>elementDecl</lhs>
        <rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-elementSpec'>elementSpec</nt> </rhs>
      </prod>
      <prod id='nt-modelGroupDefn2' role='prefig'>
        <lhs>modelGroupDefn</lhs>
        <rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-modelGroupSpec'>modelGroupSpec</nt> </rhs>
      </prod>
      <prod id='nt-attrGroupDefn2' role='prefig'>
        <lhs>attrGroupDefn</lhs>
        <rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-attrGroupSpec'>attrGroupSpec</nt> </rhs>
      </prod>
      <prod id='nt-entityDecl2' role='prefig'>
        <lhs>entityDecl</lhs>
        <rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-entitySpec'>entitySpec</nt> </rhs>
      </prod>
      <prod id='nt-notationDecl2' role='prefig'>
        <lhs>notationDecl</lhs>
        <rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-notationSpec'>notationSpec</nt> </rhs>

      </prod>

    </scrap>

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

 &lt;archetype name='myType'&gt;
  ...
 &lt;/archetype&gt;

 &lt;element name='myElement'&gt;
  ...
 &lt;/element&gt;

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

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

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

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

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

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

&lt;/schema&gt;
</eg>
      <p>When creating a component, we establish an association between its name
        and the specification for that component. Each new component therefore
        creates a new entry in the symbol space for that kind of component. </p>
  </note>
  <p>The <specref ref='cos-unique'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
  <issue id='no-evolution'>
    <p> This draft does not deal with the requirement "for addressing the
      evolution of schemata" (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='composition-instances'/> and <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'>schema</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 xml:space='preserve'>(<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-typeRef2' role='prefig'>
      <lhs>typeRef</lhs>
      <rhs xml:space='preserve'><nt def='nt-archetypeRef'>archetypeRef</nt> | <nt def='nt-datatypeRef'>datatypeRef</nt></rhs>
    </prod>
    <prod id='nt-datatypeRef2' role='prefig'>
      <lhs>datatypeRef</lhs>
      <rhs xml:space='preserve'><nt def='nt-datatypeName'>datatypeName</nt> <nt def='nt-datatypeQual'>datatypeQual</nt></rhs>
    </prod>
    <prod id='nt-datatypeName2' role='prefig'>
      <lhs>datatypeName</lhs>
      <rhs xml:space='preserve'><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'>typeName</nt></rhs>
    </prod>
    <prod id='nt-archetypeName2' role='prefig'>
      <lhs>archetypeName</lhs>
      <rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-schemaRef'>schemaRef</nt>?</rhs>
    </prod>
    <prod id='nt-elementRef2' role='prefig'>
      <lhs>elementRef</lhs>
      <rhs xml:space='preserve'><nt def='nt-elementName'>elementName</nt> </rhs>
    </prod>
    <prod id='nt-elementName2' role='prefig'>
      <lhs>elementName</lhs>
      <rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-schemaRef'>schemaRef</nt>?</rhs>
    </prod>
    <prod id='nt-attrGroupRef2' role='prefig'>
      <lhs>attrGroupRef</lhs>
      <rhs xml:space='preserve'><nt def='nt-attrGroupName'>attrGroupName</nt> <nt def='nt-attrGroupQual'>attrGroupQual</nt></rhs>
    </prod>
    <prod id='nt-attrGroupName2' role='prefig'>
      <lhs>attrGroupName</lhs>
      <rhs xml:space='preserve'><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 xml:space='preserve'><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 xml:space='preserve'><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 xml:space='preserve'><pt>NCName</pt> <nt def='nt-schemaRef'>schemaRef</nt>?</rhs>
    </prod>

  </scrap>

  <p>The abstract syntax above characterizes the reference mechanisms used in this
    specification.</p>
  <note role='example'>
    <eg xml:space='preserve'>
&lt;element type='Address'/&gt;

&lt;element type='BLOCKQUOTE' schemaAbbrev='XHTML'/&gt;

&lt;attribute type='quantity' schemaName='http://www.w3.org/xsl.xsd'/&gt;
</eg>
    <p>The first of these is a local reference, the other two refer to schemas
      elsewhere. The <code>BLOCKQUOTE</code> example assumes
      the <nt def='nt-schemaAbbrev'>schemaAbbrev</nt> <code>XHTML</code> has been
      declared for import; the <code>template</code> 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>
<p>The <specref ref='cos-cons-import'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
<p>The <specref ref='cos-ref-oneway'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
<p>The <termref def='key-identify'>identify</termref> definition wrt schema-validity obtains.</p>
 <p>The
  <specref ref='cos-ident-ref'/> <termref def='gloss-cos'>Constraint on
  Schemas</termref> also obtains.</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></p>

  <scrap lang='ebnf' id='RuleSet.XS5'>

    <head>Datatypes</head>
    <prod id='nt-datatypeDefn'>
      <lhs>datatypeDefn</lhs>
      <rhs xml:space='preserve'><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, length constraint, etc.</com> </rhs>
    </prod>
    <prod id='nt-valueConstraint'>
      <lhs>valueConstraint</lhs>
      <rhs xml:space='preserve'><pt>default</pt> | <pt>fixed</pt> </rhs>
    </prod>
    <prod id='nt-datatypeRef'>
      <lhs>datatypeRef</lhs>
      <rhs xml:space='preserve'><nt def='nt-datatypeName'>datatypeName</nt> <nt def='nt-datatypeQual'>datatypeQual</nt></rhs>
    </prod>
    <prod id='nt-datatypeName'>
      <lhs>datatypeName</lhs>
      <rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-schemaRef'>schemaRef</nt>? </rhs>
    </prod>
    <prod id='nt-schemaRef2' role='prefig'>
      <lhs>schemaRef</lhs>
      <rhs xml:space='preserve'>(<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 specification mechanisms defined by
    <bibref ref='ref-xsp2'/> in order to express <termref def='SC'>SC</termref>s on
    attribute values and the contents of elements consisting entirely of character data. </p>
  <p>The production for <nt def='nt-datatypeSpec'>datatypeSpec</nt> above serves to indicate where this
    chapter connects with &XSP2;.  <nt def='nt-exportControl'>exportControl</nt> is
    defined in <specref ref='composition-schemaExport'/>.  The concrete syntax
displayed below is copied from <bibref ref='ref-xsp2'/>.  Most of the elements
are for specifying facets:  they are all optional and may appear in any order
after the <code>basetype</code> element.</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'>attribute</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>
 <e:element-syntax name='basetype'>
 <e:in-category name='datatype'/>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaAbbrev'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaName'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:empty/>
</e:element-syntax>
<e:element-syntax name='datatype'>
 <e:in-category name='top-level'/>
 <e:attribute name='export'>
  <e:constant value='true'/>
  <e:constant value='false'/>
 </e:attribute>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:sequence>
  <e:element name='basetype'/>
 <e:all>
   <e:choice repeat='zero-or-one'>
   <e:element name='minExclusive'/>
   <e:element name='minInclusive'/>
  </e:choice>
  <e:choice repeat='zero-or-one'>
   <e:element name='maxExclusive'/>
   <e:element name='maxInclusive'/>
  </e:choice>
  <e:element name='precision' repeat='zero-or-one'/>
 <e:element name='scale' repeat='zero-or-one'/>
 <e:element name='enumeration' repeat='zero-or-one'/>
 <e:element name='length' repeat='zero-or-one'/>
 <e:element name='lexicalRepresentation' repeat='zero-or-one'/>
 <e:element name='maxLength' repeat='zero-or-one'/>
</e:all>
 </e:sequence>
</e:element-syntax>
<e:element-syntax name='enumeration'>
 <e:in-category name='datatype'/>
  <e:element name='literal' repeat='one-or-more'/>
</e:element-syntax> 
<e:element-syntax name='length'>
 <e:in-category name='datatype'/>
 <e:text/>
</e:element-syntax>
<e:element-syntax name='lexical'>
 <e:in-category name='datatype'/>
 <e:text/>
</e:element-syntax>
<e:element-syntax name='lexicalRepresentation'>
 <e:in-category name='datatype'/>
  <e:element name='lexical' repeat='one-or-more'/>
</e:element-syntax>
<e:element-syntax name='literal'>
 <e:in-category name='datatype'/>
 <e:text/>
</e:element-syntax>
<e:element-syntax name='maxExclusive'>
 <e:in-category name='datatype'/>
 <e:text/>
</e:element-syntax>
<e:element-syntax name='maxInclusive'>
 <e:in-category name='datatype'/>
 <e:text/>
</e:element-syntax>
<e:element-syntax name='maxLength'>
 <e:in-category name='datatype'/>
 <e:text/>
</e:element-syntax>
<e:element-syntax name='minExclusive'>
 <e:in-category name='datatype'/>
 <e:text/>
</e:element-syntax>
<e:element-syntax name='minInclusive'>
 <e:in-category name='datatype'/>
 <e:text/>
</e:element-syntax>
<e:element-syntax name='precision'>
 <e:in-category name='datatype'/>
 <e:text/>
</e:element-syntax>
<e:element-syntax name='scale'>
 <e:in-category name='datatype'/>
 <e:text/>
</e:element-syntax>

  <note role='example'>
    <eg xml:space='preserve'><![CDATA[<datatype name='posInt'>
 <basetype name='integer'/>
 <minExclusive>0</minExclusive>
</datatype>

<attribute name='foo' type='posInt'/>

<attribute name='baz' type='integer'/>

<attribute name='fontSize' type='quantity' schemaName='http://www.w3.org/xsl.xsd'>
 <fixed>12pt</fixed>
</attribute>]]></eg>
<p>The first <code>attribute</code> 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>

 <note>
  <p>See <loc href='#type-decl-syntax'>previous note on the type definition issue</loc>.</p>
 </note>

<p>The <termref def='key-satisfy-dt'>satisfy-dt</termref> definition wrt schema-validity obtains.</p>
<p>The <specref ref='sic-datatype'/> <termref def='gloss-sic'>Schema Information Set Contribution</termref> obtains.</p>
</div3>
<div3 id='declare-archetype'>
<head>Archetype Definition</head>
<p><termdef id='archetype' term='archetype'><term>Archetype</term> specifications
  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 declaration that shares
  the same <termref def='SC'>SC</termref>s (see
  <specref ref='declare-element'/>), 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 xml:space='preserve'><pt>NCName</pt> <nt def='nt-archetypeSpec'>archetypeSpec</nt></rhs>
 </prod>
  <prod id='nt-archetypeSpec'>
    <lhs>archetypeSpec</lhs>
    <rhs xml:space='preserve'><nt def='nt-refinement'>refinement</nt>* <nt def='nt-contentType'>contentType</nt> ( <nt def='nt-attrDecl'>attribute</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 xml:space='preserve'><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 xml:space='preserve'><pt>open</pt> | <pt>refinable</pt> | <pt>closed</pt> </rhs>
  </prod>
  <prod id='nt-archetypeRef'>
    <lhs>archetypeRef</lhs>
    <rhs xml:space='preserve'><nt def='nt-archetypeName'>archetypeName</nt> </rhs>
  </prod>
  <prod id='nt-archetypeName'>
    <lhs>archetypeName</lhs>
    <rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-schemaRef'>schemaRef</nt>?</rhs>
  </prod>
<prod id='nt-refinement'>
<lhs>refinement</lhs>
<rhs><nt def='nt-archetypeRef'>typeRef</nt></rhs>
</prod>

</scrap>

<p>The first three productions above provide the basic structure of the
  specification, and the last two provide for reference to the things specified. 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 archetype. The connection between an element
  name and an archetype is made by an <nt def='nt-elementDecl'>elementDecl</nt>, see below. </p>
<p>Alongside <specref ref='declare-attribute'/> for permitted attributes,
  <termref def='SC'>SC</termref>s for contents are specified in an archetype (<nt def='nt-contentType'>contentType</nt>). For elements which may contain only
  character data, this is by
  reference to a <specref ref='declare-datatype'/>. Note that doing this by way
  of <nt def='nt-datatypeRef'>datatypeRef</nt> allows for specialization and even
  defaulting in a manner similar to attribute values. For other kinds of
  elements, an <specref ref='declare-contentModel'/> is required. </p>
<issue id='elt-default'>
  <p>The extension of defaulting to element content is tentative. </p>
</issue>

<e:element-syntax name='archetype'>
 <e:in-category name='top-level'/>
 <e:attribute name='content'>
  <e:constant value='elemOnly'/>
  <e:constant value='textOnly'/>
  <e:constant value='mixed'/>
  <e:constant value='empty'/>
  <e:constant value='any'/>
 </e:attribute>
 <e:attribute name='default'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='fixed'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='model'>
  <e:constant value='open'/>
  <e:constant value='refinable'/>
  <e:constant value='closed'/>
 </e:attribute>
 <e:attribute name='name'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='order'>
  <e:constant value='choice'/>
  <e:constant value='seq'/>
  <e:constant value='all'/>
 </e:attribute>
 <e:attribute name='schemaAbbrev'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaName'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='type'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:sequence>
  <e:element name='refines' repeat='zero-or-more'/>
  <e:choice>
   <e:choice repeat='zero-or-more'>
    <e:element name='element'/>
    <e:element name='group'/>
    <e:element name='modelGroupRef'/>
   </e:choice>
   <e:element name='datatypeQual' repeat='zero-or-one'/>
  </e:choice>
  <e:choice repeat='zero-or-more'>
   <e:element name='attrGroupRef'/>
   <e:element name='attribute'/>
  </e:choice>
 </e:sequence>
</e:element-syntax>
<e:element-syntax name='datatypeQual'>
 <e:in-category name='archetype'/>
 <e:all>
   <e:choice repeat='zero-or-one'>
   <e:element name='minExclusive'/>
   <e:element name='minInclusive'/>
  </e:choice>
  <e:choice repeat='zero-or-one'>
   <e:element name='maxExclusive'/>
   <e:element name='maxInclusive'/>
  </e:choice>
  <e:element name='precision' repeat='zero-or-one'/>
 <e:element name='scale' repeat='zero-or-one'/>
 <e:element name='enumeration' repeat='zero-or-one'/>
 <e:element name='length' repeat='zero-or-one'/>
 <e:element name='lexicalRepresentation' repeat='zero-or-one'/>
 <e:element name='maxLength' repeat='zero-or-one'/>
</e:all>
</e:element-syntax>
<e:element-syntax name='refines'>
 <e:in-category name='archetype'/>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaAbbrev'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaName'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:empty/>
</e:element-syntax>
<note role='example'>
    <eg xml:space='preserve'><![CDATA[<archetype name='length1' type='number'/>
 <minInclusive>0</minInclusive>
 <attribute name='unit' type='NMTOKEN'/>
</archetype>

<element name='width' type='length1'/>

  <width unit='cm'>2.54</width>

<archetype name='length2'>
 <element name='size' type='number'>
  <minInclusive>0</minInclusive>
 </element>
 <element name='unit' type='NMTOKEN'/>
</archetype>

<element name='depth' type='length2'/>

  <depth>
   <size>2.54</size><unit>cm</unit>
  </depth>]]>
</eg>
  <p>
    Two approaches to defining an archetype for length:  one with
character data content constrained by a qualified reference to
    a built-in datatype, and one attribute, the other using two
elements.
</p>
</note>
<p>The way in which the concrete syntax defined and illustrated above realises the abstract syntax is
not straightforward, because it is optimised to make simple cases simple.  The
<code>datatypeQual</code> option is allowed only if a <code>type</code>
attribute is present.  Similarly, the <code>schemaName</code> or 
<code>schemaAbbrev</code>, the <code>default</code> and the
<code>fixed</code> attributes are allowed only if a <code>type</code> attribute
is present.  Finally, if a <code>type</code> attribute is present, it must
reference a datatype, and the <code>content</code> attribute must be
<code>textOnly</code> (or absent, in which case it defaults to
<code>textOnly</code>).  This is to handle the main alternation in the abstract
syntax for <nt def='nt-contentType'>contentType</nt>, which allows <emph>either</emph>
(possibly locally qualified) reference to a datatype <emph>or</emph> a
content model.</p>
 <note>
  <p>See <loc href='#type-decl-syntax'>previous note on the type definition issue</loc>.</p>
 </note>
<p>The <specref ref='cos-attrg-unique'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
<p>The <specref ref='cos-attrg-ided'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
<p>The <termref def='key-attr-decl-set'>attr-decl-set</termref> definition wrt schema-validity obtains.</p>
<p>The <termref def='key-attr-fullname'>attr-fullname</termref> definition wrt schema-validity obtains.</p>
<p>The <specref ref='cos-attr-unique'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
<p>The <termref def='key-satisfy-as'>satisfy-as</termref> definition wrt schema-validity obtains.</p>
<p>The <specref ref='sic-archetype'/> <termref def='gloss-sic'>Schema Information Set Contribution</termref> obtains.</p>
</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>attribute</lhs>
<rhs xml:space='preserve'><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 xml:space='preserve'><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 xml:space='preserve'><pt>default</pt> | <pt>fixed</pt> </rhs>
</prod>
<prod id='nt-datatypeName3' role='prefig'>
<lhs>datatypeName</lhs>
<rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-schemaRef'>schemaRef</nt>? </rhs>
</prod>
<prod id='nt-schemaRef3' role='prefig'>
<lhs>schemaRef</lhs>
<rhs xml:space='preserve'>(<nt def='nt-schemaAbbrev'>schemaAbbrev</nt> | <nt def='nt-schemaName'>schemaName</nt>)</rhs>
</prod>

</scrap>

<note>
<p>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>
 <e:element-syntax name='attribute'>
 <e:in-category name='archetype'/>
 <e:attribute name='content'>
  <e:constant value='textOnly'/>
  <e:constant value='empty'/>
 </e:attribute>
 <e:attribute name='default'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='fixed'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='maxOccurs' required='yes'>
  <e:constant value='1'/>
 </e:attribute>
 <e:attribute name='minOccurs'>
  <e:constant value='0'/>
 </e:attribute>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute> 
 <e:attribute name='schemaAbbrev'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaName'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='type'>
  <e:constant value='string'/>
 </e:attribute>
   <e:all>
   <e:choice repeat='zero-or-one'>
   <e:element name='minExclusive'/>
   <e:element name='minInclusive'/>
  </e:choice>
  <e:choice repeat='zero-or-one'>
   <e:element name='maxExclusive'/>
   <e:element name='maxInclusive'/>
  </e:choice>
  <e:element name='precision' repeat='zero-or-one'/>
 <e:element name='scale' repeat='zero-or-one'/>
 <e:element name='enumeration' repeat='zero-or-one'/>
 <e:element name='length' repeat='zero-or-one'/>
 <e:element name='lexicalRepresentation' repeat='zero-or-one'/>
 <e:element name='maxLength' repeat='zero-or-one'/>
</e:all>
</e:element-syntax>
<note role='example'>
<eg xml:space='preserve'><![CDATA[<attribute name='myAttribute'/>

<attribute name='anotherAttribute' type='integer' default='42'>
 <minExclusive>0</minExclusive>
</attribute>

<attribute name='yetAnotherAttribute' type='integer' minOccurs='1'/>

<attribute name='stillAnotherAttribute' type='string' fixed='Hello world!'/>]]>
</eg>
<p>Four attributes are declared: one with no explicit
<termref def='SC'>SC</termref>s at all; two declared by reference to a built-in
datatype, one with a default and a subrange qualification and one required to
be present in instances; and one with a fixed value.</p>
</note>
 <p>The
<code>maxOccurs</code> attribute is <code>FIXED</code> at 1 for all attributes.
Consistent with this, <code>minOccurs</code> can only be 0 or 1.</p>
<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>The <termref def='key-attr-satisfy'>attr-satisfy</termref> definition wrt schema-validity obtains.</p>
<issue id='default-attr-datatype'>
<p>What <emph>is</emph> the default attribute <nt def='nt-datatypeSpec'>datatypeSpec</nt>?</p>
</issue>
<p>The <termref def='key-satisfy-attrs'>satisfy-attrs</termref> definition wrt schema-validity obtains.</p>
<p>The <specref ref='sic-attr-default'/> <termref def='gloss-sic'>Schema Information Set Contribution</termref> obtains.</p>
<issue id='namespace-declare'>
<p>We've got a problem with namespace declarations: they're not
attributes at the infoset level, so they can appear without compromising
validity, <emph>except</emph> if there is a fixed or required declaration, and defaults
should have the apparently desired effect.  I.e., if a schema declares an
attribute whose name is <code>xmlns</code> with a default or fixed value, does
it change the infoset?  Or if we allow QNames as such to be declared, <code>xmlns:foo</code>.</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 xml:space='preserve'><pt>NCName</pt> <nt def='nt-attrGroupSpec'>attrGroupSpec</nt></rhs>
</prod>
<prod id='nt-attrGroupSpec'>
<lhs>attrGroupSpec</lhs>
<rhs><nt def='nt-attrDecl'>attribute</nt>* <nt def='nt-exportControl'>exportControl</nt></rhs>
</prod>
<prod id='nt-attrGroupRef'>
<lhs>attrGroupRef</lhs>
<rhs xml:space='preserve'><nt def='nt-attrGroupName'>attrGroupName</nt> <nt def='nt-attrGroupQual'>attrGroupQual</nt></rhs>
</prod>
<prod id='nt-attrGroupName'>
<lhs>attrGroupName</lhs>
<rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-schemaRef'>schemaRef</nt>?</rhs>
</prod>
<prod id='nt-attrGroupQual'>
<lhs>attrGroupQual</lhs>
<rhs><nt def='nt-attrDecl'>attribute</nt></rhs>
</prod>

</scrap>

<p>Attribute group definitions provide a construct to replace some uses of
<termref def='gloss-parameterEntity'>parameter entities</termref>. </p>
<e:element-syntax name='attrGroup'>
 <e:in-category name='top-level'/>
 <e:attribute name='export'>
  <e:constant value='true'/>
  <e:constant value='false'/>
 </e:attribute>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:choice repeat='one-or-more'>
  <e:element name='attrGroupRef'/>
  <e:element name='attribute'/>
 </e:choice>
</e:element-syntax>
<e:element-syntax name='attrGroupRef'>
 <e:in-category name='archetype'/>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaAbbrev'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaName'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:empty/>
</e:element-syntax>

<note role='example'>
<eg xml:space='preserve'>&lt;attrGroup name='myAttrGroup'&gt;
    &lt;attribute .../&gt;
    ...
&lt;/attrGroup&gt;

&lt;archetype name='myelement' content='empty'&gt;
    &lt;attrGroupRef name='myAttrGroup'/&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>
 <ednote>
  <edtext>There needs to be a Constraint on Schema which constrains the attributes
which appear with an attrGroupRef: the name is the same as one of the attributes
in the group, datatype and defaulting preserves substitutability, etc.</edtext>
 </ednote>
 <ednote>
<edtext>There needs to be some discussion of what happens in case of name
conflict between attrs as a result of an attr group ref.</edtext>
 </ednote>
</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 xml:space='preserve'><pt>any</pt> | <pt>empty</pt> | <nt def='nt-mixed'>mixed</nt> |
<nt def='nt-elemOnly'>elemOnly</nt></rhs>
</prod>

</scrap>

<p>A content model constrains the element content of an archetype specification:
it says nothing about attributes. </p>

<!-- Omit example - covered in chapter 2 now

<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>The <termref def='key-satisfy-cm'>satisfy-cm</termref> definition wrt schema-validity obtains.</p>
</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 elements are named, but
neither their order nor their number of occurrences is constrained. </p>

<scrap lang='ebnf' id='RuleSet.XS11'>

<head>Mixed content</head>
<prod id='nt-mixed'>
<lhs>mixed</lhs>
<rhs xml:space='preserve'>( <nt def='nt-elementRef'>elementRef</nt> | <nt def='nt-archetypeRef'>archetypeRef</nt> |
<nt def='nt-elementDecl'>elementDecl</nt> )*</rhs>
</prod>

</scrap>

<p>The <nt def='nt-elementRef'>elementRef</nt>s and
<nt def='nt-elementDecl'>elementDecl</nt>s determine the elements that may
appear as children along with character data.  For the interpretation of
<nt def='nt-archetypeRef'>archetypeRef</nt> in this context, see
<specref ref='declare-refinement'/>.</p>
<note role='example'>
<eg xml:space='preserve'>&lt;archetype content='mixed'&gt;
 &lt;element ref='name1'/&gt;
 &lt;element ref='name2'/&gt;
 &lt;element ref='name3'/&gt;
&lt;/archetype&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-elementRef'>elementRef</nt>s or
<nt def='nt-elementDecl'>elementDecl</nt>s makes it similar to XML
1.0'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>
<p>The <specref ref='cos-et-reuse'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
<p>See <specref ref='declare-element'/> for discussion and examples of the
appearance of <nt def='nt-elementDecl'>elementDecl</nt> above.</p>
<p>The <termref def='key-satisfy-mixed'>satisfy-mixed</termref> definition wrt schema-validity obtains.</p>
</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-elemOnly'>
<lhs>elemOnly</lhs>
<rhs><nt def='nt-modelElt'>modelElt</nt></rhs>
</prod>
<prod id='nt-modelElt'>
<lhs>modelElt</lhs>
<rhs xml:space='preserve'><nt def='nt-occurs'>occurs</nt> ( <nt def='nt-modelGroup'>modelGroup</nt> |
<nt def='nt-modelGroupRef'>modelGroupRef</nt> | <nt def='nt-elementRef'>elementRef</nt> | <nt def='nt-archetypeRef'>archetypeRef</nt> | <nt def='nt-elementDecl'>elementDecl</nt> )</rhs>
</prod>
<prod id='nt-occurs'>
<lhs>occurs</lhs>
<rhs xml:space='preserve'><pt>minOccurs</pt> <pt>maxOccurs</pt></rhs>
</prod>
<prod id='nt-modelGroup'>
<lhs>modelGroup</lhs>
<rhs xml:space='preserve'><nt def='nt-richModelGroup'>richModelGroup</nt> | <nt def='nt-simpleModelGroup'>simpleModelGroup</nt></rhs>
</prod>
 <prod id='nt-richModelGroup'>
  <lhs>richModelGroup</lhs>
  <rhs xml:space='preserve'><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 xml:space='preserve'><pt>sequence</pt> | <pt>choice</pt> </rhs>
</prod>
<prod id='nt-modelEltSeq'>
<lhs>modelEltSeq</lhs>
<rhs xml:space='preserve'><nt def='nt-modelElt'>modelElt</nt> <nt def='nt-modelEltSeq'>modelEltSeq</nt>?</rhs>
</prod>
<prod id='nt-simpleModelGroup'>
 <lhs>simpleModelGroup</lhs>
 <rhs xml:space='preserve'><pt>all</pt> <nt def='nt-simpleModelElt'>simpleModelElt</nt> <nt def='nt-simpleModelEltSeq'>simpleModelEltSeq</nt></rhs>
</prod>
 <prod id='nt-simpleModelElt'>
  <lhs>simpleModelElt</lhs>
  <rhs xml:space='preserve'><nt def='nt-elementRef'>elementRef</nt> | <nt def='nt-elementDecl'>elementDecl</nt> | <nt def='nt-archetypeRef'>archetypeRef</nt></rhs>
 </prod>
 <prod id='nt-simpleModelEltSeq'>
<lhs>simpleModelEltSeq</lhs>
<rhs xml:space='preserve'><nt def='nt-simpleModelElt'>simpleModelElt</nt> <nt def='nt-simpleModelEltSeq'>simpleModelEltSeq</nt>?</rhs>
</prod>
</scrap>
<ednote><edtext>I'm unclear what the status of collection is after the 
Montreal votes, for the time being it's out.</edtext></ednote>
<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-elementRef'>elementRef</nt> or <nt def='nt-elementDecl'>elementDecl</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 (this is the case for the implicit 'and' compositor, which is
associated with the <nt def='nt-simpleModelGroup'>simpleModelGroup</nt> production. 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, which are restricted in this case only to unqualified <nt def='nt-elementRef'>elementRef</nt>s and <nt def='nt-elementDecl'>elementDecl</nt>s, must appear in the element content, but may appear in any order.</p>
<p>The <nt def='nt-occurs'>occurs</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, but note that the components of a group whose <nt def='nt-compositor'>compositor</nt> is (implicitly) 'all' are not qualified,
and therefor call for exactly one appearance of the element they identify.</p>
<p>See <specref ref='declare-element'/> for further discussion and examples
of the appearance of <nt def='nt-elementDecl'>elementDecl</nt> within
<nt def='nt-modelElt'>modelElt</nt> above.</p>
 <p>For the interpretation of
<nt def='nt-archetypeRef'>archetypeRef</nt> in this context, see
<specref ref='declare-refinement'/>.</p>

<e:element-syntax name='group'>
 <e:in-category name='content'/>
 <e:attribute name='collection'>
  <e:constant value='no'/>
  <e:constant value='list'/>
 </e:attribute>
 <e:attribute name='maxOccurs'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='minOccurs'>
  <e:constant value='1'/>
 </e:attribute>
 <e:attribute name='name'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='order'>
  <e:constant value='choice'/>
  <e:constant value='seq'/>
  <e:constant value='all'/>
 </e:attribute>
 <e:choice repeat='one-or-more'>
  <e:element name='element'/>
  <e:element name='group'/>
  <e:element name='modelGroupRef'/>
 </e:choice>
</e:element-syntax>
<!-- Omit example for now - mostly covered in chapter 2.

<note role='example'>
<eg xml:space='preserve'>&lt;elementTypeRef name='paragraph'/&gt;

&lt;sequence&gt;
 &lt;elementRef name='name1'/&gt;
 &lt;elementRef name='name2' prefix='HTML'/&gt;
&lt;/sequence&gt;

&lt;choice minOccurs='3' maxOccurs='9'&gt;
 &lt;elementRef name='name1'/&gt;
 &lt;elementRef name='name2'/&gt;
&lt;/choice&gt;

&lt;all minOccurs='3'&gt;
 &lt;elementRef name='name1'/&gt;
 &lt;elementRef name='name2'/&gt;
&lt;/all&gt;

&lt;choice&gt;
 &lt;all&gt;
  &lt;elementRef name='name1'/&gt;
  &lt;elementRef name='name2'/&gt;
 &lt;/all&gt;
 &lt;all&gt;
  &lt;elementRef name='name3'/&gt;
  &lt;elementRef name='name4'/&gt;
 &lt;/all&gt;
&lt;/choice&gt;</eg>
<p>A minimal model which simply requires a <code>paragraph</code> (the default
is <code>minOccurs=maxOccurs=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>The <termref def='key-satisfy-eo'>satisfy-eo</termref> definition wrt schema-validity obtains.</p>
<p>The <specref ref='cos-elt-consist'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
<p>The <specref ref='cos-nonambig'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
<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 xml:space='preserve'><pt>NCName</pt> <nt def='nt-modelGroupSpec'>modelGroupSpec</nt></rhs>
</prod>
<prod id='nt-modelGroupSpec'>
<lhs>modelGroupSpec</lhs>
<rhs xml:space='preserve'>( <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 xml:space='preserve'><pt>NCName</pt> <nt def='nt-schemaRef'>schemaRef</nt>?</rhs>
</prod>

</scrap>

<e:element-syntax name='modelGroup'>
 <e:in-category name='top-level'/>
 <e:attribute name='export'>
  <e:constant value='true'/>
  <e:constant value='false'/>
 </e:attribute>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='order'>
  <e:constant value='choice'/>
  <e:constant value='seq'/>
  <e:constant value='all'/>
 </e:attribute>
 <e:choice repeat='one-or-more'>
  <e:element name='element'/>
  <e:element name='group'/>
  <e:element name='modelGroupRef'/>
 </e:choice>
</e:element-syntax>
<e:element-syntax name='modelGroupRef'>
 <e:in-category name='content'/>
 <e:attribute name='maxOccurs'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='minOccurs'>
  <e:constant value='1'/>
 </e:attribute>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaAbbrev'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaName'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:empty/>
</e:element-syntax>
<note role='example'>
<eg xml:space='preserve'>&lt;modelGroup name='myModelGroup'&gt;
 &lt;element ref='myelement'/&gt;
&lt;/modelGroup&gt;

&lt;element name='myelement'&gt;
 &lt;archetype&gt;
  &lt;modelGroupRef name='myModelGroup'/&gt;
  &lt;attribute ...&gt;. . .&lt;/attribute&gt;
 &lt;/archetype&gt;
&lt;/element&gt;

&lt;element name='anotherelement'&gt;
 &lt;archetype&gt;
  &lt;group order='choice'&gt;
   &lt;element ref='yetAnotherelement'/&gt;
   &lt;modelGroupRef name='myModelGroup'/&gt;
  &lt;/group&gt;
  &lt;attribute ...&gt;. . .&lt;/attribute&gt;
 &lt;/archetype&gt;
&lt;/element&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-element'>
<head>Element Declaration</head>
<p>An <termdef id='key-element' term='element declaration'><term>element
declaration</term> associates an element name with a
type</termdef>, either by reference or by incorporation. </p>

<scrap lang='ebnf' id='RuleSet.XS13'>

<head>Element declaration</head>
<prod id='nt-elementDecl'>
<lhs>elementDecl</lhs>
<rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-elementSpec'>elementSpec</nt></rhs>
</prod>
<prod id='nt-elementSpec'>
<lhs>elementSpec</lhs>
<rhs xml:space='preserve'>( <nt def='nt-typeRef'>typeRef</nt> | <nt def='nt-archetypeSpec'>archetypeSpec</nt> | <nt def='nt-archetypeSpec'>datatypeSpec</nt>) <nt def='nt-exportControl'>exportControl</nt> <pt>global</pt>?</rhs>
</prod>
 <prod id='nt-typeRef'>
  <lhs>typeRef</lhs>
  <rhs xml:space='preserve'><nt def='nt-archetypeRef'>archetypeRef</nt> |
<nt def='nt-datatypeRef'>datatypeRef</nt></rhs>
    </prod>
<prod id='nt-elementRef'>
<lhs>elementRef</lhs>
<rhs xml:space='preserve'><nt def='nt-elementName'>elementName</nt> </rhs>
</prod>
<prod id='nt-elementName'>
<lhs>elementName</lhs>
<rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-schemaRef'>schemaRef</nt>? </rhs>
</prod>

</scrap>

<p>An element declaration associates a name with a
specification. This name will appear in tags in instance
documents; the specification provides <termref def='SC'>SC</termref>s on
the form of elements tagged with the given name. An element 
declaration whose <nt def='nt-elementSpec'>elementSpec</nt> is an
<nt def='nt-archetypeSpec'>archetypeSpec</nt> is comparable to an 
<code>&lt;!ELEMENT ...&gt;</code> declaration in an XML 1.0 DTD. </p>
<p><nt def='nt-elementSpec'>elementSpec</nt> not only allows for
element declarations to associate a name with an <nt def='nt-archetypeSpec'>archetypeSpec</nt> (by reference or inclusion), but also
allows the reference or specification to be for a datatype, with the
implication that no attributes are allowed in instances and the
text-only content will be constrained appropriately.</p>
<p><nt def='nt-elementRef'>elementRef</nt> and <nt def='nt-elementName'>elementName</nt> provide for top-level element declarations to be referenced by
name from content models. </p>
<p>As noted above element names are in a separate
<termref def='key-symbolSpace'>symbol space</termref> from the symbol spaces for
the names of types, so there can (but need
not be) an archetype or datatype with the same name as a top-level element.</p>
 <p>In the case of ambiguity of type reference, that is when the <termref def='nt-typeRef'>typeRef</termref> option is used and there are both a
datatype and an archetype of the referenced name in the relevant schema, the
ambiguity is resolved in favour of the archetype.</p>
 <note>
  <p>See <loc href='#note-two-sses'>previous note on the ambiguity issue</loc>.</p>
 </note>
<p>The <termref def='key-elt-fullname'>elt-fullname</termref> definition wrt schema-validity obtains.</p>
<p>An <nt def='nt-elementDecl'>elementDecl</nt> may appear both at the top
level of a schema and 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 name and a type. As with attribute names, locally-scoped
element names reside in symbol spaces local to the archetype that defines
them. Note however that archetype and datatype names are always top-level names within a
schema, even when associated with locally-scoped element names.</p>
<note>
<p>It is not yet clear whether a type defined implicitly by the
appearance of a <nt def='nt-archetypeSpec'>archetypeSpec</nt> or <nt def='nt-datatypeSpec'>datatypeSpec</nt> directly within
an <nt def='nt-elementSpec'>elementSpec</nt>, or by the use of a <nt def='nt-typeRef'>typeRef which refers to a datatype, </nt> will have an implicit
name, or if so what that name would be.</p>
</note>
<e:element-syntax name='element'>
 <e:in-category name='top-level'/>
 <e:attribute name='archRef'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='default'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='export'>
  <e:constant value='true'/>
  <e:constant value='false'/>
 </e:attribute>
 <e:attribute name='fixed'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='maxOccurs'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='minOccurs'>
  <e:constant value='1'/>
 </e:attribute>
 <e:attribute name='name'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='ref'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaAbbrev'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='schemaName'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='type'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:choice repeat='zero-or-one'>
 <e:element name='datatype'/>
 <e:element name='archetype'/>
</e:choice>
</e:element-syntax>
<note role='example'>
<eg xml:space='preserve'>&lt;element name='myelement' type='myDatatype'/&gt;

&lt;element name='et0' type='myType'/&gt;

&lt;element ref='et1'/>

&lt;element name='et1'&gt;
 &lt;archetype order='all'&gt;
  &lt;element . . . /&gt;
  . . .
  &lt;attribute ...&gt;. . .&lt;/attribute&gt;
 &lt;/archetype&gt;
&lt;/element&gt;

&lt;element name='et2'&gt;
 &lt;archetype content='any'/&gt;
&lt;/element&gt;

&lt;element name='et3'&gt;
 &lt;archetype content='empty'&gt;
  &lt;attribute ...&gt;. . .&lt;/attribute&gt;
 &lt;/archetype&gt;
&lt;/element&gt;

&lt;element name='et4'&gt;
 &lt;archetype order='choice'&gt;
  &lt;element . . . /&gt;
  . . .
  &lt;attribute ...&gt;. . .&lt;/attribute&gt;
 &lt;/archetype&gt;
&lt;/element&gt;

&lt;element name='et5'&gt;
 &lt;archetype order='seq'&gt;
  &lt;element . . . /&gt;
  . . .
  &lt;attribute ...&gt;. . .&lt;/attribute&gt;
 &lt;/archetype&gt;
&lt;/element&gt;

&lt;element name='et6'&gt;
 &lt;archetype model='open' content='mixed'/&gt;
&lt;/element&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;element name='contextOne'&gt;
 &lt;archetype order='seq'&gt;
  &lt;element name='myLocalelement' type='myFirstType'/&gt;
  &lt;element ref='globalelement'/&gt;
 &lt;/archetype&gt;
&lt;/element&gt;

&lt;element name='contextTwo'
 &lt;archetype order='seq'&gt;
  &lt;element name='myLocalelement' type='mySecondType'/&gt;
  &lt;element ref='globalelement'/&gt;
 &lt;/archetype&gt;
&lt;/element&gt;
</eg>
<p>Instances of <code>myLocalelement</code> within
<code>contextOne</code> will be constrained by <code>myFirstType</code>,
while those within <code>contextTwo</code> will be constrained by
<code>mySecondType</code>. </p>

</note>
<note>
<p>The possibility that differing attribute declarations 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>
<p>The <specref ref='cos-local-global'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
<p>The <specref ref='cos-respect-global'/> <termref def='gloss-cos'>Constraint on Schemas</termref> obtains.</p>
<p>The <termref def='key-satisfy-ed'>satisfy-ed</termref> definition wrt schema-validity obtains.</p>
<p>The <termref def='key-ind-valid'>ind-valid</termref> definition wrt schema-validity obtains.</p>
<p>The <termref def='key-satisfy-etr'>satisfy-etr</termref> definition wrt schema-validity obtains.</p>
</div3>
</div2>
<div2 id='declare-refinement'>
<head>Archetype Refinement *</head>
<note>
<p>This chapter 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 defined in a schema. An
archetype definition may identify one or more other archetypes from which it
specifies the creation of a (joint) refinement. </p>
<note>
 <p>The balance of this chapter has been withdrawn, pending further discussion
in the WG.  A Task Force created from within the WG has investigated a range of
issues and options for implementing the desired functionality, as called for in
the <bibref ref='ref-xsreq'/>.  The Task Force has produced a
report <bibref ref='ref-refine-tf'/>, which will form the basis of a design to be filled in here.</p>
</note>
<div3>
 <head>Graveyard for stale syntax, here to avoid breaking IDREFs
elsewhere *</head>
<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>
<termdef id='key-effective' term='effective'>The <term>effective</term>
constraints are the union of the explicit and the acquired</termdef>.</p></div3>
</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 xml:space='preserve'><pt>NCName</pt> <nt def='nt-entitySpec'>entitySpec</nt></rhs>
</prod>
<prod id='nt-entitySpec'>
<lhs>entitySpec</lhs>
<rhs xml:space='preserve'>( <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 xml:space='preserve'><nt def='nt-systemID'>systemID</nt> <nt def='nt-publicID'>publicID</nt>?
exportControl?</rhs>
</prod>
<prod id='nt-unparsedEntitySpec'>
<lhs>unparsedEntitySpec</lhs>
<rhs xml:space='preserve'><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 xml:space='preserve'><pt>NCName</pt> <nt def='nt-schemaRef'>schemaRef</nt>?</rhs>
</prod>
<prod id='nt-notationDecl'>
<lhs>notationDecl</lhs>
<rhs xml:space='preserve'><pt>NCName</pt> <nt def='nt-notationSpec'>notationSpec</nt></rhs>
</prod>
<prod id='nt-notationSpec'>
<lhs>notationSpec</lhs>
<rhs xml:space='preserve'><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 xml:space='preserve'><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>

<e:element-syntax name='textEntity'>
 <e:in-category name='top-level'/>
 <e:attribute name='export' required='yes'>
  <e:constant value='true'/>
  <e:constant value='false'/>
 </e:attribute>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:text/>
</e:element-syntax>
<note>
<eg xml:space='preserve'>
&lt;textEntity name='flavor'&gt;Fresh mint&lt;/textEntity'&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>

<e:element-syntax name='externalEntity'>
 <e:in-category name='top-level'/>
 <e:attribute name='export' required='yes'>
  <e:constant value='true'/>
  <e:constant value='false'/>
 </e:attribute>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='notation' required='yes'>
  <e:constant value='XML'/>
 </e:attribute>
 <e:attribute name='public'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='system' required='yes'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:empty/>
</e:element-syntax><note>
<eg xml:space='preserve'>
&lt;externalEntity name='FrontMatter'
                system='FrontMatter.xml' /&gt;
&lt;externalEntity name='Chapter1'
                system='chapter1.xml' /&gt;
&lt;externalEntity name='Chapter2'
                system='Chapter2.xml' /&gt;
&lt;externalEntity name='BackMatter'
                system='BackMatter.xml' /&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>
<e:element-syntax name='unparsedEntity'>
 <e:in-category name='top-level'/>
 <e:attribute name='export' required='yes'>
  <e:constant value='true'/>
  <e:constant value='false'/>
 </e:attribute>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='notation' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='public'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='system' required='yes'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:empty/>
</e:element-syntax>
<note>
<eg xml:space='preserve'>
&lt;unparsedEntity name='SKU-5782-pic'
                system='http://www.vendor.com/SKU-5782.jpg'
                notation='JPEG' /&gt;</eg>
<eg xml:space='preserve'>
&lt;picture location='SKU-5782-pic'/&gt;
</eg>
<p>The picture element carries an attribute which is (presumably) governed by
the unparsed entity declaration.</p>

</note>
<p>The <specref ref='svc-attr-entity'/> <termref def='gloss-svc'>Schema Validity Constraint</termref> obtains.</p>
<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>
<e:element-syntax name='notation'>
 <e:in-category name='top-level'/>
 <e:attribute name='export' required='yes'>
  <e:constant value='true'/>
  <e:constant value='false'/>
 </e:attribute>
 <e:attribute name='name' required='yes'>
  <e:data-type name='NMTOKEN'/>
 </e:attribute>
 <e:attribute name='public' required='yes'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:attribute name='system'>
  <e:data-type name='CDATA'/>
 </e:attribute>
 <e:empty/>
</e:element-syntax>
<note>
<eg xml:space='preserve'>
&lt;notation name='jpeg'
          public='image/jpeg' system='viewer.exe' /&gt;

&lt;element name='picture&gt;
 &lt;archetype&gt;
  &lt;attribute name='entity' type='NOTATION'/&gt;
 &lt;/archetype&gt;
&lt;/element&gt;
</eg>
<eg xml:space='preserve'>
&lt;picture entity='SKU-5782-pic'/&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>
<div2>
<head>Introduction and TF report summary *</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>'Namespaces in XML' <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 'markup vocabulary') 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 'collisions' occurring when markup
intended for some other software package uses the same element 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>
<p>The balance of this section as it appeared in the previous public WD has been withdrawn, pending further discussion
in the WG.  A Task Force created from within the WG has investigated a range of
issues and options for implementing the desired functionality.  The Task Force has produced a
report <bibref ref='ref-schema-comp-tf'/>, which will form the basis of a design to be filled in here.</p>
 <ednote>
  <edtext>I've chosen to include here a brief summary of the
expected TF report, addressing the instance->schema connection issue, on the
grounds that confusion is rampant in the rest of the world wrt this issue, and
we will benefit both ourselves and others by signalling our thinking here as
soon as possible.</edtext>
 </ednote>
<p>The TF report recommends a layered approach, where the base layer
simply addresses the process of schema validation where the element
information item to be validated and the schema to validate it with
are known.  The second layer discusses mechanisms by which
processors may locate schemas, but emphasises that this is always in 
the end an processor- and environment-dependent process.  The following candidate
mechanisms are identified:
<ulist>
<item><p>The namespace URI of the item to be validated is dereferenced and yields
 a schema;</p></item>
<item><p>The namespace URI of the item to be validated is dereferenced
and yields a package.  A standard property
of the package tells what kind of package it is and hence how
to go about getting schema info out of it.  We anticipate a great range of
flexibility in the structuring and content of packages: schemas will certainly
not be the only thing in them.  All that matters to us is that we can get a schema
<emph>out</emph> of them;</p></item>
<item><p>A URI is provided via a pre-defined attribute from the XML Schema
namespace, which is dereferenced and yields a schema (or a package);</p></item>
<item><p>The namespace URI of the item to be validated is looked up via a
catalogue or other binding mechanism, either locally or remotely, and yields a
schema (or a package).</p></item></ulist>
</p>
 <issue id='schema-search-ordered'>
  <p>It is worth noting that the TF has not reached consensus on whether the
above list should be understood as ordered, that is, in the case where more
than one is viable, should we identify a precedence.</p>
 </issue>
</div2>
<div2>
  <head>Graveyard for stale syntax, here to avoid breaking IDREFs
elsewhere *</head>
<div3 id='composition-schemaExport'>
<head>Exporting Schema Constructs</head>

<scrap lang='ebnf' id='RuleSet.XS16'>

<head>Export</head>
<prod id='nt-export'>
<lhs>export</lhs>
<rhs><nt def='nt-allDatatypes'>allDatatypes</nt>? <nt def='nt-allArchetypes'>allArchetypes</nt>? <nt def='nt-allElementTypes'>allElements</nt>? <nt def='nt-allModelGroups'>allModelGroups</nt>? <nt def='nt-allAttributeGroups'>allAttributeGroups</nt>? <nt def='nt-allEntities'>allEntities</nt>? <nt def='nt-allNotations'>allNotations</nt>?</rhs>
</prod>
<prod id='nt-allDatatypes'>
<lhs>allDatatypes</lhs>
<rhs><pt>boolean</pt></rhs>
</prod>
<prod id='nt-allArchetypes'>
<lhs>allArchetypes</lhs>
<rhs><pt>boolean</pt></rhs>
</prod>
<prod id='nt-allElementTypes'>
<lhs>allElements</lhs>
<rhs><pt>boolean</pt></rhs>
</prod>
<prod id='nt-allModelGroups'>
<lhs>allModelGroups</lhs>
<rhs><pt>boolean</pt></rhs>
</prod>
<prod id='nt-allAttributeGroups'>
<lhs>allAttributeGroups</lhs>
<rhs><pt>boolean</pt></rhs>
</prod>
<prod id='nt-allEntities'>
<lhs>allEntities</lhs>
<rhs><pt>boolean</pt></rhs>
</prod>
<prod id='nt-allNotations'>
<lhs>allNotations</lhs>
<rhs><pt>boolean</pt></rhs>
</prod>
<prod id='nt-exportControl' role='prefig'>
<lhs>exportControl</lhs>
<rhs xml:space='preserve'><pt>boolean</pt> </rhs>
</prod></scrap>
</div3>
<div3 id='composition-schemaImport'>
<head>Schema Import</head>
<scrap lang='ebnf' id='RuleSet.XS18'>

<head>Import</head>
<prod id='nt-import'>
<lhs>import</lhs>
<rhs xml:space='preserve'><nt def='nt-schemaAbbrev'>schemaAbbrev</nt> <nt def='nt-schemaName'>schemaName</nt> <nt def='nt-importRestrictions'>importRestrictions</nt>? </rhs>
</prod>

</scrap></div3>
<div3 id='composition-importRestrictions'>
<head>Import Restrictions</head>
<scrap lang='ebnf' id='RuleSet.XS19'>

<head>Import restrictions</head>
<prod id='nt-importRestrictions'>
<lhs>importRestrictions</lhs>
<rhs xml:space='preserve'><nt def='nt-allDatatypes'>allDatatypes</nt>? <nt def='nt-allArchetypes'>allArchetypes</nt>? <nt def='nt-allElementTypes'>allElements</nt>? <nt def='nt-allModelGroups'>allModelGroups</nt>? <nt def='nt-allAttributeGroups'>allAttributeGroups</nt>? <nt def='nt-allEntities'>allEntities</nt>? <nt def='nt-allNotations'>allNotations</nt>? <nt def='nt-component'>component</nt>*</rhs>
</prod>
 <prod id='nt-component'>
  <lhs>component</lhs>
  <rhs xml:space='preserve'><nt def='nt-componentName'>componentName</nt> <nt def='nt-componentType'>componentType</nt></rhs>
 </prod>
 <prod id='nt-componentName'>
  <lhs>componentName</lhs>
  <rhs><pt>NCName</pt></rhs>
 </prod>
 <prod id='nt-componentType'>
  <lhs>componentType</lhs>
  <rhs xml:space='preserve'><pt>datatype</pt> | <pt>archetype</pt> |
<pt>element</pt> | <pt>attrGroup</pt> | <pt>modelGroup</pt> | <pt>entity</pt> | <pt>notation</pt></rhs>
 </prod>

</scrap></div3>
<div3 id='composition-schemaInclude'>
<head>Schema Inclusion</head>
<scrap lang='ebnf' id='RuleSet.XS20'>

<head>Include</head>
<prod id='nt-include'>
<lhs>include</lhs>
<rhs xml:space='preserve'><nt def='nt-schemaRef'>schemaRef</nt> <nt def='nt-allDatatypes'>allDatatypes</nt>? <nt def='nt-allArchetypes'>allArchetypes</nt>? <nt def='nt-allElementTypes'>allElements</nt>? <nt def='nt-allModelGroups'>allModelGroups</nt>? <nt def='nt-allAttributeGroups'>allAttributeGroups</nt>? <nt def='nt-allEntities'>allEntities</nt>? <nt def='nt-allNotations'>allNotations</nt>? <nt def='nt-component'>component</nt>*</rhs>
</prod>

</scrap>
</div3>
<div3 id='composition-instances'>
<head>Associating Instance Document Constructs with Corresponding Schemas
</head>
</div3>
 </div2>
</div1>
<div1 id='doc'>
<head>Documenting schemas *</head>
<note>
<p>Documentation facilities have purposely been left out of this draft of the
XML Schema Definition Language specification. The editors chose to concentrate
on other topics. It is anticipated that explanation elements will be provided
for within any of the Schema elements. Their purpose is to encapsulate
documentation for the elements within which they are contained. Elements for
narrative exposition at the top level of a schema have also been proposed.</p>
</note>
<p>Proposals for XML Schema documentation include defining a custom set of
elements, allowing any content at all, allowing all or part of
<bibref ref='ref-html-4'/>, DocBook or TEI. There are good arguments for each
of these proposals.</p>
<p>The Working Group must identify its requirements and constraints.</p>
</div1>
<div1 id='conformance'>
<head>Conformance -- OUT OF DATE *</head>
<issue id='error-behavior'>
<p> This draft includes extensive discussion of conformance and validity
checking, but rules for dealing with errors are missing. In future, we must
distinguish <termref def='key-error'>error</termref>s from
<termref def='key-fatalError'>fatal error</termref>s, and clarify rules for
dealing with both.</p>
</issue>
<div2 id='conformance-schemaValidity'>
<head>Schema Validity *</head>
<note><p>This section is <emph>not</emph> up to date or in sync with
the rest of the document, but is included
here to avoid breaking huge numbers of references</p></note>
<p>We approach the definition of schema validity one step at a time. In the
definitions below we deal primarily in terms of information sets, rather than
the documents which give rise to them: see <bibref ref='ref-xmlinfo'/> for
definitions of <pt>item</pt>, <pt>RUE</pt> and <pt>information set</pt>.)
Please note that the formal definitions below are explicitly <emph>not</emph>
couched in processing terms: they describe properties of an information set,
but do <emph>not</emph> tell you how to check an information set to see if it
has those properties.</p>
<p>First we have to get to the schema(s) involved. This is slightly tricky, as
not all namespace declarations will resolve to schemas, and not everything that
purports to be a schema will be one.</p>
<p><termdef id='key-nominate' term='nominate'>A URI is said to
<term>nominate</term> a schema if it resolves to an element item in the
information set of a well-formed XML 1.0 document whose local name is
<code>schema</code> and whose namespace item's URI identifies either
</termdef></p>
<p>
<ulist>
<item>
<p>this specification or one of its successors,</p>
</item>
<item>
<p>the XML Schema 1.0 DTD (or the equivalent DTD from a successor to this
specification)</p>
</item>
</ulist> or
<ulist>
<item>
<p>The XML Schema 1.0 schema (or the equivalent schema from a successor to this
specification).</p>
</item>
</ulist></p>
<p><termdef id='key-suc-res' term='resolve successfully'>A URI is said to
<term>resolve successfully</term> to a schema if it <termref def='key-nominate'>nominates</termref> a schema, and the element item it
resolves to represents an XML schema, that is: </termdef></p>
<p>
<ulist>
<item>
<p>If it were the document element item of an information set corresponding to
an XML document whose DOCTYPE identified the XML Schema 1.0 DTD (or the
equivalent DTD from a successor to this specification) as its DTD, that
document would be valid per XML 1.0; </p>
</item>
<item>
<p>it and its descendants satisfy all <termref def='gloss-cos'>Constraints on
Schemas</termref> stated in this specification. </p>
</item>
</ulist></p>
<p><termdef id='key-schema-ready' term='schema-ready'>An element item is
<term>schema-ready</term> if the URI of any of its namespace declaration items
which <termref def='key-nominate'>nominates</termref> a schema
<termref def='key-suc-res'>resolves successfully</termref> to a
schema.</termdef></p>
<issue id='namespace-declaration-items'>
<p>Namespace items associated with namespace declarations have disappeared from
the most recent version <bibref ref='ref-xmlinfo'/>. Several WGs need them, we
expect they'll be back, otherwise we can reconstruct what we need from
element and attribute namespace items alone with some effort.</p>
</issue>
<p><termdef id='key-doc-schema-ready' term='schema-ready'>A document is
<term>schema-ready</term> if every element item anywhere in its information set
is <termref def='key-schema-ready'>schema-ready</termref>.</termdef></p>
<p>Note that this means that documents with <emph>no</emph> namespace
declarations, or only namespace declarations which do not
<termref def='key-nominate'> nominate</termref> schemas are none-the-less
<termref def='key-doc-schema-ready'>schema-ready</termref>.</p>
<p><termdef id='key-schema-governed' term='schema-governed'>We say an element
item is <term>schema-governed</term> if its name is in a namespace, and the URI
of the information item for that namespace <termref def='key-suc-res'>resolves
successfully</termref> to a schema.</termdef></p>
<p><termdef id='key-schema-root' term='schema root'>We use the name
<term>schema root</term> for any element item which is
<termref def='key-schema-governed'>schema-governed</termref> and which is
either</termdef>
<ulist>
<item>
<p>the document element</p>
</item>
</ulist> or
<ulist>
<item>
<p>the daughter of an element which is <emph>not</emph>
<termref def='key-schema-governed'>schema-governed</termref>.</p>
</item>
</ulist> </p>
<p>The provision within &XSP1; of a mechanism for defining
<termref def='gloss-parsedEntity'>parsed entities</termref> presents problems
for the relationship between schema-validity and XML 1.0 well-formedness, since
references to entities declared only in a schema are undefined from the XML 1.0
perspective. Strictly speaking, a well-formed XML document may contain
references to undefined entities only if it is declared as
<code>standalone='no'</code> and contains either an external subset
or one or more references to external parameter entities in their internal
subset. We get around this by <termdef id='key-nearly-wf' term='nearly wel