<?xml version='1.0'?>
<?xml:stylesheet type='text/xsl' href='xmlschema.msxsl'?>
<!-- $Id: structures.xml,v 1.1 2015/01/05 06:37:41 denis Exp $ -->
<!DOCTYPE spec PUBLIC "-//HST//DTD Specification::19990423//EN" "xmlspec-19990429.dtd" [
   <!ENTITY % versionEntities SYSTEM "versionInfo.ent">
   %versionEntities; <!-- get path and date entities -->
   <!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 doc.date "&draft.day; &draft.month; &draft.year;">
   <!ENTITY w3c.doc.date "&draft.day;-&draft.month;-&draft.year;">
   <!ENTITY iso.doc.date "&draft.YY;&draft.MM;&draft.DD;">
   <!ENTITY XSP1.version "0.8">
   <!ENTITY doc.audience "WG-internal review.">
   <!ENTITY doc.distribution "Schema IG">

   <!ENTITY eacute "&#233;" > <!-- small e, acute accent -->

 ]>
<spec>
  <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;<!-- (Point release id: <code>$Id: structures.xml,v 1.1 2015/01/05 06:37:41 denis Exp $</code>)--></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="&XSP1.base;/xmlspec-19990429.dtd">DTD</loc>, <loc href="&XSP1.base;/xmlschema.xsl">XSL
stylesheet</loc> (Nov REC version)
and <loc href="&XSP1.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;/">&XSP1.base;/</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/TR/1999/WD-xmlschema-1-19991105/">http://www.w3.org/TR/1999/WD-xmlschema-1-19991105/</loc>
    <loc href="http://www.w3.org/TR/1999/WD-xmlschema-1-19990924/">http://www.w3.org/TR/1999/WD-xmlschema-1-19990924/</loc>
     <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 Corp.</affiliation>
      <email href="mailto: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 Development Corporation</affiliation>
      <email href="mailto:Noah_Mendelsohn@lotus.com">Noah_Mendelsohn@lotus.com</email>
     </author>
    </authlist>
    <status>
<p>This is a public working draft of XML Schema 1.0 for review by the
public and by members of the World Wide Web Consortium.
</p><p>
It has been reviewed by the XML Schema Working Group, and the Working
Group has agreed to its publication.  The WG believes this draft to be
`feature-complete': the functionality included here is substantially
complete and is expected to be stable.  We do not expect to add major
new functionality, or to make major changes to the functionality
described in this draft.  Some sections of the draft (in particular
those on conformance), and some aspects of the design (in particular
details of the transfer syntax for schemas), on the other hand, are
still rough and are expected to be revised.
</p><p>
The WG expects to spend January, 2000, working out details, clarifying
points of uncertainty that arise in the review of this draft, cleaning
up inconsistencies, reviewing the design of the concrete transfer
syntax, and making editorial improvements.
</p><p>
Following that period of review and polishing, it is the WG's intent
to issue a Last Call for Review by other W3C working groups sometime
during February, 2000, and to submit this specification in March,
2000, for publication as a Candidate Recommendation.  This schedule
may vary, depending on the comments of the public and of other W3C
working groups on this draft.  Such comments are instrumental in the
WG's deliberations, and we encourage readers to review the draft 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>
Although the Working Group does not anticipate further substantial
changes to the functionality described here, this is still a working
draft, subject to change based on experience and on comment by the
public and other W3C working groups.  The present version should
be implemented only by those interested in providing a check on
its design or by those preparing for an implementation of the
Candidate Recommendation.  <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-05: HST: Abandoned this method of logging
changes:  see CVS change log at the end of the document</sitem>
       <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
simple and complex types, elements, content models, attributes, attribute
groups, model groups and inheritance.</p>
      <p>Chapter 4 presents <specref ref="composition"/>, including the
        validation of namespace qualified instance documents, import and inclusion of declarations and definitions, access to schemas, and
        the foundations of schema-validity.</p>
      <p>Chapter 5 describes provision 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>

        <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 from the editors to themselves or the Working Gorup.</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. 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 Schema: Datatypes</label>
          <def>
            <p>&XSP1; has a dependency on the mechanisms for defining simple types provided in
              its companion <bibref ref="ref-xsp2"/>, published simultaneously with this
              document.   Together these two documents constitute the XML
Schema 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 been requested to support modularization of (X)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
                (W3C Member only)</loc> </p>
          </def>
        </gitem>
        <gitem>
          <label>RDF Schema </label>
          <def>
            <p>&XSP1; has not yet documented requirements or dependencies.  See
<bibref ref="bib-camb-comm"/> for a clarification of the relationship between
the two, which includes requirements arising from web architecture considerations.</p>
          </def>
        </gitem>
        <gitem>
          <label>WAI </label>
          <def>
            <p>&XSP1; has a requirement to support accessibility. </p>
          </def>
        </gitem>
        <gitem>
          <label>XML Information Set </label>
          <def>
            <p>&XSP1; has significant dependencies on
              <bibref ref="ref-xmlinfo"/>.</p>
            <p>&XSP1; defines its own <termref def="gloss-sic">Information Set
              Contributions</termref> which are compatible with <bibref ref="ref-xmlinfo"/> although not defined as such therein.</p>
          </def>
        </gitem>
        <gitem>
          <label>XML Linking WG </label>
          <def>
            <p><specref ref="declare-key"/> uses XPath expressions, as defined
in <bibref ref="bib-xpath"/>. </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>The XSL Working Group has requested &XSP1; to support dimensions and aggregate
              datatypes: not discharged in this WD.</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)
              <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 declarations 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 the <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>
    </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 post-validation 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 numeral sequences representing 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 itself defines an XML form for itself in terms 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" xmlns="http://www.myco.com/MYPO">
    <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 simple types defined in <bibref ref="ref-xsp2"/>, but some are complex. We use the <code>type</code> element
when declaring elements which allow elements in their content and/or may carry attributes. For example, we can define a type called <code>Address</code> as follows:
</p>
 <note role="example"><eg xml:space="preserve"><![CDATA[<type 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="integer" />
    <attribute name="type" type="string" />
</type>]]></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 an integer.
</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[<type name="PurchaseOrderType">
    <element name="shipTo"    type="po:Address" />
    <element name="shipDate"  type="date" />
    <element ref="po:comment" minOccurs="0" />
    <element name="Items"     type="po:Items" />
    <attribute name="orderDate" type="date" />
</type>]]></eg><p>The <code>shipDate</code> element daughter of
<code>PurchaseOrderType</code> is declared
above as having a simple type, as in the
<code>Address</code> example above.  The <code>comment</code> daughter is
declared by reference to a global element declaration.  Since this definition is in the
namespace being defined, and apparently the default namespace is being used for
the schema elements themselves (e.g. <code>element</code>,
<code>attribute</code>), we use a prefix (<code>po</code>) on this reference
which would have to be declared with the same URI as the target namespace URI
for the containing schema.  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 simple and complex types, 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
simple or a complex type, and there are separate symbol spaces for these two, the
possibility of ambiguity arises.  This is resolved in favour of the complex
type, e.g. even if a simple type called <code>Address</code> existed (either
builtin or user-defined), the above declaration for <code>shipTo</code> would
refer to the user-defined complex type of that name.</p> 
     <issue id="note-two-sses">
      <p>The separation of the simple and complex type name symbol spaces is
primarily motivated by the decision to allow unqualified reference to the <emph>ab
initio</emph> and built-in simple types.  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 simple type by a new
complex type would be removed.</p>
     </issue>
 <p>
<termdef term="definition" id="nt-definition">A <term>definition</term> creates a new type</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 a
type, 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 simple type:
</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 a complex <emph>or</emph> a simple type (in which
case no attributes are allowed):
</p>
 <note role="example"><eg xml:space="preserve"><![CDATA[<element name="shipTo" type="po: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 type 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[<type name="Items">
 <element name="Item" minOccurs="0" maxOccurs="*">
  <type>
   <element name="productName" type="string" />
   <element name="quantity">
    <datatype source="integer">
     <minExclusive value="0"/>
    </datatype>
   </element>
   <element name="price" type="decimal" />
   <element ref="po:comment" minOccurs="0" />
   <attribute name="pno" type="string"/>
  </type>
 </element>
</type>]]></eg>
      <p>Here not only is the type of the <code>Item</code> element given
in line, but also the simple type of its
<code>quantity</code> daughter (the built-in simple type <code>integer</code>) is 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><termdef id="key-component" term="schema component">Schemas are composed of: <term>schema components</term>: a set of type
definitions, attribute group definitions, model group definitions, element
declarations, and attribute declarations</termdef>. Note that it is the
abstract idea of a component we are talking about here, along with its name:
an XML element such as <code>&lt;element&gt;</code> is a standardized representation
for a component, not the component itself.</p>
      <p>The next chapter <specref ref="declare"/> sets out the &XSP1; approach
        to schemas, with formal definitions of their component parts and
presentations of standardized representations for each of them. Here we informally
        summarize the key constructs used in defining schemas. A 'Yes' in the
        'Name appears 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"> A simple 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 simple types 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-type"/> </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 simple type. The
              association is local to its surrounding type.</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
              simple type 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. May include specifications of grouping and sequencing.</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-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-refinement"/> </td>
            <td align="left" valign="top" rowspan="1" colspan="1"> One
              type may be defined as based on another type, 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"> 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>
         <tr>
          <td align="left" valign="top" rowspan="1" colspan="1"><specref ref="declare-key"/> </td>
          <td align="left" valign="top" rowspan="1" colspan="1">Provide more
powerful uniqueness and intra-document reference mechanisms </td>
          <td align="left" valign="top" rowspan="1" colspan="1"> Yes </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 type, 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 type 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 the term defined in <bibref ref="ref-xml-namespaces"/>).</termdef>  A <termref def="key-symbolSpace">symbol space</termref> is similar to the non-normative concept of <xtermref href="http://www.w3.org/TR/REC-xml-names/#ns-breakdown">namespace partition</xtermref> introduced in <bibref ref="ref-xml-namespaces"/>.</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 type 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 a type definition) reside in 
        their own symbol space.
        </p>
    </div2>
   <div2 id="ref-schema">
    <head>Referencing Schema Components</head>
    <p>The names of schema components such as type definitions and element
declarations are not of type <code>ID</code>, as explained above:  they are not
unique within a schema, just within a symbol space.  This means that simple
fragment identifiers will not work to reference schema components.</p>
    <p>In the long run we expect to provide some mechanism suitable for referencing the
semantic components of schemas as such.  In the mean time, we observe that
<bibref ref="ref-xpointer"/> provides a mechanism which maps well onto our
notion of symbol spaces.  An fragment identifier of the form
<code>#xpointer(schema/element[@name="person"])</code> will uniquely identify
the element declaration with name <code>person</code>, and similar fragment
identifiers can obviously be constructed for the other top-level symbol spaces.</p>
   </div2>
<div2 id="comp-tns">
<head>Association of components with a target namespace </head>
<p>Every element and attribute declaration is associated with a target
namespace URI, or with no namespace. More specifically, each symbol space is
associated directly (in the case of global declarations) or indirectly (in the
case of local declarations) with a target namespace or with no namespace. So,
the name of each global declaration is effectively qualified by the target
namespace in which it is defined. Locally scoped element and attribute
declarations are named in a symbol space defined by their containing type
definition.</p>
<p>Global element and attribute declarations are used to validate instance
document constructs in the namespace identified by the URI of the target
namespace for the corresponding declaration. Declarations with a null target
namespace validate non-namespace qualified instance document constructs.</p>
   <div3 id="def-tns">
<head>Association of definitions with a target namespace </head>
<p>The XML namespaces recommendation discusses only instance document syntax for
elements and attributes; it therefore provides no direct framework for managing
the names of types, attribute groups, and other facilities provided by XML
schemas. Nevertheless, we apply the target namespace facility uniformly to all
schema components. Specifically, the target namespace qualifies the symbol space
for definitions as well as for declarations.</p>
</div3>
<div3 id="tns-decl">
<head>Providing a target namespace for definitions and declarations </head>
<p>The above discussion requires that each global definition and
declaration be associated with a target namespace. The standard
XML format for schema definitions provides a <code>"targetNamespace"</code> attribute for the
<code>&lt;schema&gt;</code> element. </p>
<eg xml:space="preserve">    &lt;schema targetNamespace="someNSURI"&gt;
      ...every global declaration &amp; def'n here...
      ...is in targetNamespace
    &lt;/schema&gt;
</eg>
<p>If specified, this supplies the same target namespace for all the definitions
and declarations contained within that schema element.  If absent, it indicates that all the definitions and declarations have a null target namespace.</p>
</div3>
</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>

<ednote><edtext> possible changes to the definition of what of schema is, to
reflect a our discussion of layering.</edtext></ednote>

    <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-annotation">annotation</nt> | <nt def="nt-datatypeDefn">datatypeDefn</nt> |
            <nt def="nt-typeDefn">typeDefn</nt> | <nt def="nt-elementDecl">elementDecl</nt> | <nt def="nt-attributeGroupDefn">attributeGroupDefn</nt> | <nt def="nt-notationDecl">notationDecl</nt> | <nt def="nt-include">include</nt>| <nt def="nt-import">import</nt> | <nt def="nt-generalConstraint">generalConstraint</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-finalDefault">finalDefault</nt>? <nt def="nt-exactDefault">exactDefault</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-finalDefault">
<lhs>finalDefault</lhs>
<rhs xml:space="preserve"><pt>extension</pt>?
<pt>restriction</pt>?</rhs>
</prod>
       <prod id="nt-exactDefault">
<lhs>exactDefault</lhs>
<rhs xml:space="preserve"><pt>extension</pt>?
<pt>restriction</pt>? <pt>equivClass</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><nt def="nt-finalDefault">finalDefault</nt> and <nt def="nt-exactDefault">exactDefault</nt> provide defaults for <nt def="nt-final">final</nt> and <nt def="nt-exact">exact</nt> respectively for type definitions and element declarations.  The default for <emph>these</emph> properties is empty in both cases.</p>
     <p>See <specref ref="composition"/> for discussion of schemas, instances
and namespaces, and also for <nt def="nt-import">import</nt> and <nt def="nt-include">include</nt>.</p>


      <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="&XMLSchemaNS;"&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 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-typeDefn2" role="prefig">
        <lhs>typeDefn</lhs>
        <rhs xml:space="preserve"><pt>NCName</pt> <nt def="nt-typeSpec">typeSpec</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-attrDecl2" role="prefig">
<lhs>attribute</lhs>
<rhs xml:space="preserve"><pt>NCName</pt> <nt def="nt-attrSpec">attributeSpec</nt></rhs>
</prod>
      <prod id="nt-attributeGroupDefn2" role="prefig">
        <lhs>attributeGroupDefn</lhs>
        <rhs xml:space="preserve"><pt>NCName</pt> <nt def="nt-attrsSpec">attributesSpec</nt> </rhs>
      </prod>
      <prod id="nt-notationDecl2" role="prefig">
        <lhs>notationDecl</lhs>
        <rhs><pt>NCName</pt> <nt def="nt-notationSpec">notationSpec</nt> </rhs>
      </prod>
    </scrap>

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

 &lt;type name="myType"&gt;
  ...
 &lt;/type&gt;

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

 &lt;attributeGroup name="myAttrGroup"&gt;
  ...
 &lt;/attributeGroup&gt;

 &lt;group name="myModelGroup"&gt;
  ...
 &lt;/group&gt;

 &lt;notation name="myNotation" ... /&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>
<ednote><edtext> make sure that discussion of targetNamespace is up-to-date.</edtext></ednote>

  <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 a
    <termref def="gloss-QName">QName</termref>. In a few
    cases, some elaboration 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-datatypeRef2" role="prefig">
      <lhs>datatypeRef</lhs>
      <rhs xml:space="preserve"><nt def="nt-datatypeName">datatypeName</nt></rhs>
    </prod>
    <prod id="nt-datatypeName2" role="prefig">
      <lhs>datatypeName</lhs>
      <rhs xml:space="preserve"><pt>QName</pt></rhs>
    </prod>
    <prod id="nt-typeRef2" role="prefig">
      <lhs>typeRef</lhs>
      <rhs><nt def="nt-typeName">typeName</nt></rhs>
    </prod>
    <prod id="nt-typeName2" role="prefig">
      <lhs>typeName</lhs>
      <rhs xml:space="preserve"><pt>QName</pt></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>QName</pt></rhs>
    </prod>
    <prod id="nt-attributeGroupRef2" role="prefig">
      <lhs>attributeGroupRef</lhs>
      <rhs xml:space="preserve"><nt def="nt-attributeGroupName">attributeGroupName</nt></rhs>
    </prod>
    <prod id="nt-attributeGroupName2" role="prefig">
      <lhs>attributeGroupName</lhs>
      <rhs xml:space="preserve"><pt>QName</pt></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>QName</pt></rhs>
    </prod>
    <prod id="nt-notationRef2" role="prefig">
      <lhs>notationRef</lhs>
      <rhs><nt def="nt-notationName">notationName</nt></rhs>
    </prod>
    <prod id="nt-notationName2" role="prefig">
      <lhs>notationName</lhs>
      <rhs><pt>QName</pt></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 name="elem1" type="Address"/&gt;

&lt;element name="elem2" type="XHTML:BLOCKQUOTE"/&gt;

&lt;attribute name="attr1"
              type="xsl:quantity"/&gt;
</eg>
    <p>The first of these is a local reference, the other two refer to schemas
      elsewhere and assume that the prefixes used have been declared and their namespaces 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 <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="key-typeDefn" term="type definition">We call a set of
<termref def="SC">SC</termref>s intended for use in this way a
<term>type definition</term>.</termdef></p>
<p>  <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>Simple Type Definition</head>
  <p>We start with the simple types
whose expression in XML documents consists entirely of character data.</p>

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

    <head>Simple Types</head>
    <prod id="nt-datatypeDefn">
      <lhs>simpleTypeDefn</lhs>
      <rhs xml:space="preserve"><pt>NCName</pt> <nt def="nt-datatypeSpec">simpleTypeSpec</nt> </rhs>
    </prod>
    <prod id="nt-datatypeSpec">
      <lhs>simpleTypeSpec</lhs>
      <rhs xml:space="preserve"><nt def="nt-datatypeRef">simpleTypeRef</nt> <nt def="nt-facet">facet</nt>* <nt def="nt-final">final</nt>? <pt>abstract</pt>?</rhs>
    </prod>
   <prod id="nt-facet">
  <lhs>facet</lhs>
  <rhs><com>is defined by &XSP2;.  It might be a range restriction, min/max
constraint, etc.</com></rhs>
 </prod>
    <prod id="nt-datatypeRef">
      <lhs>simpleTypeRef</lhs>
      <rhs xml:space="preserve"><nt def="nt-datatypeName">simpleTypeName</nt></rhs>
    </prod>
    <prod id="nt-datatypeName">
      <lhs>simpleTypeName</lhs>
      <rhs xml:space="preserve"><pt>QName</pt> </rhs>
    </prod>

  </scrap>

  <p>&XSP1; incorporates the simple type 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-facet">facet</nt> above serves to indicate where this
    chapter connects with &XSP2;.  The concrete syntax
displayed below is copied from <bibref ref="ref-xsp2"/>.  All facets are optional and may appear in any order
within the <code>datatype</code> element.  The <nt def="nt-datatypeRef">simpleTypeRef</nt> in the <nt def="nt-datatypeSpec">simpleTypeSpec</nt> identifies the simple type on which the
one being defined is based:  infinite regress is avoided because &XSP2;
provides a set of built-in <emph>ab initio</emph> simple types.</p>
  <p>The other productions provide for using simple types once they have been
    defined, see below under <nt def="nt-typeDefn">typeDefn</nt> and
    <nt def="nt-attrDecl">attribute</nt>.</p>
  <p>As explained in <specref ref="refSchemaConstructs"/>, the use of <termref def="gloss-QName">QName</termref> allows for the referenced
definition to be located in some other schema.</p>
 <p>An <pt>abstract</pt> type cannot itself be used as the type of an attribute
or element.</p>
 <p>A simple type definition can rule itself out as the source of type
derivations, by declaring itself <nt def="nt-final">final</nt>.</p>
  <note role="example">
    <eg xml:space="preserve"><![CDATA[<datatype name="posInt" source="integer"/>
 <minExclusive value="0"/>
</datatype>

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

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

<attribute name="fontSize" type="xsl:quantity"
           fixed="12pt"/>]]></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-type">
<head>Complex Type Definition</head>
 <p>We now move on to <termdef id="type" term="complex type">the <term>complex type</term>s
whose expression in XML documents consists of elements with attributes and/or
element content.</termdef></p>

<scrap lang="ebnf" id="RuleSet.XS6">

  <head>Types</head>
 <prod id="nt-typeDefn">
  <lhs>complexTypeDefn</lhs>
  <rhs xml:space="preserve"><pt>NCName</pt> <nt def="nt-typeSpec">complexTypeSpec</nt></rhs>
 </prod>
  <prod id="nt-typeSpec">
    <lhs>complexTypeSpec</lhs>
    <rhs xml:space="preserve"><nt def="nt-contentType">contentType</nt> <nt def="nt-attrsSpec">attributesSpec</nt>? <nt def="nt-final">final</nt> <nt def="nt-exact">exact</nt> <pt>abstract</pt>?</rhs>
  </prod>
 <prod id="nt-attrsSpec">
  <lhs>attributesSpec</lhs>
  <rhs xml:space="preserve">( <nt def="nt-attrDecl">attribute</nt> |
      <nt def="nt-attributeGroupRef">attributeGroupRef</nt> )* <nt def="nt-anyAttr">attrWildcard</nt>?</rhs>
 </prod>
<prod id="nt-contentType2" role="prefig">
<lhs>[contentType</lhs>
<rhs xml:space="preserve"><nt def="nt-datatypeRef">simpleTypeRef</nt> | <nt def="nt-contentModel">contentModel</nt>]</rhs>
</prod>
  <prod id="nt-typeRef">
    <lhs>complexTypeRef</lhs>
    <rhs xml:space="preserve"><nt def="nt-typeName">complexTypeName</nt> </rhs>
  </prod>
  <prod id="nt-typeName">
    <lhs>complexTypeName</lhs>
    <rhs xml:space="preserve"><pt>QName</pt></rhs>
  </prod>

</scrap>

<p>The <nt def="nt-typeDefn">complexTypeDefn</nt> production and its descendants
provide for all the <termref def="SC">SC</termref>s which constitute a complex type
definition; the last two productions provide for reference to complex types once defined. But note
  that the name of a type 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 which constitute that type. The connection between an element
  name and a type is made by an <nt def="nt-elementDecl">elementDecl</nt>, see below. </p>
<p>Alongside <nt def="nt-attrsSpec">attributesSpec</nt> for permitted attributes,
  <termref def="SC">SC</termref>s for contents are specified by a <nt def="nt-contentType">contentType</nt>: for elements which may contain only
character data, this is a simple
type (via a <nt def="nt-datatypeRef">simpleTypeRef</nt>) or, for other kinds of
  elements, a <nt def="nt-contentModel">contentModel</nt>.  An
<pt>abstract</pt> type may not be used as the type in an <nt def="nt-elementDecl">elementDecl</nt>.  (See <specref ref="declare-openness"/> for a discussion of <nt def="nt-anyAttr">attrWildcard</nt>.  See
 <specref ref="declare-refinement"/> for the full details on <nt def="nt-contentType">contentType</nt>, of which the above is only a summary, as well as <nt def="nt-final">final</nt>, <nt def="nt-exact">exact</nt> and more on <pt>abstract</pt>.)</p>

<note role="example">
    <eg xml:space="preserve"><![CDATA[<type name="length1" type="decimal"/>
 <restrictions>
  <minInclusive value="0"/>
 </restrictions>
 <attribute name="unit" type="NMTOKEN"/>
</type>

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

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

<type name="length2">
 <element name="size">
  <datatype source="decimal">
   <minInclusive value="0"/>
  </datatype>
 </element>
 <element name="unit" type="NMTOKEN"/>
</type>

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

  <depth>
   <size>2.54</size><unit>cm</unit>
  </depth>]]>
</eg>
  <p>
    Two approaches to defining a type 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>Note that both the <nt def="nt-datatypeRef">datatypeRef</nt> and the <nt def="nt-typeRef">typeRef</nt> options in
the abstract syntax are realised by the <code>source</code> attribute on the
<code>type</code> element.  <code>source</code> must refer to a simple type
if <code>content</code> is <code>textonly</code>.  The contents of the <code>restrictions</code>
element will be quite different in the two cases, and if the
<code>source</code> refers to a  simple type, no content model is appropriate, so none
of <code>element</code>, <code>group</code> or <code>any</code> are allowed. 
The values other than <code>textonly</code> for <code>content</code> express
choices recorded in the abstract syntax in the <nt def="nt-contentModel">contentModel</nt> and
<nt def="nt-richModel">richModel</nt> productions below.</p>
 <p>Careful consideration of the above abstract and concrete syntax reveal that
a type need consist of no more than a name, i.e. that
 <code>&lt;type name="anything"/></code> is allowed.  See the discussion of the
<termref def="term-ur-type">ur-type</termref> in <specref ref="declare-refinement"/> for what such a type means.</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-type"/> <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 by referring to a (possibly restricted) simple type.  These <termref def="SC">SC</termref>s in turn will be part of the <termref def="SC">SC</termref>s of one or more types.  A default or fixed
value may be supplied, as well as an indication of whether the attribute is
optional or required.</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-attrSpec">attributeSpec</nt></rhs>
</prod>
 <prod id="nt-attrSpec">
  <lhs>attributeSpec</lhs>
  <rhs xml:space="preserve"> <nt def="nt-datatypeSpec">datatypeSpec</nt>
<nt def="nt-occurs">occurs</nt> <nt def="nt-valueConstraint">valueConstraint</nt>?</rhs>
 </prod>
    <prod id="nt-valueConstraint">
      <lhs>valueConstraint</lhs>
      <rhs xml:space="preserve"><pt>default</pt> | <pt>fixed</pt> </rhs>
    </prod>
<prod id="nt-datatypeSpec2" role="prefig">
<lhs>datatypeSpec</lhs><rhs xml:space="preserve"><nt def="nt-datatypeRef">datatypeRef</nt> <nt def="nt-facet">facet</nt>*</rhs>
</prod>
 <prod id="nt-occurs2" role="prefig">
<lhs>occurs</lhs>
<rhs xml:space="preserve"><pt>minOccurs</pt> <pt>maxOccurs</pt></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>QName</pt></rhs>
</prod>

</scrap>

<note>
<p>A number of productions are
repeated here for easy reference.</p>
</note>
<p>Attribute declarations provide for: </p>
<ulist>
<item>
<p>Requiring/preventing the appearance of attributes (the need to prevent an
attribute from appearing, by giving a value of <code>0</code> to
<pt>maxOccurs</pt>, will be clarified in <specref ref="declare-refinement"/>; </p>
</item>
<item>
<p>Constraining attribute values to express a datatype;</p>
</item>
 <item>
  <p>Providing default or fixed values for an attribute.</p>
 </item>
</ulist>
<note role="example">
<eg xml:space="preserve"><![CDATA[<attribute name="myAttribute"/>

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

<attribute name="anotherAttribute" default="42">
 <datatype source="integer">
  <minExclusive value="0"/>
 </datatype>
</attribute>

<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 the
built-in simple datatype <code>integer</code>, one required to
be present in instances and one with a default and a subrange qualification; and one with a fixed value.</p>
</note>
 <p>The <code>type</code> attribute is used when the attribute can use a
built-in or pre-declared datatype, i.e. if no <nt def="nt-facet">facets</nt>
are part of its <nt def="nt-datatypeSpec">datatypeSpec</nt>.  Otherwise an
anonymous <code>datatype</code> is used.</p>
<p>Wherever attribute declarations are used, the surrounding
type definition provides its own symbol space for attribute names. E.g. an attribute
named <code>title</code> within one type need not have the same
<nt def="nt-datatypeRef">datatypeRef</nt> as one declared within another
type.</p>
<p>The <termref def="key-attr-satisfy">attr-satisfy</termref> definition wrt schema-validity obtains.</p>

<p>The default when no <nt def="nt-datatypeRef">datatypeRef</nt> is
provided is the <termref def="term-ur-type">ur-type</termref>, which imposes no constraints at all.</p>

<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>A schema can name a group of attributes so that they may be incorporated as a
whole into type definitions: </p>

<scrap lang="ebnf" id="RuleSet.XS8">

<head>Attribute groups</head>
<prod id="nt-attributeGroupDefn">
<lhs>attributeGroupDefn</lhs>
<rhs xml:space="preserve"><pt>NCName</pt> <nt def="nt-attrsSpec">attributesSpec</nt></rhs>
</prod>
 <prod id="nt-attrsSpec2" role="prefig">
  <lhs>attributesSpec</lhs>
  <rhs xml:space="preserve">( <nt def="nt-attrDecl">attribute</nt> |
      <nt def="nt-attributeGroupRef">attributeGroupRef</nt> )* <nt def="nt-anyAttr">attrWildcard</nt>?</rhs>
 </prod>
<prod id="nt-attributeGroupRef">
<lhs>attributeGroupRef</lhs>
<rhs xml:space="preserve"><nt def="nt-attributeGroupName">attributeGroupName</nt></rhs>
</prod>
<prod id="nt-attributeGroupName">
<lhs>attributeGroupName</lhs>
<rhs xml:space="preserve"><pt>QName</pt></rhs>
</prod>
</scrap>

<p>Attribute group definitions provide a construct to replace some uses of
<termref def="gloss-parameterEntity">parameter entities</termref>. 
See <specref ref="declare-openness"/> for a discussion of <nt def="nt-anyAttr">attrWildcard</nt>.</p>

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

&lt;type name="myelement" content="empty"&gt;
    &lt;attributeGroup ref="myAttrGroup"/&gt;
&lt;/type&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 type definition.</p>
</note>
 <p>The concrete syntax above is the first example of a pattern which will
recur:  The same element, in this case <code>attributeGroup</code>, serves both to
define and to incorporate by reference.  In the first case the
<code>name</code> attribute is required, in the second the <code>ref</code>
attribute is required, and the element must be empty.  These two are mutually exclusive, and also conditioned
by context:  the defining form, with a <code>name</code>, must occur at the top
level of a schema, whereas the referring form, with a <code>ref</code>, must
occur within a complex type definition or an attribute group definition.</p>
 <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>
<issue id="global-attrs">
<p>Somewhere in Chapter 3, we need to introduce a means for
declaring global attributes.</p>
</issue>
</div3>
<div3 id="declare-contentModel">
<head>Element Content Model</head>
<p>When content of elements is not constrained by reference to a simple type
(<specref ref="declare-datatype"/>), it can be unconstrained, be constrained to
have no content, or allow elements in its content, in which case 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>unconstrained</pt> | <pt>empty</pt> |
<nt def="nt-richModel">richModel</nt></rhs>
</prod>

</scrap>

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


<p>Content models do not have names, but appear as a part of the definitions of
types, which do have names.</p>
<p>The <termref def="key-satisfy-cm">satisfy-cm</termref> definition wrt schema-validity obtains.</p>
</div3>

<div3 id="declare-elementOnly">
<head>Rich Content Models</head>
<p>A content model consisting of an <nt def="nt-elementOnly">elemModel</nt>
alone specifies child elements only.  If the <pt>mixed</pt> qualifier is present,
text may occur <emph>as well as</emph> elements. In either case 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>Rich content model</head>
 <prod id="nt-richModel">
  <lhs>richModel</lhs>
  <rhs xml:space="preserve"><nt def="nt-elementOnly">elemModel</nt> <pt>mixed</pt>?</rhs>
 </prod>
<prod id="nt-elementOnly">
<lhs>elemModel</lhs>
<rhs xml:space="preserve"><nt def="nt-allGroup">allGroup</nt> | <nt def="nt-modelElt">particle</nt></rhs>
</prod>
<prod id="nt-modelElt">
<lhs>particle</lhs>
<rhs xml:space="preserve">( <nt def="nt-element">element</nt> | <nt def="nt-modelGroup">group</nt> | <nt def="nt-wildcard">wildcard</nt> | <nt def="nt-modelGroupRef">modelGroupRef</nt> ) <nt def="nt-occurs">occurs</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-element">
  <lhs>element</lhs>
  <rhs xml:space="preserve"><nt def="nt-elementRef">elementRef</nt> | <nt def="nt-elementDecl">elementDecl</nt></rhs>
 </prod>
 <prod id="nt-modelGroup">
  <lhs>group</lhs>
  <rhs xml:space="preserve"><nt def="nt-compositor">compositor</nt> <nt def="nt-modelElt">particle</nt> <nt def="nt-modelEltSeq">particleSeq</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>particleSeq</lhs>
<rhs xml:space="preserve"><nt def="nt-modelElt">particle</nt> <nt def="nt-modelEltSeq">particleSeq</nt>?</rhs>
</prod>
<prod id="nt-allGroup">
  <lhs>allGroup</lhs>
  <rhs xml:space="preserve"><nt def="nt-restrictedElt">restrictedParticle</nt> <nt def="nt-restrictedEltSeq">restrictedParticleSeq</nt></rhs>
 </prod>
 <prod id="nt-restrictedElt">
  <lhs>restrictedParticle</lhs>
  <rhs xml:space="preserve"><nt def="nt-element">element</nt> | <nt def="nt-wildcard">wildcard</nt></rhs>
 </prod>
 <prod id="nt-restrictedEltSeq">
  <lhs>restrictedParticleSeq</lhs>
  <rhs xml:space="preserve"><nt def="nt-restrictedElt">restrictedParticle</nt> <nt def="nt-restrictedEltSeq">restrictedParticleSeq</nt>?</rhs>
 </prod></scrap>

<p><termdef term="particle" id="term-particle">The grammar for element-only content is built on content model <term>particle</term>s (<nt def="nt-modelElt">particle</nt> above)</termdef>: elements,
groups and wildcards.  A particle provides for some
number of occurrences in an instance of a single element (via
<nt def="nt-elementRef">elementRef</nt> or <nt def="nt-elementDecl">elementDecl</nt>), a group of elements (via
<nt def="nt-modelGroup">group</nt>) or an indirect specification of any of
these (via <nt def="nt-modelGroupRef">modelGroupRef</nt>).</p>
 <p><termdef term="permit" id="term-permit">We say that a <termref def="term-particle">particle</termref> <term>permit</term>s one or more elements or groups if its <pt>minOccurs</pt> is 0</termdef>.<termdef term="require" id="term-require">We say that a <termref def="term-particle">particle</termref> <term>require</term>s one or more elements or groups if its <pt>minOccurs</pt> is greater than 0</termdef>.</p>
<p><termdef id="term-group" term="group">A <term>group</term> is two or more particles plus a <nt def="nt-compositor">compositor</nt></termdef>.  The <nt def="nt-compositor">compositor</nt> for a group specifies for a given
group whether it provides for
 <ulist>
  <item><p>a sequence of the elements <termref def="term-permit">permitted</termref> or
<termref def="term-require">required</termref> by its <termref def="term-particle">particles</termref>;</p></item>
  <item><p>a choice between
the elements <termref def="term-permit">permitted</termref> or
<termref def="term-require">required</termref> by its <termref def="term-particle">particles</termref>;</p></item>
  <item><p>a repeated choice among the elements <termref def="term-permit">permitted</termref> or
<termref def="term-require">required</termref> by its <termref def="term-particle">particles</termref>;</p></item>
  <item><p>a set of the elements <termref def="term-require">required</termref> by its <termref def="term-particle">particles</termref> (this is the case for the implicit <code>all</code> compositor,
which is associated with the <nt def="nt-allGroup">allGroup</nt> production).</p></item>
 </ulist>
These options reconstruct the XML
1.0 <code>,</code> connector, the XML 1.0 <code>|</code> connector, the repeated disjunction of XML 1.0's <xtermref href="http://www.w3.org/TR/REC-xml#NT-Mixed">Mixed</xtermref>
production and the SGML
<code>&amp;</code> connector respectively. In the first case (<code>sequence</code>) all the
elements <termref def="term-permit">permitted</termref> or
<termref def="term-require">required</termref> must appear in the order given in the group; in the second case
(<code>choice</code>), exactly one of the <termref def="term-permit">permitted</termref> or
<termref def="term-require">required</termref> elements must appearin the fourth case (<code>all</code>), all the <termref def="term-require">required</termref> elements,
which are restricted in this case only to unqualified
<nt def="nt-element">element</nt>s with <pt>minOccurs</pt>=<pt>maxOccurs</pt>=1, must appear, but may
appear in any order.  The <code>all</code> compositor may
only appear as the top-level compositor of a content model.</p>
<p>The <nt def="nt-occurs">occurs</nt> specification governs how many times the
material <termref def="term-permit">permitted</termref> or
<termref def="term-require">required</termref> by a <nt def="nt-modelElt">particle</nt> may occur, but note that the components of a group whose <nt def="nt-compositor">compositor</nt> is (implicitly) <pt>all</pt> may not be qualified,
and therefore 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> as one of the
two expansions of 
<nt def="nt-element">element</nt> above.</p>
 <p>For the interpretation of
<nt def="nt-wildcard">wildcard</nt> in this context, see
<specref ref="declare-openness"/>.</p>

<!-- 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>
  <constraintnote type="cos" id="cos-nonambig">
<head>Unambiguous Content Model</head>
<p> For compatibility, it is an error if a content model is such that there
exist element item sequences within which some item can match more than one
occurrence of an <nt def="nt-elementRef">elementRef</nt>, 
<nt def="nt-elementDecl">elementDecl</nt> or <nt def="nt-wildcard">wildcard</nt> in the content model. </p>
</constraintnote>
</div3>
 <div3 id="declare-mixedContent">
<head>Mixed Content</head>
<p>A content model which allows <pt>mixed</pt> content provides for mixing elements with
character data in document instances. The same <nt def="nt-elementOnly">elemModel</nt> mechanism is used for specifying the
grammar of the allowed elements, with the changes that the implicit top-levl
model group has the <code>choice</code> <nt def="nt-compositor">compositor</nt>
and <pt>minOccurs</pt> of 0 and <pt>maxOccurs</pt> of '*', thus ensuring that the default
behaviour is the same as that of XML. </p>


<note role="example">
<eg xml:space="preserve">&lt;type content="mixed"&gt;
 &lt;element ref="name1"/&gt;
 &lt;element ref="name2"/&gt;
 &lt;element ref="name3"/&gt;
&lt;/type&gt;
</eg>
<p>Allows character data mixed with any number of <code>name1</code>,
<code>name2</code> and <code>name3</code> elements.</p>
</note>
<issue id="noEmptyReqd">
 <p>We need to make the <nt def="nt-elementOnly">elemModel</nt> rhs optional, to
allow for <pt>mixed</pt> with no elements specified == our minimum commitment
model.  This in turn would allow us if we chose to get rid of an explicit
<pt>empty</pt> flag:  just specify <code>elementOnly</code> and no model.</p>
 <p>We could then get rid of <pt>any</pt> as well, given other mechanisms for
controlled openness we're contemplating.</p>
 <p>Note that most of this is actually realised in the current version, with
the exception of the observation about <pt>empty</pt>.</p>
</issue>
<p>The <termref def="key-satisfy-mixed">satisfy-mixed</termref> definition wrt schema-validity obtains.</p>
</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.XS12a">

<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-allGroup">allGroup</nt> | <nt def="nt-modelGroup">group</nt> | <nt def="nt-element">element</nt> | <nt def="nt-modelGroupRef">modelGroupRef</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>QName</pt></rhs>
</prod>

</scrap>
 <p>Groups defined with the <nt def="nt-allGroup">allGroup</nt> option may only
be referenced from a <nt def="nt-modelGroupRef">modelGroupRef</nt> which
constitutes the only <nt def="nt-modelGroup">group</nt> at the top level of a content model.</p>
<note role="example">
<eg xml:space="preserve">&lt;group name="myModelGroup"&gt;
 &lt;element ref="myelement"/&gt;
&lt;/group&gt;

&lt;element name="myelement"&gt;
 &lt;type&gt;
  &lt;group ref="myModelGroup"/&gt;
  &lt;attribute ...&gt;. . .&lt;/attribute&gt;
 &lt;/type&gt;
&lt;/element&gt;

&lt;element name="anotherelement"&gt;
 &lt;type&gt;
  &lt;group order="choice"&gt;
   &lt;element ref="yetAnotherelement"/&gt;
   &lt;group ref="myModelGroup"/&gt;
  &lt;/group&gt;
  &lt;attribute ...&gt;. . .&lt;/attribute&gt;
 &lt;/type&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>
<issue id="named-model-groups">
 <p>In its vote on 1999-11-04, the WG agreed that this section was
still open for discussion.</p>
</issue>
</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>

<issue id="elt-default">
  <p>The extension of defaulting to element content is tentative. </p>
</issue>
<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-datatypeRef">datatypeRef</nt> | <nt def="nt-typeSpec">complexTypeSpec</nt> | <nt def="nt-typeSpec">simpleTypeSpec</nt> ) <nt def="nt-valueConstraint">valueConstraint</nt>? <nt def="nt-generalConstraint">generalConstraint</nt>* <nt def="nt-equivClassRef">equivClassRef</nt>? <nt def="nt-final">final</nt> <nt def="nt-exact">exact</nt> <pt>nullable</pt>? <pt>abstract</pt>?</rhs>
</prod>
 <prod id="nt-equivClassRef">
  <lhs>equivClassRef</lhs>
  <rhs><nt def="nt-elementRef">elementRef</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>QName</pt> </rhs>
</prod>

</scrap>

<p>An element declaration associates a name with type. This name will appear in tags in instance
documents; the type 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-typeSpec">typeSpec</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 a complex type (by reference or inclusion), but also
allows the reference or specification to be for a simple type, 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> provides 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) a complex type or simple type with the same name as a top-level element.</p> 
<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 type that defines
them. Note however that type and datatype names are always top-level names within a
schema, even when associated with locally-scoped element names.</p>
 <p>The use above of <nt def="nt-datatypeSpec">simpleTypeSpce</nt> and
<nt def="nt-typeSpec">complexTypeSpec</nt>, which have no provision for names,
is intentional: nested types are anonymous.</p>
 <p>See below at <specref ref="declare-key"/> for <nt def="nt-generalConstraint">generalConstraints</nt>.</p>
<p>An element declared as <pt>nullable</pt> may appear in instances with an
attribute whose name is <code>null</code> from the XML Schema instance namespace and
value <code>true</code> to distinguish a null content from an empty content. 
It is an error for element information items marked
<code>xsi:null="true"</code> to have any content.</p>
 <issue id="nullRequiresEmpty">
  <p>Is it a precondition for being nullable that the element's contentType
allow no content?  If not, then more needs to be said above, if so, this needs
to be spelled out.</p>
 </issue>

<note role="example">
<eg xml:space="preserve">&lt;element name="myelement" type="mySimpleType"/&gt;

&lt;element name="et0" type="myComplexType"/&gt;

&lt;element name="et1"&gt;
 &lt;type&gt;
  &lt;element ref="et0"/>
  . . .
  &lt;attribute ...&gt;. . .&lt;/attribute&gt;
 &lt;/type&gt;
&lt;/element&gt;

&lt;element name="et2"&gt;
 &lt;type content="empty"&gt;
  &lt;attribute ...&gt;. . .&lt;/attribute&gt;
 &lt;/type&gt;
&lt;/element&gt;
</eg>
<p>The first two examples above declare elements by reference to a simple and a
complex type respectively.  The third and fourth use embedded anonymous complex
types, the first of which in
turn refers to one of the top-level elements in its content model.</p>
<eg xml:space="preserve">&lt;element name="contextOne"&gt;
 &lt;type&gt;
  &lt;element name="myLocalelement" type="myFirstType"/&gt;
  &lt;element ref="globalelement"/&gt;
 &lt;/type&gt;
&lt;/element&gt;

&lt;element name="contextTwo"&gt;
 &lt;type&gt;
  &lt;element name="myLocalelement" type="mySecondType"/&gt;
  &lt;element ref="globalelement"/&gt;
 &lt;/type&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>In the concrete syntax above, the <code>type</code> attribute is used to
encode both the <termref def="nt-typeRef">typeRef</termref> or <termref def="nt-datatypeRef">datatypeRef</termref> options.  In the case where there are both a
simple type and a complex type of the referenced name in the relevant schema, the
ambiguity is resolved in favour of the complex type.</p>
 <note>
  <p>See <loc href="#note-two-sses">previous note on the ambiguity issue</loc>.</p>
 </note>
<ednote><edtext> existing section on element declaration should be updated to
cover instance syntax.</edtext></ednote>
<p>The <specref ref="cos-local-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-openness">
    <head>Wildcards</head>
   <p>In order to exploit the full potential for extensibility offered by XML
plus namespaces, more provision is needed than DTDs allow for targeted flexibility in content
models and attribute declarations.  At a given point in a content model, in
addition to what DTDs provide for we need <termref def="term-particle">particles</termref> that allow the following:</p>
   <olist>
    <item>
     <p>Any well-formed XML element item: any tag, any namespace, any attributes,
any content, as long as it's well-formed;</p>
    </item>
    <item>
     <p>Any well-formed XML element item, provided it's in some <emph>other</emph>
namespace than the one we're defining a type for;</p>
    </item>
    <item>
     <p>Any well-formed XML element item, provided it's in a specified namespace;</p>
    </item>
    <item>
     <p>Any well-formed XML element item, provided it's from the <emph>same</emph>
namespace as the one we're defining a type for.</p>
    </item>
   </olist>
   <p>Of course, by qualifying one of these with a <B>*</B>, we allow for any
amount of (localized) flexibility in validation.</p>
   <p>Attributes need the same kind of flexibility:  a good-citizen schema
should probably allow any attributes from the <code>xml:</code> namespace, for instance.</p>
    <scrap lang="ebnf" id="Ruleset.XS20">
     <head>Wildcards</head>
     <prod id="nt-wildcard">
      <lhs>wildcard</lhs>
      <rhs xml:space="preserve"><pt>any</pt> | <pt>otherNS</pt> |
<nt def="nt-allowedNS">allowedNSList</nt> | <pt>sameNS</pt></rhs>
     </prod>
     <prod id="nt-allowedNS">
      <lhs>allowedNSList</lhs>
      <rhs xml:space="preserve"><pt>myNS</pt>? <pt>URI</pt>*</rhs>
     </prod>
     <prod id="nt-anyAttr">
      <lhs>attrWildcard</lhs>
      <rhs xml:space="preserve"><nt def="nt-wildcard">wildcard</nt></rhs>
     </prod>
    </scrap>
    <p>The four alternatives for <nt def="nt-wildcard">wildcard</nt>
correspond to the four kinds of flexibility listed above.</p>
    <p>All of the above are subject to the same ambiguity constraints
(<specref ref="cos-nonambig"/>) as other
content model particles:  If an instance element could match either an explicit
particle and a wildcard, or one of two wildcards, within the content model of a
type, that model is in error.</p>
   
    <note role="example"><eg xml:space="preserve"><![CDATA[<any/>

<any namespace="##other"/>

<any namespace="http://www.w3.org/1999/Style/Transform/">

<any namespace="##targetNamespace"/>

<anyAttribute namespace="http://www.w3.org/XML/1998/namespace"/>]]></eg>
    <p>Concrete examples of the four cases listed above, plus one attribute case.</p>
</note>
   </div2>
<div2 id="declare-refinement">
<head>Deriving Type Definitions</head>
<p>This section articulates what has only been hinted at above, namely a
considerable increase in the power and expressiveness of schema declarations,
by explaining what was provided for in the abstract syntax in the previous
section, but not explained much if at all at that point:  the potential for
deriving new type definitions on the basis of old ones.  <termdef id="derived" term="derived">We call such a new definition a <term>derived</term> type definition</termdef>, and <termdef id="source" term="source">the old definition it is derived from the <term>source</term> type definition</termdef>.</p>
<p>We provide two means for deriving type definitions from other type definitions, each of which implies a partial order over the types defined in a
schema:  A
type definition may either <emph>restrict</emph> or <emph>extend</emph> another
type definition.</p>
 <div3 id="declare-embed">
  <head>Deriving type definitions by extension</head>
  <p>A new type complex type can be defined by adding additional content model
particles at the end of the element-only content model of another complex definition
and/or by adding attribute declarations to any type definition.  Members of
a type whose definition is derived in this way, i.e. by extension, will
always contain members of their source type within them
as prefixes.</p>
  <scrap>
   <head>Extension</head>
  <prod id="nt-typeSpec2" role="prefig">
    <lhs>complexTypeSpec</lhs>
    <rhs xml:space="preserve"><nt def="nt-contentType">contentType</nt> <nt def="nt-attrsSpec">attributesSpec</nt>? <nt def="nt-final">final</nt> <nt def="nt-exact">exact</nt> <pt>abstract</pt>?</rhs> 
  </prod>
<prod id="nt-contentType">
<lhs>contentType</lhs>
<rhs xml:space="preserve"><nt def="nt-embedding">extension</nt> | <nt def="nt-restriction">restriction</nt></rhs>
</prod>
 <prod id="nt-embedding">
 <lhs>extension</lhs>
  <rhs xml:space="preserve"><nt def="nt-datatypeRef">simpleTypeRef</nt> | ( <nt def="nt-typeRef">complexTypeRef</nt> <nt def="nt-contentModel">contentModel</nt> )</rhs>
</prod>
  </scrap>
<p>For the time being, the effective content model of a type definition
derived by extension from another complex type is
composed by appending its <nt def="nt-contentModel">contentModel</nt> to that of the source
definition.  It follows from this that the source definition must be complex
and element-only if the <nt def="nt-contentModel">contentModel</nt> is not
empty.  If it <emph>is</emph> empty, there is no constraint on the nature of the
source definition, which may be simple or complex (thus the <nt def="nt-datatypeRef">simpleTypeRef</nt> above).  In either case, attributes may be added.</p>
  <note>
   
   <p>The restriction to appending in the case of content-model extension
simplifies application processing in order to cast instances from derived to
source type.  We may liberalise this in future versions, requiring more
complex transformations to effect casting.</p>
  </note>
  <note role="example">
   <eg xml:space="preserve"><![CDATA[<type name="personName">
 <element name="title" minOccurs="0"/>
 <element name="forename" minOccurs="0" maxOccurs="*"/>
 <element name="surname"/>
</type>

<type name="extendedName" source="personName" derivedBy="extension">
 <element name="generation" minOccurs="0"/>
</type>

<element name="addressee" type="extendedName"/>

  <addressee>
   <forename>Albert</forename>
   <forename>Arnold</forename>
   <surname>Gore</surname>
   <generation>Jr</generation>
  </addressee>]]></eg>
   <p>A type definition for personal names, and a definition derived by
extension which adds a single element; an element declaration referencing the
derived definition, and a valid instance thereof.</p>
  </note>
 </div3>
<div3 id="declare-supertype">
  <head>Deriving type definitions by restriction</head>
  <p>A new type can be defined by decreasing the possibilities made available by an
existing type definition:  narrowing ranges, removing alternatives, etc.
Restriction is specified bottom up, via <nt def="nt-datatypeRestr">simpleRestrictions</nt> or <nt def="nt-typeRestr">complexRestrictions</nt> in a <nt def="nt-typeSpec">complexTypeSpec</nt>, in either case referring to its <termref def="source">source</termref> definition with a <nt def="nt-typeRef">complexTypeRef</nt>.  Members of a type whose definition is derived in this way, i.e. by restriction, will always be members of their source type as well.</p>
<scrap id="Ruleset.XS23">
 <head>Restriction</head>
 <prod id="nt-restriction">
 <lhs>restriction</lhs>
  <rhs xml:space="preserve">( <nt def="nt-typeRef">complexTypeRef</nt> <nt def="nt-typeRestr">complexRestrictions</nt> ) |  ( <nt def="nt-typeRef">complexTypeRef</nt> <nt def="nt-datatypeRestr">simpleRestrictions</nt> ) | <nt def="nt-contentModel">contentModel</nt></rhs>
</prod>
 <prod id="nt-datatypeRestr">
  <lhs>simpleRestrictions</lhs>
  <rhs xml:space="preserve"><nt def="nt-facet">facet</nt>+</rhs>
 </prod> 
 <prod id="nt-typeRestr">
  <lhs>complexRestrictions</lhs>
  <rhs xml:space="preserve">( <nt def="nt-modelElt">particle</nt> |
<pt>sic</pt> )* <nt def="nt-attrsSpec">attributesSpec</nt></rhs>
 </prod>
</scrap>
  <p>A definition by restriction will restrict some of the permissions or obligations inherited
therefrom.  This means that
if the <termref def="source">source</termref> definition has text-only content,
the <nt def="nt-datatypeRestr">simpleRestrictions</nt> option must be used, and its facets must each narrow the
corresponding facet of the <termref def="source">source</termref> definition, e.g. by reducing a range or removing
members of an enumeration.</p>
  <p>If the <termref def="source">source</termref> definition has element-only
or mixed content, restricting a content model is also possible via the <nt def="nt-typeRestr">complexRestrictions</nt> option.  In this case each <termref def="term-particle">particle</termref> within the restriction is matched one for one with the corresponding particle in the <termref def="source">source</termref> definition, and in each case a restriction must be effected, e.g. by narrowing the range of <nt def="nt-occurs">occurs</nt>, by reducing the members of a disjunction or by replacing a <nt def="nt-wildcard">wildcard</nt> with a more explicit <termref def="nt-modelElt">particle</termref>.</p>
  <p>In either case, attributes
may be restricted by adding and/or fixing defaults, or by restricting the
attribute's simple type definition.</p>
 <p>The bare <nt def="nt-contentModel">contentModel</nt> option reflects the
fact that type definitions without a source type, consisting simply of a
content model, are interpreted as restricting the ur-type.</p>
  <note role="example">
   <eg xml:space="preserve"><![CDATA[<type name="simpleName" source="personName" derivedBy="restriction">
 <restrictions>
  <element name="title" maxOccurs="0"/>
  <element name="forename" minOccurs="1" maxOccurs="1"/>
 </restrictions>
</type>

<element name="who" type="simpleName"/>

   <who>
    <forename>Bill</forename>
    <surname>Clinton</surname>
   </who>]]></eg>
   <p>A simplified type definition
derived from the source type from the previous example by restriction, eliminating one optional daughter and
fixing another to occur exactly once; an element declared by reference to it,
and a valid instance thereof.</p>
  </note>
 </div3>
 <div3 id="final_and_abstract">
  <head>Controlling derivation</head>
  <p>A type definition can control the extent to which other types may be
derived from it, the ways it may appear in content models and the
import of those appearances.</p>
  <scrap>
   <head>Derivation control</head>
  <prod id="nt-typeSpec3" role="prefig">
    <lhs>complexTypeSpec</lhs>
    <rhs xml:space="preserve"><nt def="nt-contentType">contentType</nt> <nt def="nt-attrsSpec">attributesSpec</nt>? <nt def="nt-final">final</nt>
<nt def="nt-exact">exact</nt> <pt>abstract</pt>?</rhs> 
  </prod>
<prod id="nt-final">
<lhs>final</lhs>
<rhs xml:space="preserve"><pt>extension</pt>? <pt>restriction</pt>?</rhs>
</prod>
<prod id="nt-exact">
<lhs>exact</lhs>
<rhs xml:space="preserve"><pt>extension</pt>? <pt>restriction</pt>? <pt>equivClass</pt>?</rhs>
</prod>
  </scrap>
<p>An <pt>abstract</pt> type definition may not be referenced from a <nt def="nt-modelElt">particle</nt>, nor may it be used in an instance
as the value of <code>xsi:type</code> (see below).</p>
<p>A type definition may prevent its use as a source for derived
definitions by any or all means by declaring itself <nt def="nt-final">final</nt> for the prohibited means.  In the absence of <nt def="nt-final">final</nt> the value of <nt def="nt-finalDefault">finalDefault</nt> from the containing schema is used.</p>
<p>A type definition may declare that it is <nt def="nt-exact">exact</nt>:  although not <pt>abstract</pt>,
none-the-less types derived by any or all means from it may not appear
in its place even when an <nt def="nt-element">element</nt> <nt def="nt-modelElt">particle</nt>
naming it would appear to allow this (see below).  In the absence of <nt def="nt-exact">exact</nt> the value of <nt def="nt-exactDefault">exactDefault</nt> from the containing schema is used.</p>
 </div3>
   <div3 id="invariant-GI">
    <head>Reinterpreting Content Models</head>
    <p>In the light of type derivation, we propose to elaborate the
significance of <nt def="nt-element">element</nt> when it serves as a <nt def="nt-modelElt">particle</nt>.  An <nt def="nt-element">element</nt> which specifies a type (either locally or by reference) which is the <termref def="source">source</termref> of other types is understood as allowing that type or any of the types derived from it to govern its occurance in instances.</p>
    <p>This introduces an ambiguity if the
source type is not <code>abstract</code> and/or has a derived type which is
substitutable for another derived type.  This is resolved by requiring instance
elements allowed via in this way which conform to types other than
the source type to
manifest their type using the <code>type</code> attribute from the XML Schema
instance namespace,
e.g. <code>xsi:type</code>.</p>
<p>If either the <nt def="nt-element">element</nt> <nt def="nt-modelElt">particle</nt> or the referenced type definition is <nt def="nt-exact">exact</nt> for some or all kind of derivation, then this
elaboration doesn't happen for those derivations, i.e. types derived in those
ways may <emph>not</emph> appear.</p>
    <p>This facility is intended to provide
a good impedence match with the needs of database and object-oriented
programming applications.</p>
    <note role="example">
     <eg xml:space="preserve"><![CDATA[<type name="WorldAddress"
      source="po:Address" derivedBy="extension">
 <element name="country" type="string"/>
</type>

<type name="GermanAddress"
      source="po:WorldAddress" derivedBy="extension">
 <element name="land" type="string/>
</type>

<element name="person">
 <type>
  . . .
  <element name="address" type="po:Address"/>
 </type>
</element>

  <person>
   ...
   <address>
    ...
   </address>
  </person>

  <person>
   <address xsi:type="GermanAddress">
    ...
    <country>Germany</country>
    <land>Saarland</land>
   </address>
  </person>]]></eg>
     <p>Two types derived from the <code>Address</code> type defined in <specref ref="sampleSchema"/> are defined, adding first a <code>country</code> and then a <code>land</code> element to its required content.  Two schema-valid instances of an element declared with type <code>Address</code> are shown, one using that type itself, and therefore not requiring disambiguation, and one using the <code>xsi:type</code> attribute to indicate that it is using the <code>GermanAddress</code> type.</p>
    </note>
   </div3>
 <div3 id="declare-equiv">
  <head>Element Equivalence Classes</head>
  <p>We provide a mechanism to allow bottom-up specification of disjunctions
over elements in content models.  An element declared at the top level can
declare itself to be a member of an equivalence class by reference to the
exemplar of that class, itself an element declared at the top level.</p>
  <scrap>
   <head>Element Equivalence Classes</head>
<prod id="nt-elementDecl3" role="prefig">
<lhs>elementDecl</lhs>
<rhs xml:space="preserve"><pt>NCName</pt> <nt def="nt-elementSpec">elementSpec</nt></rhs>
</prod>
   <prod id="nt-elementSpec3" role="prefig">
<lhs>elementSpec</lhs>
<rhs xml:space="preserve">( <nt def="nt-typeRef">typeRef</nt> | <nt def="nt-datatypeRef">datatypeRef</nt> | <nt def="nt-typeSpec">complexTypeSpec</nt> | <nt def="nt-typeSpec">simpleTypeSpec</nt> ) <nt def="nt-valueConstraint">valueConstraint</nt>? <nt def="nt-generalConstraint">generalConstraint</nt>* <nt def="nt-equivClassRef">equivClassRef</nt>? <nt def="nt-final">final</nt> <nt def="nt-exact">exact</nt> <pt>nullable</pt>? <pt>abstract</pt>?</rhs>
</prod>
 <prod id="nt-equivClassRef2" role="prefig">
  <lhs>equivClassRef</lhs>
  <rhs><nt def="nt-elementRef">elementRef</nt></rhs>
 </prod>
<prod id="nt-final3" role="prefig">
<lhs>final</lhs>
<rhs xml:space="preserve"><pt>extension</pt>? <pt>restriction</pt>?</rhs>
</prod>
<prod id="nt-exact3" role="prefig">
<lhs>exact</lhs>
<rhs xml:space="preserve"><pt>extension</pt>? <pt>restriction</pt>? <pt>equivClass</pt>?</rhs>
</prod>
 <prod id="nt-element3" role="prefig">
  <lhs>element</lhs>
  <rhs xml:space="preserve"><nt def="nt-elementRef">elementRef</nt> | <nt def="nt-elementDecl">elementDecl</nt></rhs>
 </prod>
  </scrap>
  <p>The type of every member of an equivalence class must be the same as or derived from the
type of the exemplar.</p>
  <p>In a way similar to the reinterpretation of the <nt def="nt-element">element</nt> <nt def="nt-modelElt">particle</nt> discussed in the previous section, we further extend the significance thereof by saying that an <nt def="nt-element">element</nt> <nt def="nt-modelElt">particle</nt> of the <nt def="nt-elementRef">elementRef</nt> form which references the exemplar of an equivalence class is understood as allowing not only the referenced element but any member of its equivalence class in instances.</p>
  <p>Vacuous type derivation is allowed, i.e. an equivalence class member may
have the <emph>same</emph> type as the exemplar of its class.  The concrete
syntax makes this easy by allowing element declarations which specify an <nt def="nt-equivClassRef">equivClassRef</nt> to specify no type at all, in which case they are taken to have the same type as their exemplar.</p>
  <p>If an <nt def="nt-element">element</nt> is <pt>abstract</pt>, then
although references to it can appear in content models, it cannot itself allow
element information items with its name to appear in instances:  only instances
of elements declared with it as their exemplar, if any, may appear.</p>
  <p>If an <nt def="nt-element">element</nt> is <nt def="nt-exact">exact</nt> for some or all kinds of derivation, then this
elaboration doesn't happen for those derivations, i.e. elements other than the
exemplar may <emph>not</emph> appear if their type is derived from that of the
exemplar in a proscribed way.  The <code>equivClass</code> value for <nt def="nt-exact">exact</nt> prevents equivalence class member substitution without preventing derived type substitution per <specref ref="invariant-GI"/>.</p>
  <p>If an <nt def="nt-element">element</nt> is <nt def="nt-final">final</nt>
for some or all kinds of derivation, elements whose type is derived from their
source by the proscribed means may not nominate this element as the exemplar of
their <nt def="nt-equivClassRef">equivClassRef</nt>.</p>
  <note role="example">
   <eg xml:space="preserve"><![CDATA[  <type name="facet" source="annotated" derivedBy="extension">
    <attribute name="value" minOccurs="1"/>
  </type>

  <element name="facet" type="facet" abstract="true"/>

  <element name="encoding" equivClass="facet">
   <type source="facet" derivedBy="restriction">
    <attribute name="value" type="encodings"/>
   </type>
  </element>

  <element name="period" equivClass="facet">
   <type source="facet" derivedBy="restriction">
    <attribute name="value" type="timeDuration"/>
   </type>
  </element>

  <type name="datatype">
    <element ref="facet" minOccurs="0" maxOccurs="*"/>
    <attribute name="name" type="NCName" minOccurs="0">
    . . .
  </type>
]]></eg>
   <p>An example from the schema for datatypes from &XSP2;.  The
<code>facet</code> type is defined
and the <code>facet</code> element is declared to use it. The <code>facet</code> element is abstract -- it's
<emph>only</emph> defined to stand as the exemplar for a class).  Two further
elements are declared, each a member of the <code>facet</code> equivalence
class.  Finally a type is defined which refers to <code>facet</code>, thereby
allowing <emph>either</emph> <code>period</code> or <code>encoding</code> (or
any other member of the class).</p>
  </note>
 </div3>
 <div3 id="declare-ur">
  <head>The ur-type</head>
  <p><termdef id="term-ur-type" term="ur-type">Any schema implicitly defines an <term>ur-type</term>, which is
the source for all types, simple or complex, which do not identify an
explicit source type</termdef>, and the default type for elements and
attributes which do not specify one.  You can think of the <termref def="term-ur-type">ur-type</termref> as if it were defined as follows
for complex types:</p>
  <eg xml:space="preserve"><![CDATA[<type name="ur-type" content="mixed">
 <any/>
 <anyAttribute/>
</type>]]></eg>
  <p>The <code>mixed</code> content specification together with the
unconstrained wildcard content model and attribute specification produce the defining property for the
ur-type, namely that <emph>every</emph> type is a restriction of it:  its permissions and requirements are
the least restrictive possible.</p>
<p>There is no way to notate the <termref def="term-ur-type">ur-type</termref> from the perspective of simple
types:  it's defining property is simply that all the ab-initio types
are derived from it by restriction.</p>
 </div3>
<div3>
 <head>Graveyard for stale syntax, here to avoid breaking IDREFs
elsewhere *</head>
<p><termdef id="key-refine" term="refine">a type AT1 is said to
<term>refine</term> a type AT2 if and only if AT1 is declared to refine
either AT2 or (recursively) some type 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-key">
    <head>Unique, key and key reference constraints</head>
    <p>We supplement the simple uniqueness and reference mechanisms provided by
<code>ID</code> and <code>IDREF</code> in XML 1.0 and SGML with three new kinds
of constraint, for uniqueness, keys and key references.</p>
    <p>The <nt def="nt-unique">unique</nt> and <nt def="nt-key">key</nt> constraints provide for selected
elements to be checked as having locally or globally unique identities.  The
<nt def="nt-keyref">keyref</nt> constraint provides for checking referential consistency with
respect to a declared <nt def="nt-unique">unique</nt> or <nt def="nt-key">key</nt> constraint.</p>
    <p>These constraints are specified independently of the types of the
attributes and elements involved, i.e. something declared as of type integer
may also serve as a key, unlike <code>ID</code> and
<code>IDREF</code>.  Each constraint declaration has a name, which exists in a
single symbol space for constraints.</p>
    <p>Overall the augmentations to XML's <code>ID/IDREF</code> mechanism are:</p>
    <ulist>
     <item><p>Not just attribute values, but also element content and combinations
of values and content can be declared to be unique;</p></item>
     <item><p>Constraints can be specified to have document-wide scope
<emph>or</emph> to hold within the scope of particular elements;</p></item>
     <item><p>(Combinations of) attribute values and/or element content can be
declared to be keys, that is, not only unique, but always present and non-nullable.</p></item>
    </ulist>
    <scrap id="Ruleset.XS24">
<head>Uniqueness Constraints</head>
     <prod id="nt-generalConstraint">
      <lhs>generalConstraint</lhs>
      <rhs xml:space="preserve"><nt def="nt-constraintName">constraintName</nt>
( <nt def="nt-unique">unique</nt> | <nt def="nt-key">key</nt> | <nt def="nt-keyref">keyref</nt> )</rhs>
     </prod>
     <prod id="nt-unique">
      <lhs>unique</lhs>
      <rhs xml:space="preserve"> <nt def="nt-selector">selector</nt> <nt def="nt-field">field</nt>+</rhs>
     </prod>
     <prod id="nt-key">
      <lhs>key</lhs>
      <rhs xml:space="preserve"> <nt def="nt-selector">selector</nt> <nt def="nt-field">field</nt>+</rhs>
     </prod>
     <prod id="nt-keyref">
      <lhs>keyref</lhs>
      <rhs xml:space="preserve"> <nt def="nt-selector">selector</nt> <nt def="nt-field">field</nt>+ <nt def="nt-refer">refer</nt></rhs>
     </prod>
     <prod id="nt-constraintName">
      <lhs>constraintName</lhs>
      <rhs><pt>NCName</pt></rhs>
     </prod>
     <prod id="nt-refer">
      <lhs>refer</lhs>
      <rhs><pt>QName</pt></rhs>
     </prod>
     <prod id="nt-selector">
      <lhs>selector</lhs>
      <rhs><pt>XPath_Expr</pt></rhs>
     </prod>
     <prod id="nt-field">
      <lhs>field</lhs>
      <rhs><pt>XPath_Expr</pt></rhs>
     </prod>
    </scrap>
    <p><nt def="nt-selector">selector</nt> specifies an XPath expression <bibref ref="bib-xpath"/> relative to
instances of the element being declared, or to the root for <nt def="nt-generalConstraint">generalConstraints</nt> declared at the top level. This must identify a node set of subelements (i.e. elements contained within the declared element) to which the constraint applies.</p>
    <p><nt def="nt-field">field</nt> specifies an XPath expression relative to each
element selected by a <nt def="nt-selector">selector</nt>.  This must identify
a single node (element or attribute, not necessarily within the selected element) whose content or value, which must be
of a simple type, is used in the constraint.  It is possible to specify an
ordered list of <nt def="nt-field">field</nt>s, to cater to multi-field keys,
keyrefs, and uniqueness constraints.  A <nt def="nt-field">field</nt> must not
evaluate to the same element or attribute as any other <nt def="nt-field">field</nt> in a given instance of a <nt def="nt-generalConstraint">generalConstraint</nt>.
     <note>
      <p>Provision for multi-field keys etc. goes beyond what is supported by <code>xsl:key</code>.</p>
     </note></p>
    <issue id="restrictConstrXPaths">
<p>
Xpaths can take arbitrarily complicated forms and it is unnecessary to burden
XML Schema implementations with supporting every feature of XPath.  The XPaths
in <nt def="nt-selector">selector</nt> and <nt def="nt-field">field</nt> should be restricted to certain specified simple forms.</p>
    </issue>
    <issue id="fieldOnlyKeyref">
     <p>Should the selector be made optional in a keyref, with default the
element it's contained within?</p>
    </issue>
    <issue id="islandValidConstraint">
     <p>What are the implications of constraints if we support island
validation constraints?</p>
    </issue>
    <p>The <nt def="nt-refer">refer</nt> of a <nt def="nt-keyref">keyref</nt>
must match the <nt def="nt-constraintName">constraintName</nt> of a <nt def="nt-unique">unique</nt> or a <nt def="nt-key">key</nt>.  The number of <nt def="nt-field">fields</nt> of the <nt def="nt-keyref">keyref</nt> must be the same as the number of <nt def="nt-field">fields</nt> of the referenced <nt def="nt-unique">unique</nt> or <nt def="nt-key">key</nt>.  For every element which is identified in a given scope by the <nt def="nt-selector">selector</nt> of a <nt def="nt-keyref">keyref</nt> defined for that scope (call this <B>ref</B>), there must be an element in that scope identified by the <nt def="nt-selector">selector</nt> of the named <nt def="nt-unique">unique</nt> or <nt def="nt-key">key</nt> (call this <B>target</B>) such that the values of the <nt def="nt-field">fields</nt> of the <nt def="nt-keyref">keyref</nt> evaluated with respect to <B>ref</B>, taken in order, match the values of the <nt def="nt-field">fields</nt> of the <nt def="nt-unique">unique</nt> or <nt def="nt-key">key</nt> evaluated with respect to <B>target</B>.</p>
    <note>
     <p>If reference to a key or unique defined in a scoping element which may
occur more than once is envisaged, then the scoping elements themselves must
have keys (typically with global scope), and the scoped keys must include the
key of their scoping element among their fields.</p>
    </note>
    <note role="example">
     <eg xml:space="preserve"><![CDATA[<element name="state"> 
  <type> 
   <element name="stateCode" type="twoLetterCode"/>

    <element name="vehicle"> 
      <type> 
       . . .
       <attribute name="regNo" type="integer"/>
      </type> 
    </element> 

    . . .
  </type> 

</element> 

<key name="regKey"> 
  <selector>.//vehicle[@regNo]</selector>
  <field>@regNo</field>
  <field>ancestor::state/stateCode</field>
      <!-- scope needs to be involved -->
</key> 

<element name="person"> 
 <type> 
 . . .
  <element name="car">
   <type model="empty">
    . . .
    <attribute name="regRef" type="integer"/>
    <attribute name="regState" type="twoLetterCode"/>
   </type> 
  </element> 
 </type>

 <keyref name="carRef" refer="regKey">
  <selector>.//car[@regRef]</selector> 
   <field>@regRef</field>
   <field>../person/@regState</field>
 </keyref> 
</element>]]></eg>
     <p>A <code>state</code> element is defined, which <emph>inter alia</emph>
contains a <code>stateCode</code> descendant and some <code>vehicle</code>
descendants.  A <code>vehicle</code> in turn has a <code>regNo</code> attribute,
which is an integer.  The combination of <code>stateCode</code> and
<code>regNo</code> is asserted to be a <nt def="nt-key">key</nt> for
<code>vehicle</code> within <code>state</code>.  Furthermore, a <code>person</code> element has
inter-alia an empty <code>car</code> element, with <code>regRef</code> and
<code>regState</code> attributes, which are then asserted together to refer to
<code>vehicles</code> via the <code>regKey</code> constraint.</p>
    </note>
   </div2>
<div2 id="declare-entity">
<head>Notations</head>

<scrap lang="ebnf" id="RuleSet.XS15">

<head>Notations</head>
<prod id="nt-notationDecl">
<lhs>notationDecl</lhs>
<rhs><pt>NCName</pt> <nt def="nt-notationSpec">notationSpec</nt></rhs>
</prod>
<prod id="nt-notationSpec">
<lhs>notationSpec</lhs>
<rhs><nt def="nt-systemID">systemID</nt> <nt def="nt-notationRef">notationRef</nt> <nt def="nt-publicID">publicID</nt>?</rhs>
</prod>
<prod id="nt-systemID">
<lhs>systemID</lhs>
<rhs><pt>URI</pt></rhs>
</prod>
<prod id="nt-publicID">
<lhs>publicID</lhs>
<rhs>
<com>see <bibref ref="ref-xml"/></com></rhs>
</prod>
<prod id="nt-notationRef">
<lhs>notationRef</lhs>
<rhs><nt def="nt-notationName">notationName</nt></rhs>
</prod>
<prod id="nt-notationName">
<lhs>notationName</lhs>
<rhs><pt>QName</pt></rhs>
</prod>

</scrap>
<div3 id="declare-notation">
<head>Notation Declaration</head>
<p>A notation may be declared by specifying a name and an identifier for the
notation.</p>
<note>
<eg xml:space="preserve">
&lt;notation name="jpeg"
          public="image/jpeg" system="viewer.exe" /&gt;

&lt;element name="picture"&gt;
 &lt;type source="binary" derivedBy="extension"&gt;
  &lt;attribute name="pictype" type="NOTATION"/&gt;
 &lt;/type&gt;
&lt;/element&gt;

&lt;picture pictype="jpeg"&gt;...&lt;/picture>
</eg>
<p>The notation need not ever be mentioned in the instance document.</p>

</note>
</div3>
</div2>
</div1>
   <div1 id="composition">
    <head>Schema Access and Composition</head>
<p>This chapter defines the mechanisms by which we establish the necessary precondition for establishing schema-validity, namely access to one or more schemas. This chapter also describes in detail related mechanisms for using in
one schema, definitions and declarations from another. </p>
<p>Chapter 6 provides a formal definition of schema-validation. Here we describe
a 3-layer architecture which incorporates that formal definition and relates it
to XML documents and WWW-situated processes. This layering is provided to
maximize the range of environments in which this specification can be applied,
and to minimize the need for modifications to this specification as new
standards and conventions for Web interoperability are developed. The layers
are: </p>
<olist>
  <item><p>The schema-validation core; </p></item>
  <item><p>Schema definition: the connections between the XML Schema concrete syntax
  defined in the preceding chapter and the validation core, including the
  relationships between namespaces and schema components; </p></item>
  <item><p>XML Schema web-interoperability guidelines: instance-&gt;schema and
  schema-&gt;schema connections for the WWW. </p></item></olist>
<p>Layer 1 specifies the manner in which a set of schema components can be applied to validate an instance element. Layer 2, which is
primarily defined in Chapter 3, specifies the use of <code>&lt;schema&gt;</code>
elements in XML documents as the standard XML representation for
schema information in a broad range of computer systems and execution
environments. To support interoperation over the World Wide Web in particular,
layer 3 provides a set of conventions for schema reference on the
Web. </p>
<p>We note that improved or alternative conventions for Web interoperability can
be standardized in the future without reopening this recommendation. For
example, the W3C is currently considering initiatives to standardize the
packaging of resources relating to particular documents and/or namespaces: this
would be an addition to the mechanisms described here for layer 3. This
architecture also facilitates innovation at layer 2: for example, it would be
possible in the future to define an additional standard for the representation of
schema components which allowed e.g. type definitions to be specified piece by
piece, rather than all at once.</p>

<div2 id="layer1">
<head>Layer 1: Summary of the schema-validation core </head>
<ednote><edtext> Some of this text will probably end up in Chapter 6</edtext></ednote>
<p>The fundamental purpose of the schema-validation core is to define schema-validatity for a single
element information item and its descendants with respect to a specified type
definition. All processors are required to implement this core predicate in a
manner which conforms exactly to this specification. </p>
<p>Schema-validity is defined with reference to <termdef id="ccs" term="complete component set"> a
<term>complete component set</term> which consists of (at a minimum) the set of schema
components (definitions and declarations) required for that
validation</termdef>.  This is not a circular definition, but rather a
<emph>post facto</emph> observation:  no element information item can
be schema-valid unless all the components required by any aspect of
its (potentially recursive) validation are present in the <termref def="ccs">complete component set</termref>.</p>
<p>As specified above, each schema component is associated directly or
indirectly with a target namespace, or explicitly with no namespace. In the case of multi-namespace documents,
components for more than one target namespace will co-exist in the
complete component
set.</p>
<p>Processors have the option to assemble ( and perhaps to optimize or pre-compile) the entire complete component set prior to the start of a validation episode, or to
gather the complete component set lazily as individual components are required. In all
cases it is required that: </p>
<ulist>
  <item><p>The processor succeed in locating the definitions and declarations
  transitively required to complete a validation;</p></item>
  <item><p>that no definition or declaration changes once it has been located;</p></item>
  <item><p>If the processor chooses to acquire declarations and definitions
  dynamically, that there be no side effects of such dynamic acquisition that
  would cause the results of validation to differ from that which would have
  been obtained from the same schema components acquired in bulk.</p></item></ulist>
<note><p> the validation core is defined in terms of the schema components
comprising a complete component set; no mention is made of the schema definition
syntax (i.e. <code>&lt;schema&gt;</code>). Although many processors will acquire
schemas in this format, others may operate on compiled representations, on a
programmatic representation as exposed in some programming language, etc.
</p></note>
<p><termdef id="schema-valid" term="schema-valid">The fundamental <term>schema-valid</term> predicate
applies to an <xtermref href="">element information item</xtermref> (<B>EII</B>) and
a <termref def="key-typeDefn">type definition</termref> against the background of a set of schema components
comprising a <termref def="ccs">complete component set.</termref> </termdef></p>
<p>The obligation of a schema-aware processor as far as the schema-validation
core is concerned is to implement the definition of <termref def="schema-valid">schema-valid</termref>. The
choice of <B>EII</B>, as well as the determination of the <termref def="key-typeDefn">type definition</termref> and
<termref def="ccs">complete component set.</termref> is not specified at layer 1.</p>
<p>The <termref def="schema-valid">schema-valid</termref> predicate is defined recursively, and e.g. streaming
processors may implement it in a way that augments the complete component set during
processing in response to encountering new namespaces. The implication of the
invariants expressed above is that <termref def="schema-valid">schema-valid</termref> must be implemented so
that the <emph>same</emph> validation outcome is given in such cases as would be given if the initial invocation of
<termref def="schema-valid">schema-valid</termref> was re-performed
with the final <termref def="ccs">complete component set.</termref> replacing the one initially employed. </p>
</div2>
<div2 id="layer2">
<head>Layer 2: Schema definitions in XML</head>
<p>This is basically provided by chapter 3 of the current WD, which defines an
XML syntax for defining types and declaring elements, specifying their target namespace and collecting them into schema definitions (i.e. XML documents). On the perspective argued for here,
chapter 3 should be understood as doing two things: defining the requirements on
an XML 1.0 document for it to qualify as a schema definition;
specifying how the concrete syntax of that document (at the infoset level) maps
on to type definitions and element declarations. </p>
<note><p> The two following sections relate to assembling the complete component set for validation from multiple sources.  They should <emph>not</emph> be understood as a form of text substitution, but rather as providing mechanisms for distributed definition of schema components, with appropriate schema-specific semantics.</p></note>
<ednote><edtext> "schemaLocation" really belongs at layer 3 . . .</edtext></ednote>
<div3 id="compound-schema">
<head>Assembling a schema for a single namespace from multiple schema definition documents</head>
<p>We provide the following mechanism for assembling a complete component
set from several <code>&lt;schema&gt;</code> elements: </p>
 <scrap id="Ruleset.XS30" lang="ebnf">
  <head>Include</head>
  <prod id="nt-include">
   <lhs>include</lhs>
   <rhs><nt def="nt-schemaLoc">schemaLocation</nt></rhs>
  </prod>
  <prod id="nt-schemaLoc">
   <lhs>schemaLocation</lhs>
   <rhs><pt>URI</pt></rhs>
  </prod>
 </scrap>
<p>A <code>&lt;schema&gt;</code> element may contain one or more
<code>&lt;include&gt;</code> elements. The <code>&lt;include&gt;</code> element has a required
attribute, <code>"schemaLocation"</code>, consisting of one or more URI references, which must resolve
to another <code>&lt;schema&gt;</code> element, whose <code>"targetNamespace"</code> attribute
must be identical to the containing <code>&lt;schema&gt;</code> element's
<code>"targetNamespace"</code>. The schema derived from a <code>&lt;schema&gt;</code> then
consists of all the components it contains and all the components contained by
any schema it includes, recursively. </p>
<p>It is not an error for the same URI reference to be 'included' more
than once, but only the first inclusion is effective.
</p>
<p>It <emph>is</emph> an error for a component to be multiply defined -- see below.</p>
<note> <p> The "schemaLocation" attribute properly belongs at layer 3, and its use in this case is similar to its uses on other elements described in the next section.</p></note>
<ednote><edtext>Basing identity of schema definition on identity of URI reference as above and in 4.2.2 below is clearly less than ideal.  Do we want to try to include a clause allowing processors with good evidence that the same schema definition resource has been acquired by two different means (e.g. one absolute and one relative URI reference) to ignore one of them?</edtext></ednote>
</div3>
<div3 id="composition-schemaImport">
<head>References to schema components across namespaces</head>
<p>As described in section 2.2, every global schema component is associated with
a target namespace (or, explicitly, with none).  In this section we set out
the exact mechanism and syntax in the XML form of
schema definition by which a reference to a foreign component is made, that is, a component with a different target namespace from that of the referring component.</p>
<p>We require not only a means
of addressing such foreign components but also a signal to schema-aware processors that a
schema document contains such references and differentiates two subtly
different cases:</p>
<ulist>
<item><p>We add a <B>QName</B> ab initio datatype;</p></item>
<item><p>We declare the <code>"ref"</code> attribute on <code>&lt;group&gt;</code>, <code>&lt;element&gt;</code> and
 <code>&lt;attributeGroup&gt;</code>, the <code>"type"</code> attribute on
<code>&lt;element&gt;</code> and <code>&lt;attribute&gt;</code> and the <code>"source"</code> attribute on <code>&lt;type&gt;</code> and <code>&lt;datatype&gt;</code> to
 be of type <B>QName</B>.  Use of prefixes in such attributes is governed by
 the normal rules for <B>QName</B>s, i.e. that there must be a namespace
 declaration for the prefix in scope;</p></item>
<item><p>We provide the <code>&lt;import&gt;</code> element, which must appear at the
 beginning of schema documents to identify namespaces used in external
 references, i.e. those whose prefix or lack of it identifies them as coming
from a different namespace than the enclosing schema's target namespace.  It has a required attribute <code>"namespace"</code>
 which indicates that the schema document contains one or more
 qualified references to schema components in that namespace (via one
 or more prefixes declared with namespace declarations in the normal
 way, see above), and an optional attribute <code>"schemaLocation"</code>.  When
 only the <code>"namespace"</code> attribute is present, the schema author is
 leaving the identification of the schema to the instance, via the
 mechanisms described below.  When a <code>"schemaLocation"</code> attribute is
 present, it <emph>must</emph> contain a single URI reference which the schema
 author warrents will resolve to a schema document containing the
 component(s) referred to in the imported namespace.</p>
<note> <p> The "schemaLocation" attribute properly belongs at layer 3, and its use in this case is similar to its uses on other elements described in the next section.</p></note>
<note>
<p>The treatment of references as QNames implies that since (with the exception of
the schema for schemas) the target namespace and the XML Schema namespace
differ, without massive redeclaration of the default namespace
<emph>either</emph> internal references to the names being defined a schema
<emph>or</emph> the schema declaration and definition elements themselves must
be explicitly qualified.</p>
</note>
</item>
</ulist>
 <scrap id="Ruleset.XS21" lang="ebnf">
  <head>Import</head>
  <prod id="nt-import">
   <lhs>import</lhs>
   <rhs xml:space="preserve"><nt def="nt-namespace">namespace</nt> <nt def="nt-schemaLoc">schemaLocation</nt>?</rhs>
  </prod>
  <prod id="nt-namespace">
   <lhs>namespace</lhs>
   <rhs><pt>URI</pt></rhs>
  </prod>
  <prod id="nt-schemaLoc2" role="prefig">
   <lhs>schemaLocation</lhs>
   <rhs><pt>URI</pt></rhs>
  </prod>
 </scrap>
<note><p> This design is a compromise:  We've decided the pun of</p>
<eg xml:space="preserve">&lt;schema xmlns="http://www.w3.org/1999/XMLSchema"
        xmlns:html="http://www.w3.org/1999/XHTML">
 &lt;html:p>[Some documentation for my schema]&lt;/html:p>

 . . .

 &lt;type name="myType">
  &lt;element ref="html:p" minOccurs="0"/>
  . . .
 &lt;/type>
&lt;/schema>
</eg>
<p>
is actually OK, <emph>provided</emph> you declare the html namespace as imported
('mentioned' as well as 'used', if you will):
</p>
<eg xml:space="preserve">
  &lt;import namespace="http://www.w3.org/1999/XHTML"/>
</eg>
</note>
<p> It is an error if the <code>&lt;import&gt;</code>'s <code>"namespace"</code> and the imported schema's
target namespace are not the same. [?]</p>
<p>
It is not an error for the same URI reference to be 'imported' more
than once, but only the first import is effective.
</p>
<p>It is an error if a <code>"schemaLocation"</code> attribute in an instance
associates a different URI reference from one associated with the
same namespace in a schema.
</p>
<p>
It is an error to provide more than one
definition/declaration for the same component type within the same
target namespace: this is true regardless of whether the
definitions/declarations occur in the same schema document, or in
separate schema documents referenced via one or more parallel or
nested <code>&lt;include&gt;</code>s or two or more nested <code>&lt;import&gt;</code>s.
</p></div3></div2>
<div2 id="composition-instances">
<head>Layer 3: Web-interoperability</head>
<p>Layers 1 and 2 provide a framework for validation and XML definition of schemas in a broad variety of environments. Over time, we expect that a range
of standards and conventions will evolve to support interoperability of XML
Schema implementations on the World Wide Web. Layer 3 defines the minimum level
of function required of all conformant processors operating on the Web:
it is intended that, over time, future standards (e.g. XML Packages) for interoperability on the
Web and in other environments can be introduced without the need to republish
this specification.</p>
<note><p> The core validation architecture requires that the complete
component set of
appropriate declarations for each global element and attribute be
available. This requires may involve both resolving both
instance->schema and schema->schema references. As observed above, we anticipate
that the precise mechanisms for resolving such references will evolve over time.
In support of such evolution, we have attempted to observe the design principle that references from
one schema to another use mechanisms that directly parallel those used to
reference a schema from an instance document.</p></note>
<div3 id="schema-repr">
<head>Standards for representation and retrieval of schema definitions on the Web </head>
<p>For interoperability, schema definitions like all other Web resources are identified by
URI and retrieved using the standard mechanisms of the Web (e.g. http, https,
etc.) Schema definitions on the Web must be part of documents with the mime type <code>text/xml</code>, and are represented in the
standard XML schema definition form described by layer two (I.e. as <code>&lt;schema&gt;</code>
elements). </p>
<note><p> there will often be times when a schema definition will be a
complete XML 1.0 document with a root element of <code>&lt;schema&gt;</code>. There will be
other occasions in which <code>&lt;schema&gt;</code> elements will be contained in other
documents, perhaps referenced using fragment and/or Xpointer notation.
</p></note>
</div3>
<div3 id="schema-loc">
<head>How schema definitions are located on the Web </head>
<p>As described in section 4.1, processors are responsible for providing the
schema components (definitions and declarations) needed for validation. This
section introduces a set of normative conventions to facilitate interoperability
for instance documents and schemas retrieved and validated from the Web.</p>
<note><p> As discussed above in section 4.2, other non-Web mechanisms for delivering schemas for validation may exist, but are outside the scope of this recommendation.</p></note>
<p>The validation mechanisms of section 4.1 specify that <termref def="schema-valid">schema-valid</termref>
applies to an element information item to be validated, and the type
to be used to
validate it. Documents on the Web can be validated in their entirety, from the
document root element, or else individual elements can be selectively validated.
</p>
<p>Processors on the Web are free to attempt validation against arbitrary
complete component sets (as defined in Section 4.1) and against any type. However, it
is useful to have a common convention for determining a complete component set, and
an initial type. For this purpose, we require that for general-purpose schema-aware processors (i.e. those not specialised to one or a fixed set of pre-determined schemas), unless directed otherwise by a user the element information
item to be validated is either the document element of an information
set, or the local root of a new namespace-governed region within an
information set. </p>
<p>To determine the type declaration to be used for the validation in these cases, the
processor is required to retrieve a schema document with a "targetNamespace" matching the
namespace URI, if any, of the element information item to be
validated.   Again, unless directed otherwise, the processor must
locate within that schema a global element declaration with an NCName matching
that of the element information item to be validated. The processor must ensure that both the
element declaration, and the type declaration used in that element declaration,
are included in the complete component set for the validation. The type thus
identified is the type used for validation of the element information item.  The composition of the complete component set for validation is governed by section 4.2 above.</p>
<p>The means used to locate appropriate schema document(s) are processor and
application dependent, subject to a following requirements: </p>
<ulist>
  <item><p>Schemas are represented on the Web in the form specified by Chapter 3.</p></item>
  <item><p>The author of a document uses namespace declarations to indicate the intended
interpretation of names appearing therein; there may not be a schema
retrievable via the namespace URI.  Processors should not attempt to dereference namespace URIs unless explicitly directed to do so.
</p>
<note><p> Experience suggests that it is not in general safe or desirable from
a performance point of view to dereference NS URIs as a matter of course.  User community and/or consumer/provider agreements may establish conventions which make this a sensible strategy:  This recommendation allows but does not require this.  Users are always free to supply namespace URIs as schema location information when dereferencing <emph>is</emph> desired:  see below.</p></note></item>
<item>
<p>
On the other hand, in case a document author (human or not) created a
document with a particular schema in view, and warrents that some or
all of the document is schema-valid per that schema, we provide the
<code>"schemaLocation"</code> attribute (in the XML Schema namespace) to record
this fact with pairs of URI references (one for the namespace URI, and
one for the schema definition).</p>
<p>Again, unless directed otherwise general-purpose schema-aware processors must attempt to dereference each schema URI in the
value of "schemaLocation" to obtain a schema, whose target namespace
must match the namespace it appears in conjunction with, if any.
Failure to
  dereference the URI, failure to locate a valid document of mime type
  text/xml, failure to find a <code>&lt;schema&gt;</code> or mismatch of the targetNamespace URI is an error. </p></item>
<item>  <p><code>"schemaLocation"</code> attributes can occur on any element participating in a
  validation, and all such attributes must be processed as if they had occurred at the validation root. According to the rules of
  section 4.1, the complete component set can be lazily assembled, but is otherwise
  stable throughout a validation. Although schema location attributes can occur
  on any element, and can be processed incrementally as discovered, their effect
  is essentially global to the validation. Definitions and declarations remain
  in effect beyond the scope of the element on which the binding is declared.
  </p></item>
</ulist>
<note>  <p> The issue of the value space for QNames, in particular in the case of prefixes with no declaration, needs to be carefully elucidated in the Datatype draft.</p></note>
  <p>Multiple schema bindings can be declared using a single
attribute.  For example consider a stylesheet:</p>
<eg xml:space="preserve">
 &lt;stylesheet xmlns="http://www.w3.org/1999/Style/Transform"
            xmlns:html="http://www.w3.org/1999/XHTML"
            xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
            xsi:schemaLocation="http://www.w3.org/1999/Style/Transform
                                http://www.w3.org/1999/Style/Transform/xslt.xsd
                                http://www.w3.org/1999/XHTML
                                http://www.w3.org/1999/XHTML/xhtml.xsd"
</eg>
<note>  <p> the namespace URIs used in <code>"schemaLocation"</code> can, but need not
  match those actually qualifying the element within whose start tag it is found or its other attributes. For example, all
  schema location information can be declared on the document element
of a document, if desired,
  regardless of where the namespaces are actually used. </p></note>
  <ednote><edtext>I'm not sure about using spaces for separators -- more
thought needed.  But note by not using prefixes, we don't need to
worry about a syntax for the default namespace case.  But we <emph>do</emph> need to worry about the 'no namespace' case -- what do I put in "schemaLocation" if I don't declare <emph>any</emph> namespaces?</edtext></ednote>
<ednote><edtext>4.3.2 can still be improved by shifting more from processing language to abstract predicate language.</edtext></ednote>
<ednote><edtext>Oops, another bug with QNames:  In 4.2.2, we've left ourselves with no way in a component which <emph>does</emph> have a target namespace to refer to a component with none.</edtext></ednote>
</div3>
</div2>

</div1>
<div1 id="doc">
<head>Annotating schemas</head>
 <p>Annotation of schemas and schema components, with material for human or
computer consumption, is provided for by allowing application information and
human information at the beginning of most major schema elements, and anywhere
at the top level of schemas.</p>
 <scrap lang="ebnf" id="RuleSet.XS19">

<head>Annotations</head>
<prod id="nt-annotation">
<lhs>annotation</lhs>
<rhs> ( <nt def="nt-appinfo">appinfo</nt> | <nt def="nt-info">info</nt> )*</rhs>
</prod>
<prod id="nt-appinfo">
<lhs>appinfo</lhs>
<rhs><nt def="nt-infoSource">infoSource</nt>? <pt>[unconstrained]</pt></rhs>
</prod>
  <prod id="nt-info">
<lhs>info</lhs>
<rhs><nt def="nt-infoSource">infoSource</nt>? <pt>language</pt>? <pt>[unconstrained]</pt></rhs>
</prod>
  <prod id="nt-infoSource">
   <lhs>infoSource</lhs>
   <rhs><pt>URI</pt></rhs>
  </prod>
</scrap>
 <p><nt def="nt-info">info</nt> is intended for human consumption, <nt def="nt-appinfo">appinfo</nt> for automatic processing.  In both cases, provision is made for an optional URI reference to supplement the local information.  Schema validation does <emph>not</emph> involve dereferencing these URIs, when present.  In the case of <nt def="nt-info">info</nt>, indication may be given as to the identity of the (human) language used in the contents, using the <code>xml:lang</code> attribute.</p>
</div1>
<div1 id="conformance">
<head>Conformance *</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 in the process of being redrafted, and is not
guaranteed to be coherent yet.   The material after the <emph>stale below
here</emph> editorial note is in many cases out of sync with the material above
in sections 3 and 4.</p>
<p>We use the terms <emph>schema</emph> and
<emph>type definition</emph> and perhaps others in more careful way than has been the case
heretofore, reserving them for abstract datatypes with content as per the
abstract syntax, as opposed to XML elements per the concrete syntax.  This
change will have to be reflected upwards in due course.</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>XML information set</pt> and <pt>information item</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>Schema-validity is first and foremost a property of element information
items with respect to type definitions and schemas.  This recommendation does not cover
all aspects of how the type definitions and schemas are identified, but it
<emph>does</emph> specify quite carefully what it means to be schema-valid once
you've got them.</p>
 <p>First we define our terms:</p> 
 <p><termdef term="EII" id="fd-EII">An <term>EII</term> is an
element information item from an XML information set which conforms to <bibref ref="ref-xmlinfo"/> with Namespace processing.</termdef></p>
 <p><termdef term="TNS" id="fd-TNS">A <term>TNS</term> (for Target Namespace
Set) is a set, possibly empty, of namespace names, all denoting the same namespace</termdef>.</p>
 <p><termdef term="schema" id="fd-schema">A <term>schema</term> is a set of
named type definitions and element declarations, each associated with a <termref def="fd-TNS">TNS</termref></termdef>.</p>
 <p><termdef id="fd-type-def" term="type definition">A <term>type
definition</term> is a <termref def="fd-TNS">TNS</termref> and either a complex <term>type definition</term> as defined by the <nt def="nt-typeDefn">typeDefn</nt> production or a simple <term>type definition</term> as defined by the <nt def="nt-datatypeDefn">datatypeDefn</nt> production</termdef>.</p>
 <p><termdef term="schema-valid" id="fd-schema-valid">An <termref def="fd-EII">EII</termref> is <term>schema-valid</term> with respect to a <termref def="fd-type-def">type definition</termref> and a set of <termref def="fd-schema">schemas</termref> if and only if</termdef>:
 <ulist>
  <item>
   <p>The <termref def="fd-type-def">type definition</termref> is simple
and</p>
  </item>
  <item><p>the <termref def="fd-EII">EII</termref>'s attribute set is empty and</p></item>
  <item>
   <p>the <termref def="fd-EII">EII</termref>'s content list contains no element information items and</p>
  </item>
  <item>
   <p>the string formed by concatenating the characters of each of the
character information items in the <termref def="fd-EII">EII</termref>'s content list, if any, or else the
empty string, is an <termref def="fd-stype-instance">instance</termref> of the
<termref def="fd-effective-stype">effective stype</termref> defined by
the simple <termref def="fd-type-def">type definition</termref>'s
<nt def="nt-datatypeDefn">datatypeDefn</nt> with respect to the set of
<termref def="fd-schema">schemas</termref>.</p>
  </item>
 </ulist>
 or
 <ulist>
  <item><p>The <termref def="fd-type-def">type definition</termref> is complex
(use the name <B>ECT</B> for the <termref def="fd-effective-ctype">effective ctype</termref> as defined by
the complex <termref def="fd-type-def">type definition</termref>'s
<nt def="nt-typeDefn">typeDefn</nt> with respect to the set of
<termref def="fd-schema">schemas</termref>) and</p></item>
  <item><p>the <termref def="fd-EII">EII</termref>'s attribute set is an
instance of <B>ECT</B>'s <termref def="fd-attr-set">attribute set</termref> and</p></item>
  <item><p>the sequence of information items consisting of the element
information items and character
information items in the <termref def="fd-EII">EII</termref>'s content list is
an instance of <B>ECT</B>'s <termref def="fd-content-type">content
type</termref> with respect to the <termref def="fd-type-def">type definition</termref>'s <termref def="fd-TNS">TNS</termref>
and the set of
<termref def="fd-schema">schemas</termref>.</p></item>
 </ulist>
 </p>
 <p><termdef id="fd-effective-stype" term="effective stype">The
<term>effective stype</term> of a <nt def="nt-datatypeDefn">datatypeDefn</nt> with respect to a set of
<termref def="fd-schema">schemas</termref> is [TBFI]</termdef>.</p>
 <p><termdef id="fd-stype-instance" term="instance">A string is an
<term>instance</term> of an <termref def="fd-effective-stype">effective
stype</termref> if and only if [TBFI]</termdef></p>
 <p><termdef id="fd-effective-ctype" term="effective ctype">The
<term>effective ctype</term> of a <nt def="nt-typeDefn">typeDefn</nt> with respect to a set of
<termref def="fd-schema">schemas</termref> is [TBFI]</termdef>.  <termdef id="fd-attr-set" term="attribute set">We refer to the set of all attribute declarations in an <termref def="fd-effective-ctype">effective
ctype</termref> as its <term>attribute set</term></termdef>.  <termdef id="fd-content-type" term="content type">We refer to the simple type or content model in an <termref def="fd-effective-ctype">effective
ctype</termref> as its <term>content type</term></termdef></p>
 <p><termdef id="fd-ctype-attr-instance" term="instance">A sequence of element
and
information items is an
<term>instance</term> of an <termref def="fd-effective-ctype">effective
ctype</termref>'s <termref def="fd-content-type">content type</termref> with
respect to a <termref def="fd-TNS">TNS</termref> and a set of
<termref def="fd-schema">schemas</termref> if and only if [TBFI]</termdef></p>
 <ednote>
<edtext>The formal nature of a complex type is slightly different to that of a
simple type.  A simple type is a 3-tuple of value space, lexical space and
facets.  A value space is a (possibly infinite) set of values, a lexical space
is a (possibly infinite) set of strings.  A complex type is a (possibly
infinite) set of element information items.  These items form equivalence
classes as a result of the optionality of some properties of information items:
a pair of information items whose required properties are equivalent are
themselves equivalent.  A complex type is defined by a set of constraints which
must be satisfied by every member of that type.</edtext>
</ednote>
 <ednote>
<edtext>We can either think in terms of shallow validity, which only requires a
type definition, and checks that all attribute II and daughter EII names are as
they should be, and full (recursive) validity in which the types of those
attribute IIs and daughter EIIs are also checked.  Alas because of element
references in content models the schema set parameterises BOTH of those, I was
hoping shallow was just a matter for the type. . .</edtext>
</ednote>
 <ednote>
  <edtext>************ STALE BELOW HERE *************</edtext>
 </ednote>
<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>
 <ednote>
<edtext>All this has to go, now that we don't provide for entity definition or
substitution.</edtext></ednote>
<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 well-formed">defining a <term>nearly well-formed</term> XML
document to be one which either is well-formed per XML 1.0, or which fails to
be well-formed only because of undefined general entity references, but which
would be well-formed if it were <code>standalone="no"</code> and
identified an external subset.</termdef> We consider this justified on the
grounds that the use of a namespace declaration which refers to a schema
functions rather as an external subset, and from the XML 1.0 perspective such a
reference almost of necessity renders the document non-standalone when
schema-validation is applied.</p>
<p> <termdef id="key-epic" term="string-infoset-in-context">We use the name
<term>string-infoset-in-context</term> for the XML 1.0 information set items
arising from the interpretation of a string in the context of a particular
point in an XML 1.0 information set.</termdef></p>
<p><termdef id="key-effective-item" term="effective element item">The
<term>effective element item</term> of an element item (call this <pt>OEI</pt>)
is an element item whose</termdef>
<ulist>
<item>
<p>name and namespace items (if any) are the same as those of <pt>OEI</pt>;</p>

</item>
<item>
<p>attribute item names and namespace items (if any) are the same as those of
<pt>OEI</pt>;</p>
</item>
<item>
<p>attribute value items are the respective value items of <pt>OEI</pt>'s
attribute items with the <termref def="key-epic">string-infoset-in-context</termref> of the declared expansion of
every <termref def="gloss-RUE">RUE</termref> in those values replacing those
<termref def="gloss-RUE">RUEs</termref>; </p>
</item>
<item>
<p>children based on the children of <pt>OEI</pt> as follows:
<ulist>
<item>
<p>Character, PI and comment child items carried over unchanged;</p>
</item>
<item>
<p>Element child items replaced with their respective
<termref def="key-effective-item">effective element items</termref>;</p>
</item>
<item>
<p><termref def="gloss-RUE">RUE</termref> child items replaced by the
<termref def="key-epic">string-infoset-in-context</termref> of their declared
expansions, with any <termref def="gloss-RUE">RUE</termref> or element item in
that <termref def="key-epic">string-infoset-in-context</termref> itself being
recursively replaced per this or the above definition respectively.</p>
</item>
</ulist></p>
</item>
</ulist></p>
<p>The <specref ref="svc-embedded-RUE"/> <termref def="gloss-svc">Schema Validity Constraint</termref> obtains.</p>
<p>The <specref ref="svc-unqual-RUE"/> <termref def="gloss-svc">Schema Validity Constraint</termref> obtains.</p>
<p>Note that the above constraints and definition mean that in error-free
documents, <emph>all</emph> element items, even ones which are not
<termref def="key-schema-governed">schema-governed</termref>, have well-defined
<termref def="key-effective-item">effective element items</termref>.</p>
<p><termdef id="key-schema-valid" term="schema-valid">A document is
<term>schema-valid</term> if and only if:</termdef></p>
<olist>
<item>
<p>It is <termref def="key-nearly-wf">nearly-well-formed</termref>; </p>
</item>
<item>
<p>It is <termref def="key-doc-schema-ready">schema-ready</termref>;</p>
</item>
<item>
<p>Every <termref def="key-schema-root">schema root</termref> element item in
the set of element items consisting of the <termref def="key-effective-item">effective element item</termref> of the document
element item in the document's information set and all the element items
anywhere inside that <termref def="key-effective-item">effective element
item</termref>, is <termref def="key-ind-valid">independently valid</termref>.
</p>
</item>
</olist>
<note>
<p>The validity of all other <termref def="key-schema-governed">schema-governed</termref> element items follows from
(3) above by the recursive nature of the <termref def="gloss-svc">Schema-validity Constraint</termref> referenced there.</p>
</note>
<note>
<p>It is intentional that the above definition labels as
<termref def="key-schema-valid">schema-valid</termref> a document with
<emph>no</emph> namespace declarations or with only namespace declarations
which do <emph>not</emph> <termref def="key-nominate">nominate</termref>
schemas.</p>
</note>
<p>Note that there is no requirement that the <termref def="key-schema-root">schema root</termref> mentioned above be the root of its
document, or that schemas be the roots of <emph>their</emph> documents, or that
schema and <termref def="key-schema-root">schema root</termref> be in
<emph>different</emph> documents. Accordingly, it is possible for a single
<termref def="key-schema-valid">schema-valid</termref> document to contain both
a schema and the material which it validates.</p>
<p>The interaction between XML 1.0 DTDs and XML Schemas is complex but clear:
</p>
<ulist>
<item>
<p>A document may be well-formed, (DTD) invalid and schema-valid all at the
same time; </p>
</item>
<item>
<p>If document has a DTD which includes parsed entity declarations, the
schema-validation process may well apply to material whose original home was in
those entities (internal or external); </p>
</item>
<item>
<p>Where or not a document has a DTD, the (XML 1.0) infoset we're
schema-validating may well include 'RUE items', that is, references
to unknown entities, unknown, that is, as far as the definitions of XML 1.0 are
concerned. As long as the document's schema provides declarations
for these 'undefined' entities, it still may be
<termref def="key-schema-valid">schema-valid</termref>. </p>
</item>
</ulist>
<note>
<p>The above is silent on whether schema-valid documents must be
Namespace-conforming. </p>
</note>
<p><termdef term="augmented information set" id="key-aug-infoset">The
<term>augmented information set</term> of a <termref def="key-schema-valid">schema-valid</termref> document is the information set
rooted in the <termref def="key-effective-item">effective element
item</termref> of its document element, augmented by all the information items
described in any <termref def="gloss-sic">Schema Information Set
Contributions</termref> which apply to any information items anywhere within
it.</termdef></p>
</div2>
<div2 id="conformance-details">
 <head>Detailed validity constraints and definitions *</head>
 <div3>
  <head>The Schema *</head>
  <constraintnote type="cos" id="cos-unique">
    <head>Unique Definition</head>
    <p>The same <termref def="gloss-NCName">NCName</termref> must not appear in
      two definitions or declarations of the same type.</p>
  </constraintnote>
 </div3>
 <div3>
  <head>References to Schema Constructs *</head>
  <constraintnote type="cos" id="cos-cons-import">
  <head>Consistent Import</head>
  <p>The URI for the namespace determined by a <termref def="gloss-QName">QName</termref> used to reference a schema component must either be the <nt def="nt-targetNamespace">targetNamespace</nt> URI of the containing schema, or
    must be declared in an <specref ref="composition-schemaImport"/> of the current
    schema.</p>
</constraintnote>

  <p role="fdv"><termdef id="key-identify" term="identify">A <B>...Ref</B>
  <term>identifies</term> a <B>...Spec</B> provided there is a definition or
  declaration of that <B>...Spec</B> in the appropriate schema whose
  <termref def="gloss-NCName">NCName</termref> matches the
  <termref def="gloss-NCName">NCName</termref> of the <B>...Ref</B>'s
  <B>...Name</B>. If there is no <!--<nt def="nt-schemaRef">schemaRef</nt>--> in the
  <B>...Name</B>, the appropriate schema is the current schema or a schema it
  <termref def="key-eventually-include">eventually includes</termref>; if there
  is a <!--<nt def="nt-schemaRef">schemaRef</nt>-->, the URI contained in or abbreviated
  by it must <termref def="key-suc-res">resolve successfully</termref> to a
  schema, which is then the appropriate schema</termdef>.</p></div3>
 <div3>
  <head>Types, Elements and Attributes *</head>
  <div4>
   <head>Datatypes *</head>
   <constraintnote type="cos" id="cos-builtin">
  <head>Avoid Built-ins</head>
  <p>The <termref def="gloss-NCName">NCName</termref> must not be the same as
    the name of any of the built-in datatypes (see <bibref ref="ref-xsp2"/>).</p>
</constraintnote>
   <p role="fdv"><termdef id="key-satisfy-dt" term="dt-satisfy">A string (possibly empty)
  <term>dt-satisfies</term> a <nt def="nt-datatypeSpec">datatypeSpec</nt> and an
  optional <nt def="nt-datatypeRestr">datatypeRestriction</nt> if</termdef>
<ulist>
  <item>
    <p>The string is a valid instance of the datatype defined by that
      <nt def="nt-datatypeSpec">datatypeSpec</nt>, as restricted by the
      <nt def="nt-datatypeRestr">datatypeRestriction</nt>'s <nt def="nt-facet">facet</nt>s (if present) (see <bibref ref="ref-xsp2"/>
      for a definition of when a string is a valid instance of a (possibly
      restricted) <nt def="nt-datatypeSpec">datatypeSpec</nt>); </p>
  </item>
</ulist>
and
<ulist>
  <item>
    <p>If there is a <nt def="nt-datatypeRestr">datatypeRestriction</nt> and it
      includes a <pt>fixed</pt>, the string matches that fixed value. </p>
  </item>
</ulist>
</p>
   <constraintnote type="sic" id="sic-datatype">
  <head>Datatype Info</head>
  <p>When a string <termref def="key-satisfy-dt">dt-satisfies</termref> a
    <nt def="nt-datatypeRef">datatypeRef</nt> and an optional
    <nt def="nt-datatypeRestr">datatypeRestriction</nt>, the containing attribute or
    element information item will be augmented to indicate the
    <nt def="nt-datatypeSpec">datatypeSpec</nt> and the <nt def="nt-facet">facet</nt>s (if any) which it satisfied.</p>
</constraintnote></div4>
  <div4>
   <head>Type Definition *</head>
   <constraintnote type="cos" id="cos-attrg-unique">
<head>AttrGroup Unique</head>
<p>The same <nt def="nt-attributeGroupDefn">attributeGroupDefn</nt> must not be
  referenced by two or more <nt def="nt-attributeGroupRef">attributeGroupRef</nt>s in the
  same <nt def="nt-typeSpec">typeSpec</nt>.</p>
</constraintnote>
  <constraintnote type="cos" id="cos-attrg-ided">
<head>AttrGroup Identified</head>
<p>Every <nt def="nt-attributeGroupRef">attributeGroupRef</nt> in an
  <nt def="nt-typeSpec">typeSpec</nt> must <termref def="key-identify">identify</termref> an <nt def="nt-attributeGroupDefn">attributeGroupDefn</nt>.</p>
</constraintnote>
   <p role="fdv"><termdef id="key-attr-decl-set" term="attribute declaration set">The
<term>attribute declaration set</term> of an <nt def="nt-typeSpec">typeSpec</nt> consists of all its
<termref def="key-effective">effective</termref> <nt def="nt-attrDecl">attributes</nt> together with all the <nt def="nt-attrDecl">attributes</nt> contained in the <nt def="nt-attributeGroupDefn">attribute groups</nt> <termref def="key-identify">identified</termref> by any <nt def="nt-attributeGroupRef">attributeGroupRefs</nt> it contains.</termdef></p>
  <p role="fdv"><termdef id="key-attr-fullname" term="full name of an attribute declaration">The <term>full name</term> of an
<nt def="nt-attrDecl">attribute</nt> in an <termref def="key-attr-decl-set">attribute declaration set</termref> is its
<termref def="gloss-NCName">NCName</termref> plus its <!--<nt def="nt-schemaName">schemaName</nt>-->, i.e. if it appeared directly in the
<nt def="nt-typeSpec">typeSpec</nt>, the empty string, if it was
inherited or if it came from an
<nt def="nt-attributeGroupDefn">attribute group</nt>, then the <!--<nt def="nt-schemaName">schemaName</nt> from the <nt def="nt-schemaRef">schemaRef</nt>--> which <termref def="key-identify">identified</termref> the relevant <nt def="nt-typeSpec">typeSpec</nt> or <nt def="nt-attributeGroupDefn">attribute group</nt> respectively, if any, otherwise the
empty string.</termdef></p>
  <constraintnote type="cos" id="cos-attr-unique">
<head>Attribute Locally Unique</head>
<p>The same <termref def="key-attr-fullname">full name</termref> must not
  appear more than once in any <nt def="nt-typeSpec">typeSpec</nt>'s
  <termref def="key-attr-decl-set">attribute declaration set</termref>.</p>
</constraintnote>
<p role="fdv"><termdef id="key-satisfy-as" term="arch-satisfy">An element item
<term>a-satisfies</term> an <nt def="nt-typeSpec">typeSpec</nt> if
the element item's attribute items taken together as a set
<termref def="key-satisfy-attrs">attrs-satisfy</termref> the
<nt def="nt-typeSpec">typeSpec</nt>'s
<termref def="key-attr-decl-set">attribute declaration set</termref>, and
either </termdef>
<ulist>
<item>
  <p>The <nt def="nt-typeSpec">typeSpec</nt>'s
    <nt def="nt-contentType">contentType</nt> is a <nt def="nt-datatypeRef">datatypeRef</nt>, the <nt def="nt-datatypeRef">datatypeRef</nt> <termref def="key-identify">identifies</termref> a <nt def="nt-datatypeSpec">datatypeSpec</nt>, the element item contains only
    comment, processing instruction and character information items and the string
    formed by concatenating the characters of each of the character information
    item children, if any, or else the empty string, <termref def="key-satisfy-dt">dt-satisfies</termref> that <nt def="nt-datatypeSpec">datatypeSpec</nt> as qualified by the
    <nt def="nt-datatypeRef">datatypeRef</nt>'s <nt def="nt-datatypeRestr">datatypeRestriction</nt> if any;</p>
</item>
</ulist>
or
<ulist>
<item>
  <p>the <nt def="nt-contentType">contentType</nt> is a
    <nt def="nt-contentModel">contentModel</nt>, and the sequence of character and
    element items contained by the element item <termref def="key-satisfy-cm">model-satisfies</termref> its <termref def="key-effective">effective</termref> <nt def="nt-contentModel">contentModel</nt>.</p>
</item>
</ulist>
</p>
<issue id="sic-elt-default">
<p>The above definitions do not provide for handling a default on an
  type's datatypeRef. Preferred solution: empty element items
  <emph>ipso facto</emph> satisfy datatypeRefs with defaults and are augmented
  with the default value. This would have the consequence that you cannot provide
  the empty string as the explicit value of an element item if it's governed
  by a datatypeRef with a default.</p>
</issue>
  <constraintnote type="sic" id="sic-type">
<head>Type Info</head>
<p>When an element item <termref def="key-satisfy-as">a-satisfies</termref> a
  <nt def="nt-typeSpec">typeSpec</nt>, that element information item
  will be augmented to indicate the <nt def="nt-typeSpec">typeSpec</nt>
  which it satisfied.</p>
</constraintnote>
  </div4>
  <div4>
   <head>Attribute Declaration *</head>
  <p role="fdv"><termdef id="key-attr-satisfy" term="attr-satisfy">An attribute item
<term>attr-satisfies</term> an <nt def="nt-attrDecl">attribute</nt> if
</termdef>
<ulist>
<item>
<p>The <nt def="nt-attrDecl">attribute</nt> contains no <nt def="nt-datatypeRef">datatypeRef</nt> and the attribute item's value
string <termref def="key-satisfy-dt">dt-satisfies</termref> the default
<nt def="nt-datatypeSpec">datatypeSpec</nt> for attributes</p>
</item>
</ulist>
or
<ulist>
<item>
<p>the <nt def="nt-attrDecl">attribute</nt>'s <nt def="nt-datatypeRef">datatypeRef</nt> <termref def="key-identify">identifies</termref> a <nt def="nt-datatypeSpec">datatypeSpec</nt> and the attribute item's value
string <termref def="key-satisfy-dt">dt-satisfies</termref> that
<nt def="nt-datatypeSpec">datatypeSpec</nt> as qualified by the
<nt def="nt-datatypeRef">datatypeRef</nt>'s <nt def="nt-datatypeRestr">datatypeRestriction</nt> if any</p>
</item>
</ulist>
where the attribute item's value consists of only character information
items and by its "value string" is meant the string formed by
concatenating the characters of each of those character information item
children, if any, or else the empty string.
</p>
  <p role="fdv"><termdef id="key-satisfy-attrs" term="attrs-satisfy">The attribute items of
an element item <term>attrs-satisfy</term> an <termref def="key-attr-decl-set">attribute declaration set</termref> if</termdef>
<ulist>
<item>
<p><B>1)</B> for each attribute item either</p>
<ulist>
<item>
<p><B>1a) </B>there is an <nt def="nt-attrDecl">attribute</nt> in the
  <termref def="key-attr-decl-set">attribute declaration set</termref> whose
  <termref def="key-attr-fullname">full name</termref> consists of an
  <termref def="gloss-NCName">NCName</termref> which matches the attribute
  item's name and either</p>
<ulist>
  <item>
    <p><B>1a1) </B>the attribute item has no namespace and the
      <nt def="nt-attrDecl">attribute</nt>'s <termref def="key-attr-fullname">full name</termref> has no <!--<nt def="nt-schemaName">schemaName</nt>--></p>
  </item>
</ulist>
<p>or</p>
<ulist>
  <item>
    <p><B>1a2) </B>the attribute item's namespace and the
      <nt def="nt-attrDecl">attribute</nt>'s <termref def="key-attr-fullname">full name</termref>'s <!--<nt def="nt-schemaName">schemaName</nt>--> are <termref def="key-identical">identical</termref></p>
  </item>
</ulist>
<p>and the attribute item <termref def="key-attr-satisfy">attr-satisfies</termref> the declaration</p>
</item>
</ulist>
<p>or</p>
<ulist>
<item>
<p><B>1b) </B>the <nt def="nt-typeSpec">typeSpec</nt> being
  <termref def="key-satisfy-as">a-satisfied</termref> by the attribute
  item's parent element item is <pt>open</pt></p>
</item>
</ulist>
</item>
</ulist>
and
<ulist>
<item>
<p><B>2) </B>every <nt def="nt-attrDecl">attribute</nt> in the
<termref def="key-attr-decl-set">attribute declaration set</termref> which is
<pt>required</pt> is used to <termref def="key-attr-satisfy">attr-satisfy</termref> an attribute item in the context
of (1a) above</p>
</item>
</ulist>
</p>
   <constraintnote type="sic" id="sic-attr-default">
<head>Attribute Value Default</head>
<p>For every <nt def="nt-attrDecl">attribute</nt> in the
<termref def="key-attr-decl-set">attribute declaration set</termref>
<emph>not</emph> used to <termref def="key-attr-satisfy">attr-satisfy</termref>
an attribute item in the context of (1a) above which has a
<nt def="nt-datatypeRef">datatypeRef</nt> which has a <pt>default</pt>, an
attribute item with the default value is added to the parent element item.</p>
</constraintnote></div4>
  <div4>
   <head>Element Content Model *</head>
     <p role="fdv"><termdef id="key-satisfy-cm" term="model-satisfies">A sequence of character
and element items (call this <pt>CESeq</pt>) <term>model-satisfies</term> an
<termref def="key-effective">effective</termref> <nt def="nt-contentModel">contentModel</nt> if</termdef>
<ulist>
<item>
<p>the sequence is empty and the <termref def="key-effective">effective</termref> <nt def="nt-contentModel">contentModel</nt> is <pt>empty</pt>;</p>
</item>
<item>
<p>the <termref def="key-effective">effective</termref>
<nt def="nt-contentModel">contentModel</nt> is <pt>any</pt> and every element
item in <pt>CESeq</pt> is <termref def="key-ind-valid">independently
valid</termref>, and for every element item in <pt>CESeq</pt> such that the
schema which its namespace item resolves to is not the current schema there is
an <nt def="nt-import">import</nt> whose <!--<nt def="nt-schemaName">schemaName</nt>--> is <termref def="key-identical">identical</termref> to that element item's namespace
item's <pt>URI</pt> and that <nt def="nt-import">import</nt> must either
be <pt>allElements</pt> or contain an <nt def="nt-elementRef">elementRef</nt> whose <pt>NCName</pt> matches that
element item's name;</p>
</item>
<item>
<p>the <termref def="key-effective">effective</termref>
<nt def="nt-contentModel">contentModel</nt> is <pt>mixed</pt>
and every element item in <pt>CESeq</pt> <termref def="key-satisfy-mixed">mixed-satisfies</termref> the
<termref def="key-effective">effective</termref> <pt>mixed</pt>
</p>
</item>
</ulist>
or
<ulist>
<item>
<p>the <termref def="key-effective">effective</termref>
<nt def="nt-contentModel">contentModel</nt> is <termref def="nt-elementOnly">elementOnly</termref> and the only character items in
<pt>CESeq</pt> are whitespace character items and the sub-sequence of
<pt>CESeq</pt> consisting of all the element items therein
<termref def="key-satisfy-eo">eo-satisfies</termref> the
<termref def="key-effective">effective</termref> <termref def="nt-elementOnly">elementOnly</termref>.</p>
</item>
</ulist>
</p>
  </div4>
  <div4>
   <head>Mixed Content *</head>
   <constraintnote type="cos" id="cos-et-reuse">
<head>Element Unique in Mixed</head>
<p>A given <termref def="gloss-NCName">NCName</termref> must not appear two or
more times among the <nt def="nt-elementDecl">elementDecl</nt>s and
<nt def="nt-elementRef">elementRef</nt>s with no <!--<nt def="nt-schemaRef">schemaRef</nt>s;--> a given <nt def="nt-elementName">elementName</nt> must not appear two or more times
among the <nt def="nt-elementRef">elementRef</nt>s.</p>
</constraintnote>
   <p role="fdv"><termdef id="key-satisfy-mixed" term="mixed-satisfy">An element item
<term>mixed-satisfies</term> a <pt>mixed</pt> if</termdef>
<ulist>
<item>
<p>the <pt>mixed</pt> contains an <nt def="nt-elementRef">elementRef</nt> which the element item
<termref def="key-satisfy-etr">ref-satisfies</termref></p>
</item>
</ulist>
or
<ulist>
<item>
<p>the <pt>mixed</pt> contains an <nt def="nt-elementDecl">elementDecl</nt> whose <termref def="gloss-NCName">NCName</termref> matches the element item's name, in
which case the element item must <termref def="key-satisfy-ed">e-satisfy</termref> that <nt def="nt-elementDecl">elementDecl</nt></p>
</item>
</ulist>
or
<ulist>
<item>
<p>the <nt def="nt-typeSpec">typeSpec</nt> which
<termref def="key-effective">effectively</termref> contains the
<pt>mixed</pt> is <pt>open</pt> and the element item is
<termref def="key-ind-valid">independently valid</termref>.</p>
</item>
</ulist>
<issue id="mixed-change-current-schema">
<p>There's an implicit change in current schema in the definition of
satisfy-mixed above which should be made explicit.</p>
</issue>
</p>
</div4>
  <div4>
   <head>Element-only Content *</head>
   <p role="fdv"><termdef id="key-satisfy-eo" term="elementOnly-satisfy">A sequence of element
items <term>elementOnly-satisfies</term> an <termref def="key-effective">effective</termref> <nt def="nt-elementOnly">elementOnly</nt>
if</termdef>
<ulist>
<item>
<p>it is possible to trace out a path through the content model, obeying the
<nt def="nt-compositor">compositor</nt> and <nt def="nt-occurs">occurs</nt>
specifications and accepting each element item in the sequence with an
<nt def="nt-elementRef">elementRef</nt> or <nt def="nt-elementDecl">elementDecl</nt> in the content model. Accepting
an element item from the sequence with an <nt def="nt-elementRef">elementRef</nt> requires that it
<termref def="key-satisfy-etr">ref-satisfy</termref> that
<nt def="nt-elementRef">elementRef</nt>; accepting an element item with
an <nt def="nt-elementDecl">elementDecl</nt> requires that the
<nt def="nt-elementDecl">elementDecl</nt>'s
<termref def="gloss-NCName">NCName</termref> matches the element item's
name, in which case the element item must <termref def="key-satisfy-ed">e-satisfy</termref> that <nt def="nt-elementDecl">elementDecl</nt>.</p>
</item>
</ulist>
<note>
<p>The above definition of elementOnly-satisfy does not explicitly incorporate the
modifications required when the containing type is <emph>open</emph>, as
set out at the end of <specref ref="declare-refinement"/>, but it should be
understood as doing so.</p>
</note>
</p>
<constraintnote type="cos" id="cos-elt-consist">
<head>Element Consistency</head>
<p>A given <termref def="gloss-NCName">NCName</termref> must not appear both
among the <nt def="nt-elementDecl">elementDecl</nt>s and among the
<nt def="nt-elementRef">elementRef</nt>s with no <!--<nt def="nt-schemaRef">schemaRef</nt>-->s, or more than once among the
<nt def="nt-elementDecl">elementDecl</nt>s.</p>
</constraintnote>
<note>
<p>Note that the above permits repeated use of the same
<nt def="nt-elementRef">elementRef</nt>, analogous to DTD usage.</p>
</note>
<note><p>EDITORS: Add a COS for the checking of valid pairs of minOccurs and maxOccurs.</p>
</note>
  </div4>
  <div4>
   <head>Element Declaration *</head>
   <p role="fdv"><termdef id="key-elt-fullname" term="full name of an element declaration">The <term>full name</term> of a
top-level <nt def="nt-elementDecl">elementDecl</nt> is its
<termref def="gloss-NCName">NCName</termref> plus its <!--<nt def="nt-schemaName">schemaName</nt>-->, i.e. if it appeared directly in the
current schema or an <nt def="nt-include">include</nt>, the empty string, if it
was <nt def="nt-import">imported</nt>, then the <!--<nt def="nt-schemaName">schemaName</nt>--> of that <nt def="nt-import">import</nt>,
which must <termref def="key-suc-res">successfully resolved</termref> to its
containing schema.</termdef></p>
  <p role="fdv"><termdef id="key-satisfy-ed" term="e-satisfy">An element item
<term>e-satisfies</term> an <nt def="nt-elementDecl">elementDecl</nt>
if the <nt def="nt-elementDecl">elementDecl</nt></termdef>:
<ulist>
<item>
<p>contains an <nt def="nt-typeSpec">typeSpec</nt> directly, and the
element item <termref def="key-satisfy-as">a-satisfies</termref> that
<nt def="nt-typeSpec">typeSpec</nt>;</p>
</item>
</ulist>
or
<ulist>
<item>
<p>the <nt def="nt-typeRef">typeRef</nt> alternative is used in that
<nt def="nt-elementDecl">elementDecl</nt> and it
<termref def="key-identify">identifies</termref> an <nt def="nt-typeSpec">typeSpec</nt> and the element item
<termref def="key-satisfy-as">a-satisfies</termref> that
<nt def="nt-typeSpec">typeSpec</nt>.</p>
</item>
</ulist>
</p>
   <constraintnote type="cos" id="cos-local-global">
<head>Nested May Not Be Global</head>
<p>An <nt def="nt-elementSpec">elementSpec</nt> in a nested
<nt def="nt-elementDecl">elementDecl</nt> must not be <pt>global</pt>.
</p>
</constraintnote>
  <constraintnote type="cos" id="cos-respect-global">
<head>Cannot Shadow Global</head>
<p>If a top-level <nt def="nt-elementSpec">elementSpec</nt> is
<pt>global</pt>, then the <termref def="gloss-NCName">NCName</termref> of its
<nt def="nt-elementDecl">elementDecl</nt> must not be redeclared by any
nested <nt def="nt-elementDecl">elementDecl</nt> in the same schema or
any schema it <termref def="key-eventually-include">eventually
includes</termref>.</p>
</constraintnote>
   <p role="fdv"><termdef id="key-ind-valid" term="independently valid">An element item is
<term>independently valid</term> if there is a top-level
<nt def="nt-elementDecl">elementDecl</nt> whose
<termref def="gloss-NCName">NCName</termref> matches its name in the schema its
namespace item resolves to (or a schema that schema
<termref def="key-eventually-include">includes</termref>, in which case see the
definition of <termref def="key-identify">identify</termref> for details on
which declaration is used if there is more than one), and the element item must
<termref def="key-satisfy-ed">e-satisfy</termref> that
<nt def="nt-elementDecl">elementDecl</nt>.</termdef></p>
  <p role="fdv"><termdef id="key-satisfy-etr" term="ref-satisfies">An element item
<term>ref-satisfies</term> an <nt def="nt-elementRef">elementRef</nt>
if</termdef>
<ulist>
<item>
<p> the <nt def="nt-elementRef">elementRef</nt>
<termref def="key-identify">identifies</termref> an
<nt def="nt-elementDecl">elementDecl</nt> whose
<termref def="gloss-NCName">NCName</termref> matches the element item's
name and either</p>
<ulist>
<item>
<p>the <nt def="nt-elementDecl">elementDecl</nt>'s
<termref def="key-elt-fullname">full name</termref> has no
<!--<nt def="nt-schemaName">schemaName</nt>-->, in which case the element item's
namespace must be the same as its parent's namespace</p>
</item>
</ulist>
<p>or</p>
<ulist>
<item>
<p>the element item's namespace and the <nt def="nt-elementDecl">elementDecl</nt>'s
<termref def="key-elt-fullname">full name</termref>'s
<!--<nt def="nt-schemaName">schemaName</nt>--> are <termref def="key-identical">identical</termref></p>
</item>
</ulist>
<p>in which case the element item must also <termref def="key-satisfy-ed">e-satisfy</termref> the <nt def="nt-elementDecl">elementDecl</nt>.</p>
</item>
</ulist>
or
<ulist>
<item>
<p> the <nt def="nt-elementRef">elementRef</nt>
<termref def="key-identify">identifies</termref> an
<nt def="nt-elementDecl">elementDecl</nt> (call this <pt>ETD1</pt>), the element
item is <termref def="key-ind-valid">independently valid</termref> and the <nt def="nt-elementDecl">elementDecl</nt> whereby it is independently validated
contains or identifies an <nt def="nt-typeSpec">typeSpec</nt> which <termref def="key-refine">refines</termref> the <nt def="nt-typeSpec">typeSpec</nt> contained in
or identified by ETD1.</p>
</item>
</ulist>
<note>
<p>The last clause above is <emph>much</emph> too complex, it needs to be split
apart and built up in stages. It is this which allows elements based on
refining types to appear in place of those based on their ancestors.</p>
</note>
</p>
  </div4>
 </div3>
 <div3>
  <head>Type Refinement *</head>
  <constraintnote id="cos-refine-ok" type="cos">
<head>Allowed Refinements</head>
<p>a type must not declare another type as its basetype if the
latter has been declared <pt>final</pt>.</p>
</constraintnote>
 </div3>
 <div3>
  <head>Import Restrictions *</head>
  <constraintnote type="cos" id="cos-ref-schema">
<head>Refer to Schema</head>
<p>The URI associated with a <!--<nt def="nt-schemaRef">schemaRef</nt>--> in any of
the productions above must <termref def="key-suc-res"> successfully
resolve</termref> to a schema. </p>
</constraintnote>
  <constraintnote type="cos" id="cos-find-name">
<head>Name Consistently Defined</head>
<p>The <termref def="gloss-NCName">NCName</termref> in each of the above
productions must identify a declaration or definition of the corresponding
class (element, type, etc.) </p>
</constraintnote>
  <constraintnote type="svc" id="svc-use-unexported">
<head>Use Only Exported Defns</head>
<p>It is not an error for a schema to explicitly import a construct which has
not been exported. However, it is an error for a schema to attempt to use such
construct. </p>
</constraintnote>
 </div3>
 <div3>
  <head>Schema Inclusion *</head>
  <constraintnote type="cos" id="cos-ident-ref">
<head>Preorder Priority for Included Definitions</head>
<p>When using a <B>...Ref</B> to <termref def="key-identify">identify</termref>
a <B>...Spec</B>, if there is no appropriate matching declaration or definition
in the current schema, but there is more than one
<termref def="key-eventually-include">eventually included</termref> schema
which contains an appropriate matching declaration or definition, the
<B>...Spec</B> whose declaration or definition occurs first in a preorder
traversal of the <termref def="key-eventually-include">eventually
included</termref> schemas is the one <termref def="key-identify">identified</termref>.</p>
</constraintnote>

  <p role="fdv"><termdef term="directly include" id="key-directly-include">A schema
<term>directly includes</term> another schema if the first schema has an
<nt def="nt-include">include</nt> and the URI contained in or abbreviated by
the <!--<termref def="nt-schemaRef">schemaRef</termref>--> of that
<nt def="nt-include">include</nt> <termref def="key-suc-res">resolves
successfully</termref> to the second schema</termdef>.</p>
  <p role="fdv"><termdef id="key-eventually-include" term="eventually include">A schema
<term>eventually includes</term> another schema if the first schema
<termref def="key-directly-include">directly includes</termref> the second, or
if the first schema <termref def="key-directly-include">directly
includes</termref> some other schema which itself
<termref def="key-eventually-include">eventually includes</termref> the
second.</termdef></p></div3>
 <div3>
  <head>Schema Validity *</head>
  <constraintnote id="svc-embedded-RUE" type="svc">
<head>Expansions Schema-Ready</head>
<p>Any element item anywhere within the <termref def="key-epic">string-infoset-in-context</termref> replacing an RUE child per
the above must be <termref def="key-schema-ready">schema-ready</termref>.</p>
</constraintnote>
  <constraintnote type="svc" id="svc-unqual-RUE">
<head>Ungoverned RUE</head>
<p><termref def="gloss-RUE">RUEs</termref> must not appear in element items
which are not <termref def="key-schema-governed">schema-governed</termref>,
that is in the values of attributes of or as children of such elements.</p>
</constraintnote>
   </div3>
 </div2>
<div2 id="conformance-processorResponsibilities">
<head>Responsibilities of Schema-aware processors *</head>
<note>
<p>This section has fallen out of alignment with the rest of the specification,
but is included none-the-less to give a feeling for how this section will
eventually look: the details should <emph>not</emph> be taken too seriously.
</p>
</note>
<p>Each step in the following presupposes the successful outcome of the
previous step.</p>
<p>A conforming XML Schema processor must: </p>
<olist>
<item>
<p>Test for XML 1.0 well-formedness;</p>
</item>
<item>
<p>Construct the XML 1.0 information set. This will include identifying and
distinguishing all namespace declarations and uses, and expanding any entity
references whose XML 1.0 declarations are accessible;</p>
</item>
<item>
<p>Starting from the root, traverse the information set in pre-order until an
element information item with a namespace declaration which refers to an
accessible schema is found;</p>
</item>
<item>
<p>Schema-validate the information set subtree rooted at that element
information item using that schema, i.e.
<ulist>
<item>
<p>Schema-validate the resulting information set, as described in
<specref ref="conformance-schemaValidity"/>;</p>
</item>
<item>
<p>Expand the information set per all <termref def="gloss-sic">Schema
Information Set Contribution</termref>s encountered
<ulist>
<item>
<p>for each namespace: its prefixes and URI, and access to a schema
corresponding to that URI. </p>
</item>
<item>
<p>for each element: its name (URI+GI), its content, its datatype or type,
its attributes </p>
</item>
<item>
<p>for each attribute: its name, its value(s), its datatype, and whether its
presence is required on an element. </p>
</item>
<item>
<p>for each datatype: its names, its heritage (or type lattice), its value
space, its refinable facets. </p>
</item>
<item>
<p>for data: its datatype (and type lattice), whether its presence is
required, and its lexical constraints. </p>
</item>
<item>
<p>for each type: its name, its content model or datatype, its heritage
(or type lattice), its attributes, and whether it is open/closed or can be
refined. </p>
</item>
<item>
<p>for each element: its name, its datatype or type or content model,
its attributes, and whether it is open/closed or can be refined. </p>
</item>
<item>
<p>for each model: whether it is any, empty, mixed, or a group of one or more
elements -- in which case, the grammar of the group, and whether it is
open/closed or can be refined. </p>
</item>
</ulist> </p>
</item>
</ulist> </p>
</item>
<item>
<p>Go back to (3) above and continue traversing, starting with the successor in
document order to the item just schema-validated, unless there is no successor;
</p>
</item>
<item>
<p> Provide for an external processing system to have access to the combined
information set: document instance plus schema information.</p>
</item>
</olist>
<note>
<p>Note that the schema contribution to the information set above is meant to
be suggestive only at this point, until we've articulated all the
<termref def="gloss-sic">Schema Information Set Contribution</termref>s in the
preceding sections.</p>
</note>
</div2>
<div2 id="conformance-lexical">
<head>Lexical representation *</head>
<note>
<p>The editors did not get to this.</p>
</note>
</div2>
<div2 id="conformance-infoSet">
<head>Information set *</head>
<note>
<p>The editors did not get to this.</p>
</note>
</div2>
</div1>
</body>

<back>
<div1 id="normative-schemaSchema">
<head>(normative) Schema for Schemas</head>
<p>The XML Schema definition for &XSP1; itself is presented here as normative
part of the specification, and as an illustrative example of the XML Schema in
defining itself with the very constructs that it defines. The names of XML
Schema language types, elements, attributes and groups defined here
are evocative of their purpose, but are occasionally verbose. </p>
<p>There is some annotation in comments, but a fuller annotation will require
the use of embedded documentation facilities or a hyperlinked external
annotation for which tools are not yet readily available.</p>
<p>Since an &XSP1; is an XML document, it has optional XML and doctype
declarations that are provided here for completeness. The root
<code>schema</code> element defines a new schema. Since this is a schema for
&XSP1;, the <code>targetNS</code> references the XML Schema namespace itself, and specifies that this
is version "&XSP1.version;".</p>
<p>In the following definition of the <code>schema</code> element, the
<nt def="nt-preamble">preamble</nt> is realised with attributes corresponding
to <nt def="nt-targetNamespace">targetNamespace</nt> and <nt def="nt-schemaVersion">schemaVersion</nt>. The
<code>xmlns</code> attribute corresponds to <nt def="nt-xmlSchemaRef">xmlSchemaRef</nt>. The
<code>schema</code>'s definitions and declarations are represented by
<code>datatype</code>, <code>type</code>, <code>element</code>,
<code>attribute</code>, <code>attributeGroup</code>, <code>group</code> and <code>notation</code>.</p>
<eg xml:space="preserve"><![CDATA[<?xml version='1.0'?>
<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 19991216//EN" "structures.dtd" [
<!ATTLIST schema xmlns:x CDATA #IMPLIED> <!-- keep this schema XML1.0 valid -->
]>
<schema xmlns="<]]>&XMLSchemaNS;<![CDATA[" targetNamespace="<]]>&XMLSchemaNS;<![CDATA[" xmlns:x="http://www.w3.org/XML/1998/namespace" version="Id: structures.xsd,v 1.28 1999/12/16 09:43:47 aqw Exp ">

 <!-- get access to the xml: attribute groups for xml:lang -->
 <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/XML/1998/xml.xsd"/>


  <!-- The datatype element and all of its members are defined
       in XML Schema: Part 2: Datatypes -->

  <include schemaLocation="<]]>&XSP2.URI;<![CDATA[.xsd"/>

  <type name="annotated">
   <annotation>
    <info>This type is extended by all types which allow annotation
          other than &lt;schema> itself</info>
   </annotation>
   <element ref="annotation" minOccurs="0"/>
  </type>

  <element name="schemaTop" abstract="true" type="annotated">
   <annotation>
    <info>This abstract element defines an equivalence class over the
          elements which occur freely at the top level of schemas.
          These are: datatype, type, element, attributeGroup, group, notation
          All of their types are based on the "annotated" type
          by extension.</info>
   </annotation>
  </element>

  <!-- schema element -->

  <element name="schema">
   <annotation>
    <info>The obnoxious duplication in the content model below is to avoid
         infringing the no-ambiguity constraint while still allowing
         annotation virtually anywhere.</info>
   </annotation>
    <type>
      <group order="choice" minOccurs="0" maxOccurs="*">
       <element ref="include"/>
       <element ref="import"/>
       <element ref="annotation"/>
      </group>
      <element ref="schemaTop"/>
      <group order="choice" minOccurs="0" maxOccurs="*">
        <element ref="annotation"/>
        <element ref="schemaTop"/>
      </group>
    <attribute name="targetNamespace" type="uri"/>
    <attribute name="version" type="string"/>
   <attribute name="finalDefault" type="derivationSet"/>
   <attribute name="exactDefault" type="exactSet"/>
   </type>
  </element>

  <!-- annotation element -->

  <element name="annotation">
   <type>
    <group order="choice" minOccurs="0" maxOccurs="*">
     <element name="appinfo">
       <type content="mixed">
         <any minOccurs="0" maxOccurs="*"/>
         <attribute name="source" type="uri"/>
       </type>
     </element>
     <element name="info">
       <type content="mixed">
         <any minOccurs="0" maxOccurs="*"/>
         <attribute name="source" type="uri"/>
         <attributeGroup ref="x:lang"/>
       </type>
     </element>
    </group>
   </type>
  </element>


  <!-- For references to a type -->
  <!-- 'element', 'attribute' and any all use this  -->

  <attributeGroup name="typeRef">
    <attribute name="type" type="QName"/>
  </attributeGroup>

  <!-- For 'element' and 'attribute' -->
  <attributeGroup name="valueConstraint">
   <attribute name="default" type="string"/>
   <attribute name="fixed" type="string"/>
  </attributeGroup>


  <!-- for all particles -->
  <attributeGroup name="occurs">
    <attribute name="minOccurs" type="non-negative-integer" default="1"/>
    <attribute name="maxOccurs" type="string"/> <!-- allows '*', so integer
                                                       won't do -->
  </attributeGroup>

  <!-- for element, group and attributeGroup, which both define and reference -->
  <attributeGroup name="defRef">
   <attribute name="name" type="NCName" minOccurs="0"/>
   <attribute name="ref" type="QName" minOccurs="0"/>
  </attributeGroup>

  <!-- 'element', 'group' and 'any' -->
  <group name="particle" order="choice">
   <element name="element" type="element"/>
   <element name="group" type="anonGroup"/>
   <element ref="any"/>
  </group>
 
  <group name="restrictionParticle" order="choice">
   <element name="sic"><type content="empty"/></element>
   <group ref="particle"/>
  </group>
 
  <group name="attrDecls">   
   <group order="choice" minOccurs="0" maxOccurs="*">
    <element ref="attribute"/>
    <element ref="attributeGroup"/>
   </group>
   <element name="anyAttribute" type="namespaceList" minOccurs="0"/>
  </group>

  <!-- types for type -->

  <type name="type" source="annotated" derivedBy="extension" abstract="true">
   <group order="choice">
    <element ref="restrictions" minOccurs="0"/>
    <group>
     <group ref="particle" minOccurs="0" maxOccurs="*"/>
     <group ref="attrDecls"/>
    </group>
   </group>
   <attribute name="name" type="NCName" minOccurs="0">
    <annotation>
     <info>Will be restricted to required or forbidden</info>
    </annotation>
   </attribute>
   <attribute name="content">
    <datatype source="NMTOKEN">
     <enumeration value="elementOnly"/>
     <enumeration value="textOnly"/>
     <enumeration value="mixed"/>
     <enumeration value="empty"/>
    </datatype>
   </attribute>
   <attribute name="source" type="QName"/>
   <attribute name="derivedBy" type="derivationChoice"/>
   <attribute name="abstract" type="boolean" default="false"/>
   <attribute name="final" type="derivationSet"/>
   <attribute name="exact" type="derivationSet"/>
  </type>
 
  <type name="namedType" source="type" derivedBy="restriction">
   <annotation>
    <info>This is for the top-level type element, daughter of &lt;schema</info>
   </annotation>
   <attribute name="name" minOccurs="1">
    <annotation><info>Required at the top level</info></annotation>
   </attribute>
  </type>
 
  <type name="anonType" source="type" derivedBy="restriction">
   <annotation>
    <info>This is for the nested type element, daughter of &lt;element</info>
   </annotation>
   <attribute name="name" maxOccurs="0">
    <annotation><info>Forbidden when nested</info></annotation>
   </attribute>
  </type>

  <!-- Top level type element, daughter of schema -->
  <element name="type" equivClass="schemaTop" type="namedType"/> 

  <key name="type">
   <selector>schema/type</selector>
   <field>@name</field>
  </key>
 
  <key name="element">
   <selector>schema/element</selector>
   <field>@name</field>
  </key>
 
  <keyref name="datatypeRef" refer="datatype">
   <selector>.//attribute[@type]</selector>
   <field>@type</field>
  </keyref>

  <datatype name="derivationChoice" source="NMTOKEN">
   <enumeration value="extension"/>
   <enumeration value="restriction"/>
  </datatype>

  <datatype name="exactSet" source="string">
   <annotation>
    <info>Should be a sequence drawn from the values of derivationChoice
          plus 'equivClass',
          or #all -- regexp is only an approximation</info>
   </annotation>
   <pattern value="#all?|(equivClass|extension|restriction| )*"/>
  </datatype>

  <datatype name="derivationSet" source="exactSet">
   <annotation>
    <info>Should be a sequence drawn from the values of derivationChoice,
          or #all -- regexp is only an approximation</info>
   </annotation>
   <pattern value="#all?|(extension|restriction| )*"/>
  </datatype>
  <!-- restrictions element -->

  <element name="restrictions">
    <type source="annotated" derivedBy="extension">
     <group order="choice">
      <element ref="facet" minOccurs="0" maxOccurs="*"/>
          <!-- max 1, min 0, for each facet except pattern, period-->
      <group ref="restrictionParticle" minOccurs="0" maxOccurs="*"/>
     </group>
     <group ref="attrDecls"/>
    </type>
  </element>

  <!-- The element element can be used either
        at the toplevel to define an element-type binding globally,
        or within a content model to either reference a globally-defined
        element or type or declare an element-type binding locally.
       The ref form is not allowed at the top level -->

  <type name="element" source="annotated" derivedBy="extension">
     <group order="choice" minOccurs="0">
      <element name="datatype" type="anonDatatype"/>
      <element name="type" type="anonType"/>
     </group>
     <group order="choice" minOccurs="0" maxOccurs="*">
        <element ref="unique"/>
        <element ref="key"/>
        <element ref="keyref"/>
     </group>
     <attributeGroup ref="defRef"/>
     <attributeGroup ref="typeRef"/>
     <attribute name="equivClass" type="QName"/>
     <attributeGroup ref="occurs"/>
     <attributeGroup ref="valueConstraint"/>
     <attribute name="nullable" type="boolean" default="false"/>
     <attribute name="abstract" type="boolean" default="false"/>
     <attribute name="final" type="boolean" default="false"/>
     <attribute name="exact" type="exactSet"/>
    </type>

  <type name="namedElement" source="element" derivedBy="restriction">
   <restrictions>
    <attribute name="name" minOccurs="1"/> <!-- required at top level -->
    <attribute name="ref" maxOccurs="0"/> <!-- forbidden at top level -->
   </restrictions>
  </type>

  <element name="element" type="namedElement" equivClass="schemaTop"/>

  <!-- group element for named top-level groups, group references and
       anonymous groups in content models -->
  <type name="group" source="annotated" derivedBy="extension" abstract="true">
    <group ref="particle" minOccurs="0" maxOccurs="*"/>
    <attributeGroup ref="defRef"/>
    <attributeGroup ref="occurs"/>
    <attribute name="order" default="seq">
     <datatype source="NMTOKEN">
        <enumeration value="choice"/>
        <enumeration value="seq"/>
        <enumeration value="all"/>  <!-- allowed only at top level -->
      </datatype>
    </attribute>
   </type>

  <type name="namedGroup" source="group" derivedBy="restriction">
   <restrictions>
    <attribute name="name" minOccurs="1"/> <!-- required at top level -->
    <attribute name="ref" maxOccurs="0"/> <!-- forbidden at top level -->
   </restrictions>
  </type>
 
  <type name="anonGroup" source="group" derivedBy="restriction">
   <restrictions> <!-- required at top level -->
    <attribute name="name" maxOccurs="0"/> <!-- forbidden when nested -->
   </restrictions>
  </type>

  <element name="group" equivClass="schemaTop" type="namedGroup"/>

  <!-- The wildcard specifier in content models -->

  <element name="any">
   <type content="empty">
    <attribute name="namespace" type="namespaceList"/>
    <attributeGroup ref="occurs"/>
   </type>
  </element>

  <!-- simple type for the value of the 'namespace' attr of 'any' and
       'anyAttribute' -->
  <!-- Value is
                  ##any      - - any non-conflicting WFXML/attribute at all

                  ##other    - - any non-conflicting WFXML/attribute from
                                  namespace other than targetNS

                  one or     - - any non-conflicting WFXML/attribute from
                  more URI        the listed namespaces
                  references
                  (space separated)

                ##targetNamespace may appear in the above list, to refer to the
                   targetNamespace of the enclosing schema -->

  <datatype name="namespaceList" source="string"/>

  <!-- the attribute element declares attributes -->

  <element name="attribute">
   <type source="annotated" derivedBy="extension">
    <element name="datatype" minOccurs="0">
     <type source="datatype" derivedBy="restriction">
      <attribute name="name" maxOccurs="0">
       <annotation><info>must be nameless</info></annotation>
      </attribute>
     </type>
    </element>
    <attribute name="name" type="NCName" minOccurs="1"/>
    <attributeGroup ref="typeRef"/>
    <attribute name="minOccurs" default="0">
     <datatype source="non-negative-integer">
       <enumeration value="0"/>
       <enumeration value="1"/>
     </datatype>
    </attribute>
    <attribute name="maxOccurs" default="1">
     <datatype source="non-negative-integer">
       <enumeration value="0"/>
       <enumeration value="1"/>
     </datatype>
    </attribute>
    <attributeGroup ref="valueConstraint"/>
   </type>
  </element>

  <!-- attributeGroup element -->

  <type name="attributeGroup" source="annotated" derivedBy="extension" abstract="true">
     <group order="choice" minOccurs="0" maxOccurs="*">
      <element ref="attribute"/>
      <element name="attributeGroup" type="anonAttributeGroup"/>
     </group>
     <element name="anyAttribute" type="namespaceList" minOccurs="0"/>
     <attributeGroup ref="defRef"/>
    </type>

 <type name="namedAttributeGroup" source="attributeGroup" derivedBy="restriction">
   <restrictions>
    <attribute name="name" minOccurs="1"/> <!-- required at top level -->
    <attribute name="ref" maxOccurs="0"/> <!-- forbidden at top level -->
   </restrictions>
 </type>

 <type name="anonAttributeGroup" source="attributeGroup" derivedBy="restriction">
   <restrictions>
    <attribute name="ref" minOccurs="1"/> <!-- required when nested -->
    <attribute name="name" maxOccurs="0"/> <!-- forbidden when nested -->
   </restrictions>
 </type>

 <element name="attributeGroup" type="namedAttributeGroup" equivClass="schemaTop"/>

 <element name="include">
  <type content="empty">
   <attribute name="schemaLocation" type="uri" minOccurs="1"/>
  </type>
 </element>

 <element name="import">
  <type content="empty">
   <attribute name="namespace" type="uri" minOccurs="1"/>
   <attribute name="schemaLocation" type="uri"/>
  </type>
 </element>
 
 <!-- Better reference mechanisms -->
 
 <type name="keybase" source="annotated" derivedBy="extension">
  <element name="selector"/>
  <element name="field" minOccurs="1" maxOccurs="*"/>
  <attribute name="name" type="NCName" minOccurs="1"/>
 </type>

 <element name="unique" type="keybase" equivClass="schemaTop"/>
 <element name="key" type="keybase" equivClass="schemaTop"/>
 <element name="keyref" equivClass="schemaTop">
  <type source="keybase">
   <attribute name="refer" type="QName" minOccurs="1"/>
  </type>
 </element>

  <!-- notation element type -->

  <element name="notation" equivClass="schemaTop">
   <type source="annotated" derivedBy="extension">
    <attribute name="name" type="NCName" minOccurs="1"/>
    <attribute name="public" type="public" minOccurs="1"/>
    <attribute name="system" type="uri"/>
   </type>
  </element>

  <datatype name="public" source="string"/>

  <!-- notations for use within XML Schema schemas      -->

  <notation name="XMLSchemaStructures" public="structures" system="<]]>&XSP1.URI;<![CDATA[.xsd"/>
  <notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
</schema>
]]>
</eg>
<note>
<p>And that is the end of the schema for &XSP1;.</p>
</note>


</div1>
<div1 id="normative-schemaDTD">
<head>(normative) DTD for Schemas</head>
<p>The DTD for &XSP1; is given below.  Note there is <emph>no</emph>
implication here the <code>schema</code> must be the root element of a document.</p>
<eg xml:space="preserve">
<![CDATA[<!-- DTD for XML Schemas: Part 1: Structures -->
<!-- Id: structures.dtd,v 1.27 1999/12/16 15:40:58 ht Exp  -->

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

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

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

<!-- the duplication below is to produce an unambiguous content model
     which allows annotation everywhere -->
<!-- This has the unfortunate consequence of disallowing a schema with
     only import/includes, this should be fixed -->
<!ELEMENT %schema; ((%include; | %import; | %annotation;)*,
                    (%datatype; | %type;
                     | %element;
                     | %attributeGroup; | %group;
                     | %notation; ),
                    (%annotation;
                     | %datatype; | %type;
                     | %element;
                     | %attributeGroup; | %group;
                     | %notation; 
                     | %unique; | %key; | %keyref; )* )>
<!ATTLIST %schema;
                 targetNamespace    %URI;           #IMPLIED
                 version            CDATA           #IMPLIED
                 %nds;              %URI;           #FIXED '<]]>&XMLSchemaNS;<![CDATA['
                 finalDefault       %derivationSet; ''
                 exactDefault       %exactSet;      ''>
<!-- Note the xmlns declaration is NOT in the Schema for Schemas,
     because at the Infoset level where schemas operate,
     xmlns(:prefix) is NOT an attribute! -->
 

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

<!ELEMENT %type; ((%annotation;)?,
                 (%restrictions; |
                  ((%element;| %group;| %any;)*,
                   (%attribute;| %attributeGroup;)*,
                   (%anyAttribute;)?)))>

<!ATTLIST %type;
          name      %NCName;                        #IMPLIED
          content   (textOnly|mixed|elementOnly|empty) #IMPLIED
          abstract  %boolean;                       'false'
          final     %derivationSet;                 ''
          exact     %derivationSet;                 ''
          derivedBy %derivationChoice;              #IMPLIED 
          source    %QName;                         #IMPLIED>

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

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

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

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

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

<!-- this contains material for restricting components of inherited types -->
<!-- (element|group|any|sic) allowed only if source refers to an
     elementOnly or mixed type, the sequence and GI must match point for
     point with (an initial sub-sequence of) the content model of
     the basetype, restricting in each case, except that 'sic' is
     allowed to "copy through" a single particle.
     Only the top-level content model can be restricted,
     e.g. the content model of an anonymous embedded 'type' within
     an 'element' particle cannot be restricted piecemeal. -->
<!-- attributes to be restricted are identified by name, without order 
     constraints.
     Attributes incorporated into sources via attributeGroups may be
     restricted by name. -->
<!-- If anyAttribute appears in one or more referenced attributeGroups
     and/or explicitly, the intersection of the permissions with the
     inherited permission (which must exist) is used -->

<!-- facets are allowed only if source refers to a textonly type -->

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

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

<!ELEMENT %group; ((%annotation;)?, (%element;| %group;| %any;)*)>
<!ATTLIST %group;
            minOccurs   %non-negative-integer; '1'
            maxOccurs   CDATA                  #IMPLIED
            order       (choice|seq|all)       'seq'
            name        %NCName;               #IMPLIED
            ref         %QName;                #IMPLIED>


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

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

<!ELEMENT %any; EMPTY>
<!ATTLIST %any;
            namespace    CDATA                  '##any'
            minOccurs    %non-negative-integer; '1'
            maxOccurs    CDATA                  #IMPLIED>

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

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

                  one or     - - any non-conflicting WFXML from
                  more URI        the listed namespaces
                  references

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

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


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

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

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

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

<!-- better reference mechanisms -->
<!ELEMENT %unique; (%selector;, (%field;)+)>
<!ATTLIST %unique; name     %NCName;       #REQUIRED>

<!ELEMENT %key;    (%selector;, (%field;)+)>
<!ATTLIST %key;    name     %NCName;       #REQUIRED>

<!ELEMENT %keyref; (%selector;, (%field;)+)>
<!ATTLIST %keyref;
                   name     %NCName;       #REQUIRED
                   refer    %QName;        #REQUIRED>

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

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

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

<!ELEMENT %notation; EMPTY>
<!ATTLIST %notation;
                 name        %NCName;    #REQUIRED
                 public      CDATA       #REQUIRED
                 system      %URI;       #IMPLIED>

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

</div1>
<div1 id="normative-glossary">
<head>Glossary (normative) *</head>

<ednote>
<edtext>The Glossary has barely been started. An XSL macro will be used to
collect definitions from throughout the spec and gather them here for easy
reference.</edtext>
</ednote>

<glist>
<gitem>
<label>abstract syntax</label>
<def>
<p><termdef id="gloss-abstractSyntax" term="abstract syntax">the<term>abstract
syntax</term> of the XML Schema Definition Language is ...</termdef></p>
</def>
</gitem>
<gitem>
<label>aggregate datatype</label>
<def>
<p><termdef term="aggregate datatype" id="gloss-aggregateDatatype">an
<term>aggregate datatype</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>type</label>
<def>
<p><termdef term="type" id="gloss-type">an <term>type</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>type reference</label>
<def>
<p><termdef term="type reference" id="gloss-typeReference">an
<term>type reference</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>'all' content model group</label>
<def>
<p><termdef term="&apos;all&apos; content model group" id="gloss-all">the
<term>'all' content model group</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>'any' content</label>
<def>
<p><termdef term="&apos;any&apos; content" id="gloss-anyContent">the
<term>'any' content</term> specification ...</termdef></p>
</def>
</gitem>
<gitem>
<label>atomic datatype</label>
<def>
<p><termdef term="atomic datatype" id="gloss-atomicDatatype">an <term>atomic
datatype</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>attribute</label>
<def>
<p><termdef term="attribute" id="gloss-attribute">an <term>attribute</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>attribute group</label>
<def>
<p><termdef term="attribute group" id="gloss-attributeGroup">an <term>attribute
group</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>'choice' content model group</label>
<def>
<p><termdef term="&apos;choice&apos; content model group" id="gloss-choice">the
<term>'choice' content model group</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>composition</label>
<def>
<p><termdef term="composition" id="gloss-composition"><term>composition</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>concrete syntax</label>
<def>
<p><termdef term="concrete syntax" id="gloss-concreteSyntax">the <term>concrete
syntax</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>constraint</label>
<def>
<p><termdef term="constraint" id="gloss-constraint">a <term>constraint</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>content</label>
<def>
<p><termdef term="content" id="gloss-content"><term>content</term> is</termdef>
</p>
</def>
</gitem>
<gitem>
<label>context</label>
<def>
<p><termdef term="context" id="gloss-context">a <term>context</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>datatype</label>
<def>
<p><termdef term="datatype" id="gloss-datatype">an <term>datatype</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>datatype reference</label>
<def>
<p><termdef term="datatype reference" id="gloss-datatypeReference">an
<term>datatype reference</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>default value</label>
<def>
<p><termdef term="default value" id="gloss-defaultValue">a <term>default
value</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>document</label>
<def>
<p><termdef term="document" id="gloss-document">a <term>document</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>element</label>
<def>
<p><termdef term="element" id="gloss-element">an <term>element</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>element content</label>
<def>
<p><termdef term="element content" id="gloss-elementContent"><term>element
content</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>element reference</label>
<def>
<p><termdef term="element reference" id="gloss-elementTypeReference">an
<term>element reference</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>'empty' content</label>
<def>
<p><termdef term="&apos;empty&apos; content" id="gloss-emptyContent">the
<term>'empty' content</term> specification ...</termdef></p>
</def>
</gitem>
<gitem>
<label>export</label>
<def>
<p><termdef term="export" id="gloss-schemaExport">to <term>export</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>export control</label>
<def>
<p><termdef term="export control" id="gloss-exportControl">an <term>export
control</term></termdef></p>
</def>
</gitem>
<gitem>
<label>external entity</label>
<def>
<p><termdef term="external entity" id="gloss-externalEntity">an <term>external
entity</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>facet</label>
<def>
<p><termdef term="facet" id="gloss-facet">a <term>facet</term> is</termdef></p>

</def>
</gitem>
<gitem>
<label>fixed value</label>
<def>
<p><termdef term="fixed value" id="gloss-fixedValue">a <term>fixed
value</term></termdef></p>
</def>
</gitem>
<gitem>
<label>fragment</label>
<def>
<p><termdef term="fragment" id="gloss-fragment">a <term>fragment</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>import</label>
<def>
<p><termdef term="import" id="gloss-schemaImport">to <term>import</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>include</label>
<def>
<p><termdef term="include" id="gloss-schemaInclude">to <term>include</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>information set</label>
<def>
<p><termdef term="information set" id="gloss-infoSet">an <term>information
set</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>instance</label>
<def>
<p><termdef term="instance" id="gloss-instance">an <term>instance</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>markup</label>
<def>
<p><termdef term="markup" id="gloss-markup"><term>markup</term> is</termdef>
</p>
</def>
</gitem>
<gitem>
<label>'mixed' content</label>
<def>
<p><termdef term="&apos;mixed&apos; content" id="gloss-mixedContent">the
<term>'mixed' content</term> specification ...</termdef></p>
</def>
</gitem>
<gitem>
<label>model</label>
<def>
<p><termdef term="model" id="gloss-model">a <term>model</term> is</termdef></p>

</def>
</gitem>
<gitem>
<label>model group</label>
<def>
<p><termdef term="model group" id="gloss-modelGroup">a <term>model group</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>model group reference </label>
<def>
<p><termdef term="model group reference" id="gloss-modelGroupReference">a
<term>model group reference</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>RUE</label>
<def>
<p><termdef term="RUE" id="gloss-RUE"><term>RUE</term> is short for
<emph>reference to undefined entity information item</emph> as defined in
<bibref ref="ref-xmlinfo"/></termdef></p>
</def>
</gitem>
<gitem>
<label>NCName</label>
<def>
<p><termdef term="NCName" id="gloss-NCName">an <term>NCName</term> is a name
with no namespace qualification, as defined in
<bibref ref="ref-xml-namespaces"/>. Appears in all the definition and
declaration productions of this specification.</termdef> </p>
</def>
</gitem>
<gitem>
<label>QName</label>
<def>
<p><termdef term="QName" id="gloss-QName">an <term>QName</term> is a name
with an optional namespace qualification, as defined in
<bibref ref="ref-xml-namespaces"/>. Appears in all the referring productions of this specification.</termdef> </p>
</def>
</gitem>
<gitem>
<label>namespace</label>
<def>
<p><termdef term="namespace" id="gloss-namespace">a <term>namespace</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>notation</label>
<def>
<p><termdef term="notation" id="gloss-notation">a <term>notation</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>object model</label>
<def>
<p><termdef term="object model" id="gloss-objectModel">an <term>object
model</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>occurrence</label>
<def>
<p><termdef term="occurrence" id="gloss-occurrence"><term>occurrence</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>parameter entity</label>
<def>
<p><termdef term="parameter entity" id="gloss-parameterEntity">a
<term>parameter entity</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>preamble</label>
<def>
<p><termdef term="preamble" id="gloss-schemaPreamble">a <term>preamble</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>presence</label>
<def>
<p><termdef term="presence" id="gloss-presence"><term>presence</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>refinement</label>
<def>
<p><termdef term="refinement" id="gloss-refinement"><term>refinement</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>document root</label>
<def>
<p><termdef term="document root" id="gloss-documentRoot">the <term>document
root</term> is ...</termdef></p>
</def>
</gitem>
<gitem>
<label>scope</label>
<def>
<p><termdef term="scope" id="gloss-scope"><term>scope</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>'sequence' content model group </label>
<def>
<p><termdef term="&apos;sequence&apos; content model group" id="gloss-sequenceGroup">the <term>'sequence' content model
group</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>structure</label>
<def>
<p><termdef term="structure" id="gloss-structure"><term>structure</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>symbol space</label>
<def>
<p><termdef term="symbol space" id="gloss-symbolSpace">a <term>symbol
space</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>text entity</label>
<def>
<p><termdef term="parsed entity" id="gloss-parsedEntity">a <term>parsed
entity</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>unparsed entity</label>
<def>
<p><termdef term="unparsed entity" id="gloss-unparsedEntity">an <term>unparsed
entity</term> is</termdef></p>
</def>
</gitem>
<gitem>
<label>validation</label>
<def>
<p><termdef term="validation" id="gloss-validation"><term>validation</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>vocabulary</label>
<def>
<p><termdef term="vocabulary" id="gloss-vocabulary">a <term>vocabulary</term>
is</termdef></p>
</def>
</gitem>
<gitem>
<label>well-formedness</label>
<def>
<p><termdef term="well-formedness" id="gloss-wellFormedness"><term>well-formedness</term> is</termdef></p>
</def>
</gitem>
</glist>
</div1>
<div1 id="normative-references">
<head>References (normative) *</head>
<blist>
 <bibl id="bib-camb-comm" key="Cambridge Communiqu&eacute;"><emph>The
Cambridge Communiqu&eacute;</emph>, Ralph Swick
and Henry S. Thompson, editors, 7 October 1999.  See <loc href="http://www.w3.org/TR/schema-arch">http://www.w3.org/TR/schema-arch</loc></bibl>
<bibl id="ref-dcd" key="DCD"> <emph>Document
Content Description for XML (DCD)</emph>, Tim Bray et al. W3C, 10 August 1998.
See <loc href="http://www.w3.org/TR/NOTE-dcd">http://www.w3.org/TR/NOTE-dcd
</loc> </bibl>
<bibl id="ref-ddml" key="DDML"> <emph>Document
Definition Markup Language</emph>. See
<loc href="http://www.w3.org/TR/NOTE-ddml">http://www.w3.org/TR/NOTE-ddml
</loc> </bibl>
<bibl id="ref-html-4" key="HTML-4"> <emph>HTML 4.0
Specification</emph>, Dave Raggett et al. W3C, 1998. See
<loc href="http://www.w3.org/TR/REC-html40/">http://www.w3.org/TR/REC-html40/</loc> </bibl>
<bibl id="ref-iso-11404" key="ISO-11404"> <emph>ISO
11404 -- Information Technology -- Programming Languages, their environments
and system software interfaces -- Language-independent datatypes</emph>,
ISO/IEC 11404:1996(E).</bibl>
<bibl id="ref-iso-1808" key="RFC-1808"> RFC
1808,<emph>Relative Uniform Resource Locators</emph>. Internet Engineering Task
Force. See <loc href="http://www.ietf.org/rfc/rfc1808.txt">http://www.ietf.org/rfc/rfc1808.txt
</loc> </bibl>
<bibl id="ref-sox" key="SOX"> <emph>Schema for
Object-oriented XML</emph>, Matt Fuchs, et al. W3C, 1998. See
<loc href="http://www.w3.org/Submission/1998/15/">http://www.w3.org/Submission/1998/15/
</loc> </bibl>
<bibl id="ref-sox-1.1" key="SOX-1.1"> <emph>Schema
for Object-oriented XML</emph>, Version 1.1, Matt Fuchs, et al. W3C, 1999. See
???</bibl>
<bibl id="ref-uri" key="URI"> <emph>Uniform
Resource Identifiers (URI): Generic Syntax and Semantics</emph>. See
<loc href="http://www.ics.uci.edu/~fielding/url/draft-fielding-uri-syntax-01.txt">http://www.ics.uci.edu/~fielding/url/draft-fielding-uri-syntax-01.txt</loc> </bibl>
<bibl id="ref-url" key="URL"> RFC
1738,<emph>Uniform Resource Locators (URL)</emph>. Internet Engineering Task
Force. See <loc href="http://www.ietf.org/rfc/rfc1738.txt">http://www.ietf.org/rfc/rfc1738.txt
</loc> </bibl>
<bibl id="ref-urn" key="URN"> RFC 2141,<emph>URN
Syntax</emph>. Internet Engineering Task Force. See
<loc href="http://www.ietf.org/rfc/rfc2141.txt">http://www.ietf.org/rfc/rfc2141.txt
</loc> </bibl>
<bibl id="ref-wai-pageauth" key="WAI-PAGEAUTH">
<emph>WAI Accessibility Guidelines: Page Authoring</emph>, Gregg Vanderheiden
et al. W3C, 14-Apr-1998. See <loc href="http://www.w3.org/TR/WAI-WEBCONTENT/">http://www.w3.org/TR/WAI-WEBCONTENT/</loc> </bibl>
<bibl id="ref-webarch-extlang" key="WEBARCH-EXTLANG"> <emph>Web Architecture: Extensible Languages</emph>, Tim
Berners-Lee and Dan Connolly. W3C, 10 Feb 1998. See
<loc href="http://www.w3.org/TR/NOTE-webarch-extlang">http://www.w3.org/TR/NOTE-webarch-extlang
</loc> </bibl>
<bibl id="ref-websgml" key="WEBSGML">
<emph>Proposed TC for WebSGML Adaptations for SGML</emph>, C. F. Goldfarb, ed.,
14 June 1997. See <loc href="http://www.sgmlsource.com/8879rev/n1929.htm">http://www.sgmlsource.com/8879rev/n1929.htm
</loc> </bibl>
<bibl id="ref-xsp2" key="XML Schemas: Datatypes">
<emph>XML Schema Part 2: Datatypes</emph>, Paul V. Biron and Ashok
Malhotra, eds.  See <loc href="&XSP2.URI;.html">&XSP2.URI;.html</loc> </bibl>
<bibl id="ref-xsreq" key="XML Schema Requirements">
<emph>XML Schema Requirements </emph>, Ashok Malhotra and Murray Maloney, ed.,
W3C, 15 February 1999. See <loc href="http://www.w3.org/TR/NOTE-xml-schema-req">http://www.w3.org/TR/NOTE-xml-schema-req
</loc> </bibl>
<bibl id="ref-xdr" key="XDR"> <emph>XML-Data
Reduced</emph>, Frankston, Charles, and Henry S. Thompson, ed. See
<loc href="http://www.ltg.ed.ac.uk/~ht/XMLData-Reduced.htm">http://www.ltg.ed.ac.uk/~ht/XMLData-Reduced.htm
</loc> </bibl>
<bibl id="ref-xlink" key="XLink"> <emph>XML Linking
Language (XLink)</emph>, Eve Maler and Steve DeRose, W3C, 3 March 1998. See
<loc href="http://www.w3.org/TR/WD-xlink">http://www.w3.org/TR/WD-xlink</loc>
</bibl>
<bibl id="ref-xml" key="XML"> <emph>Extensible
Markup Language (XML) 1.0</emph>, Tim Bray, et al. W3C, 10 February 1998. See
<loc href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</loc>
</bibl>
<bibl id="ref-xsl" key="XSLT"> <emph>Extensible
Stylesheet Language Transformations</emph>, James Clark, W3C, 21 April 1999.
See <loc href="http://www.w3.org/TR/1999/WD-xslt-19990421">http://www.w3.org/TR/1999/WD-xslt-19990421</loc>
</bibl>
<bibl id="ref-xml-data" key="XML-Data">
<emph>XML-Data</emph>, Andrew Layman, et al. W3C, 05 January 1998. See
<loc href="http://www.w3.org/TR/1998/NOTE-XML-data-0105/">http://www.w3.org/TR/1998/NOTE-XML-data-0105/</loc> </bibl>
<bibl id="ref-xmlinfo" key="XML-Infoset">XML Information Set (public WD),
David Megginson et al., W3C, 1999. See
<loc href="http://www.w3.org/TR/xml-infoset">http://www.w3.org/TR/xml-infoset</loc>
</bibl>
<bibl id="ref-xml-namespaces" key="XML-Namespaces">
Namespaces in XML, Tim Bray et al., W3C, 1998. See
<loc href="http://www.w3.org/TR/REC-xml-names/">http://www.w3.org/TR/WD-xml-names/</loc> </bibl>
<bibl id="ref-xpointer" key="XPointer"> <emph>XML
Pointer Language (XPointer)</emph>, Eve Maler and Steve DeRose, W3C, 3 March
1998. See <loc href="http://www.w3.org/TR/xptr">http://www.w3.org/TR/xptr</loc> </bibl>
 <bibl id="bib-xpath" key="XPath"><emph>XML Path Language</emph>, James Clark
and Steve DeRose, editors, 16 November 1999.  See <loc href="http://www.w3.org/TR/xpath">http://www.w3.org/TR/xpath</loc></bibl>
<bibl id="ref-xschema" key="XSchema"> <emph>XSchema
Specification</emph>, Simon St. Laurent, Ronald Bourret, John Cowan, et al.,
Version 1.0, Draft, 18 October 1998. See
<loc href="http://www.simonstl.com/xschema/spec/xscspecv4.htm">http://www.simonstl.com/xschema/spec/xscspecv4.htm
</loc> For more general information, consult
<loc href="http://purl.oclc.org/NET/xschema">http://purl.oclc.org/NET/xschema
</loc> </bibl>
</blist>
</div1>
<div1 id="acknowledgments">
<head>Acknowledgments (non-normative)</head>
 <p>The following have contributed material to this draft:</p>
 <slist>
  <sitem>Andrew Layman, Microsoft</sitem>
  <sitem>David Fallside, IBM</sitem>
  <sitem>Scott Lawrence, Agranat Systems</sitem>
 </slist>
<p>The editors acknowledge the members of the XML Schema Working Group, the members of other W3C Working Groups, and industry experts in other
forums who have contributed directly or indirectly to the process or content of
creating this document. The Working Group is particularly grateful to Lotus
Development Corp. and IBM for providing teleconferencing facilities.</p>
 <p>The current members of the XML Schema Working Group are:</p>
<orglist>
<member>
 <name>Paula Angerstein</name>
 <affiliation>Vignette Corporation</affiliation>
</member>
<member>
 <name>David Beech</name>
 <affiliation>Oracle Corp.</affiliation>
</member>
<member>
 <name>Paul V. Biron</name>
 <affiliation>Health Level Seven</affiliation>
</member>
<member>
 <name>Allen Brown</name>
 <affiliation>Microsoft</affiliation>
</member>
<member>
 <name>Greg Bumgardner</name>
 <affiliation>Rogue Wave Software</affiliation>
</member>
<member>
 <name>Lee Buck</name>
 <affiliation>Extensibility</affiliation>
</member>
<member>
 <name>Dean Burson</name>
 <affiliation>Lotus Development Corporation</affiliation>
</member>
<member>
 <name>Charles E. Campbell</name>
 <affiliation>Informix</affiliation>
</member>
<member>
 <name>Peter Chen</name>
 <affiliation>Bootstrap Alliance and LSU</affiliation>
</member>
<member>
 <name>David Cleary</name>
 <affiliation>Progress Software</affiliation>
</member>
<member>
 <name>Dan Connolly</name>
 <affiliation>W3C</affiliation>
 <role>staff contact</role>
</member>
<member>
 <name>Andrew Eisenberg</name>
 <affiliation>Progress Software</affiliation>
</member>
<member>
 <name>Rob Ellman</name>
 <affiliation>Calico Commerce</affiliation>
</member>
<member>
 <name>David Ezell</name>
 <affiliation>Hewlett Packard Company</affiliation>
</member>
<member>
 <name>David Fallside</name>
 <affiliation>IBM</affiliation>
</member>
<member>
 <name>Matthew Fuchs</name>
 <affiliation>Commerce One</affiliation>
</member>
<member>
 <name>Paul Grosso</name>
 <affiliation>ArborText, Inc.</affiliation>
</member>
<member>
 <name>Dave Hollander</name>
 <affiliation>CommerceNet</affiliation>
 <role>co-chair</role>
</member>
<member>
 <name>Mary Holstege</name>
 <affiliation>Calico Commerce</affiliation>
</member>
<member>
 <name>Jane Hunter</name>
 <affiliation>Distributed Systems Technology Centre (DSTC Pty Ltd)</affiliation>
</member>
<member>
 <name>Renato Iannella</name>
 <affiliation>Distributed Systems Technology Centre (DSTC Pty Ltd)</affiliation>
</member>
 <member>
  <name>Rick Jelliffe</name>
  <affiliation>Academia Sinica</affiliation>
 </member>
 <member>
  <name>Dianne Kennedy</name>
  <affiliation>Graphic Communications Association</affiliation>
 </member>
<member>
 <name>Setrag Khoshafian</name>
 <affiliation>Technology Deployment International (TDI)</affiliation>
</member>
<member>
 <name>Janet Koenig</name>
 <affiliation>Sun Microsystems</affiliation>
</member>
<member>
 <name>Setrag Khoshafian</name>
 <affiliation>Technology Deployment International (TDI)</affiliation>
</member>
<member>
 <name>Ara Kullukian</name>
 <affiliation>Technology Deployment International (TDI)</affiliation>
</member>
<member>
 <name>Andrew Layman</name>
 <affiliation>Microsoft</affiliation>
</member>
<member>
 <name>Dmitry Lenkov</name>
 <affiliation>Hewlett Packard Company</affiliation>
</member>
<member>
 <name>Eve Maler</name>
 <affiliation>Sun Microsystems</affiliation>
</member>
<member>
 <name>Ashok Malhotra</name>
 <affiliation>IBM</affiliation>
</member>
<member>
 <name>Murray Maloney</name>
 <affiliation>Commerce One</affiliation>
</member>
<member>
 <name>John McCarthy</name>
 <affiliation>Lawrence Berkeley National Laboratory</affiliation>
</member>
<member>
 <name>Noah Mendelsohn</name>
 <affiliation>Lotus Development Corporation</affiliation>
</member>
<member>
 <name>Don Mullen</name>
 <affiliation>Extensibility</affiliation>
</member>
<member>
 <name>Murata Makoto</name>
 <affiliation>Xerox</affiliation>
</member>
<member>
 <name>Frank Olken</name>
 <affiliation>Lawrence Berkeley National Laboratory</affiliation>
</member>
 <member>
  <name>Dave Peterson</name>
  <affiliation>Graphic Communications Association</affiliation>
 </member>
<member>
 <name>Mark Reinhold</name>
 <affiliation>Sun Microsystems</affiliation>
</member>
<member>
 <name>Shriram Revankar</name>
 <affiliation>Xerox</affiliation>
</member>
<member>
 <name>Jonathan Robie</name>
 <affiliation>Software AG</affiliation>
</member>
 <member>
  <name>Lew Shannon</name>
  <affiliation>NCR</affiliation>
 </member>
<member>
 <name>C. M. Sperberg-McQueen</name>
 <affiliation>W3C</affiliation>
 <role>co-chair</role>
</member>
<member>
 <name>Henry S. Thompson</name>
 <affiliation>University of Edinburgh</affiliation>
</member>
<member>
 <name>Matt Timmermans</name>
 <affiliation>Microstar</affiliation>
</member>
<member>
 <name>Jim Trezzo</name>
 <affiliation>Oracle Corp.</affiliation>
</member>
<member>
 <name>Steph Tryphonas</name>
 <affiliation>Microstar</affiliation>
</member>
<member>
 <name>Mark Tucker</name>
 <affiliation>Health Level Seven</affiliation>
</member>
<member>
 <name>Priscilla Walmsley</name>
 <affiliation>XMLSolutions</affiliation>
</member>
<member>
 <name>Norm Walsh</name>
 <affiliation>ArborText, Inc</affiliation>
</member>
<member>
 <name>Aki Yoshida</name>
 <affiliation>SAP AG</affiliation>
</member>
</orglist>
 <p>The XML Schema Working Group has benefited in its work from the
participation and contributions of a number of people not currently
members of the Working Group, including
in particular those named below.  Affiliations given are those current at
the time of their work with the WG.
</p>
 <orglist>
 <member>
  <name>Gabe Beged-Dov</name>
  <affiliation>Rogue Wave Software</affiliation>
 </member>
 <member>
  <name>George Feinberg</name>
  <affiliation>Object Design</affiliation>
 </member>
 <member>
  <name>Charles Frankston</name>
  <affiliation>Microsoft</affiliation>
 </member>
 <member>
  <name>Ernesto Guerrieri</name>
  <affiliation>Inso</affiliation>
 </member>
 <member>
  <name>Michael Hyman</name>
  <affiliation>Microsoft</affiliation>
 </member>
 <member>
  <name>Chris Olds</name>
  <affiliation>Wall Data</affiliation>
 </member>
 <member>
  <name>William Shea</name>
  <affiliation>Merrill Lynch</affiliation>
 </member>
 <member>
  <name>Ralph Swick</name>
  <affiliation>W3C</affiliation>
 </member>
 <member>
  <name>Tony Stewart</name>
  <affiliation>Rivcom</affiliation>
 </member>
 </orglist>
</div1>
<div1 id="sampleSchema">
<head>Sample Schema (non-normative)</head>
<note>
<p>An example of a full blown schema, for the <code>PurchaseOrder</code>
example from <specref ref="concepts-types"/>:</p>
<eg xml:space="preserve">
<![CDATA[<schema targetNamespace="http://www.myco.com/MYPO"
        xmlns="]]>&XSP1.base;<![CDATA["
        xmlns:po="http://www.myco.com/MYPO">

 <element name="PurchaseOrder" type="po:PurchaseOrderType"/>

 <element name="comment" type="string"/>

 <type name="PurchaseOrderType">
  <element name="shipTo" type="po:Address"/>
  <element name="shipDate" type="date"/>
  <element ref="po:comment" minOccurs="0"/>
  <element name="Items" type="po:Items"/>
  <attribute name="orderDate" type="date"/>
 </type>

 <type 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="integer"/>
  <attribute name="type" type="string"/>
 </type>

 <type name="Items">
  <element name="Item" minOccurs="0" maxOccurs="*">
   <type>
    <element name="productName" type="string"/>
    <element name="quantity">
     <datatype source="integer"/>
      <minExclusive value="0"/>
     </datatype>
    </element>
    <element name="price" type="decimal"/>
    <element ref="po:comment" minOccurs="0"/>
   </type>
  </element>
 </type>

</schema>]]>
</eg>
</note>
</div1>
<div1>
<head>Tabulation of changes</head>
<eg>
<![CDATA[
$Log: structures.xml,v $
Revision 1.1  2015/01/05 06:37:41  denis
add resources from mirror back to CVS

Revision 1.45.1.6  1999/12/17 16:14:53  ht
one more link

Revision 1.45.1.5  1999/12/17 15:35:47  ht
reorder prevloc

Revision 1.45.1.4  1999/12/17 14:50:25  ht
link fixes

Revision 1.45.1.3  1999/12/17 14:46:51  ht
additional status prose

Revision 1.45.1.2  1999/12/17 13:33:11  ht
PWD status prose and link fixes

Revision 1.45.1.1  1999/12/17 12:26:37  ht
towards PWD

Revision 1.45  1999/12/17 12:06:05  ht
eacute

Revision 1.44  1999/12/17 11:51:45  ht
make all example quotes double
some changes merged from pre-Nov-publ branch (1.15.1...)

Revision 1.43  1999/12/17 10:59:16  ht
minor fix in schema wrt keys

Revision 1.42  1999/12/16 15:48:08  ht
fix some refs, incorporate up-to-date schema and DTD

Revision 1.41  1999/12/16 15:40:05  aqw
describe exact, final and abstract on elements

Revision 1.40  1999/12/16 09:44:11  aqw
minor editorial

Revision 1.39  1999/12/14 16:22:46  aqw
various QName fixes

Revision 1.38  1999/12/10 18:01:42  ht
remove * where status has changed

Revision 1.37  1999/12/10 16:14:10  aqw
renaming attrGroup, elemOnly, integrate DTD and schema

Revision 1.36  1999/12/10 16:08:05  aqw
more on BRM, add an wildcard ambiguity issue

Revision 1.35  1999/12/10 10:07:35  ht
merge in new-design branch

Revision 1.34  1999/12/10 09:38:42  ht
minor orphan changes

Revision 1.33  1999/12/08 20:06:52  aqw
added prose for BRM

Revision 1.32  1999/12/03 15:49:25  ht
fix status text

Revision 1.31  1999/12/03 14:54:16  aqw
ht version confusion

Revision 1.30  1999/12/03 14:48:41  aqw
Outline inclusion of BRM proposal
Implemented QName aspect of composition decision

Revision 1.29.1.6  1999/12/08 20:04:26  aqw
describe impact of exact for equiv classes, remove substitutabiliity secton

Revision 1.29.1.5  1999/12/06 23:15:09  ht
add stars, no standalone

Revision 1.29.1.4  1999/12/06 22:50:02  aqw
add equiv classes, up-to-date DTD and schema

Revision 1.29.1.3  1999/12/03 19:37:27  ht
Fill in 3.6.3, controlling derivation, including mod agreed with Allen
wrt type tolerance.

Revision 1.29.1.2  1999/12/03 15:55:38  aqw
cleanup new proposal stuff for preliminary release

Revision 1.29.1.1  1999/12/02 22:55:36  aqw
begin serious work on integrating new type derivation proposal

Revision 1.29  1999/12/02 19:05:00  aqw
resolve ! issue in <any namespace='...'> in favour of ##
remove private exploratory hierarchy rewrite

Revision 1.28  1999/12/02 11:36:27  aqw
merge in DTD and schema for internal point release

Revision 1.27  1999/12/02 11:09:36  aqw
composition tf integrates, validates nearly ok

Revision 1.26  1999/12/01 15:43:23  aqw
integrating composition tf . . .

Revision 1.25  1999/11/22 14:14:59  aqw
integrate tentative type construction compromise

Revision 1.24  1999/11/12 17:00:41  ht
Incorporate minimal null support

Revision 1.23  1999/11/11 11:19:11  ht
add issues per 1999-11-04 telcon vote

Revision 1.22  1999/11/11 11:11:51  ht
include dtd and schema

Revision 1.21.1.1  1999/11/22 14:03:55  aqw
try out type construction compromise

Revision 1.21  1999/11/05 00:48:14  aqw
note about status vis a vis forthcoming issues from minutes

Revision 1.20  1999/11/04 23:46:57  aqw
remove element classes per WG vote

Revision 1.19  1999/11/03 21:39:47  aqw
fix editors list and acks
typoes spotted by DBeech

Revision 1.18  1999/11/03 15:49:26  aqw
Implement chair's instructions wrt WG poll closed 1999-10-30:
 * re-integrate named model groups
 * change details of implicit openness
 * remove entities, not notations

Revision 1.17  1999/11/02 23:37:35  aqw
merge refinement proposal into mainline preparatory to implementing poll results


Revision 1.16  1999/11/02 21:32:25  aqw
remove entity definitions and related material (e.g. notations)

Revision 1.15  1999/10/27 13:28:58  ht
Fix some (all?) syntax paradigms, examples
Include bug-fixed .xsd and .dtd

Revision 1.14  1999/10/27 10:48:01  ht
Incorporate up-to-date schema and DTD, completing concrete syntax changes
Parameterise paths/dates to facilitate release process

Revision 1.13.1.15  1999/10/26 16:23:30  ht
a bit more on validity

Revision 1.13.1.14  1999/10/25 14:37:31  ht
Begin to try to fill in validity section on basis of
schema-valid(EII,type,schemaSet) minimalist approach

Revision 1.13.1.13  1999/10/19 18:42:13  ht
added xsd:type to text, changed status

Revision 1.13.1.12  1999/10/18 19:46:12  aqw
Added concrete syntax, prose and examples to 3.6, new section on the
hierarchy and restrictions

Revision 1.13.1.11  1999/10/18 15:28:16  aqw
Included lots in 3.5 and 3.6, editting it in to shape

Revision 1.13.1.10  1999/10/18 13:55:23  aqw
correct and corresponding DTD and Schema included
text from new design included in 3.5 and 3.6 for editting

Revision 1.13.1.9  1999/10/18 11:39:01  aqw
light pass over section 2, cleaning up 'type' terminology
minor fixups in 3.4

Revision 1.13.1.8  1999/10/17 22:05:19  aqw
first pass through 3.4 complete

Revision 1.13.1.7  1999/10/16 22:12:03  aqw
element classes

Revision 1.13.1.6  1999/10/16 19:02:51  aqw
attribute finished, also attrGroup

Revision 1.13.1.5  1999/10/16 17:53:28  aqw
finished (?) with complex types, on to attributes

Revision 1.13.1.4  1999/10/16 11:52:07  aqw
still working on complex type

Revision 1.13.1.3  1999/10/15 16:38:31  aqw
more work on 'type'

Revision 1.13.1.1  1999/10/15 11:46:18  ht
on the way to matching new refinement proposal

Revision 1.13  1999/10/09 10:49:40  ht
correct headline date

Revision 1.12  1999/10/05 09:56:19  ht
Preliminary implementation of A3 and A7 (ampConnector and richerMixed)
votes.  Moving towards a parallel syntax for elementDecl/Ref and
groupDefn/Ref.

Concrete syntax paradigms, examples, DTD and Schema NOT up-to-date

Revision 1.11  1999/09/27 16:31:07  ht
merge simple back to main branch

Revision 1.10.2.38  1999/09/27 16:29:02  ht
return to xmlschema-current as base

Revision 1.10.2.37  1999/09/24 16:40:22  ht
add comments archive pointer

Revision 1.10.2.36  1999/09/24 16:38:23  ht
link housekeeping, move TF reports bibliography to separate appendix

Revision 1.10.2.35  1999/09/24 13:44:27  ht
final (?) housekeeping before publication

Revision 1.10.2.34  1999/09/23 18:48:51  ht
changes to front matter in preparation for public WD
ponter to Simple TF included

Revision 1.10.2.33  1999/09/23 13:32:15  ht
up-to-date pointer to refinement TF report

Revision 1.10.2.32  1999/09/23 13:00:22  ht
typo in db entity

Revision 1.10.2.31  1999/09/23 12:59:04  ht
per suggestions from Ashok, some rewording of summary of Composition
TF, added issue regarding priority of instance->schema alternatives

Revision 1.10.2.30  1999/09/22 14:02:35  ht
typo in correction to 4.1

Revision 1.10.2.29  1999/09/22 13:58:39  ht
edits implementing Noah's comments

Revision 1.10.2.28  1999/09/22 08:07:07  ht
add verbatim change log at end
----------------------------
revision 1.10.2.27
date: 1999/09/21 16:26:11;  author: ht;  state: Exp;  lines: +4 -4
added Id: to title for now
----------------------------
revision 1.10.2.26
date: 1999/09/21 16:06:08;  author: ht;  state: Exp;  lines: +42 -244
replaced composition tf report with a summary and a pointer
----------------------------
revision 1.10.2.25
date: 1999/09/21 14:11:50;  author: aqw;  state: Exp;  lines: +495 -111
some dates, up-to-date DTD and Schema for schemas
----------------------------
revision 1.10.2.24
date: 1999/09/21 10:50:37;  author: ht;  state: Exp;  lines: +18 -3
supply missing content model for 'attribute' in concrete syntax
paradigm
----------------------------
revision 1.10.2.23
date: 1999/09/21 10:37:51;  author: aqw;  state: Exp;  lines: +21 -20
define/declare consistency pass
----------------------------
revision 1.10.2.22
date: 1999/09/20 13:08:36;  author: aqw;  state: Exp;  lines: +47 -49
track datatype content model changes,
minor wording
----------------------------
revision 1.10.2.21
date: 1999/09/16 14:55:17;  author: ht;  state: Exp;  lines: +136 -14
header disclaimer, graveyards rescued to discharge references
----------------------------
revision 1.10.2.20
date: 1999/09/16 14:25:01;  author: aqw;  state: Exp;  lines: +274 -1541
rip out all of 3.5, all of 4, install 'Draft Proposal' in 4
----------------------------
revision 1.10.2.19
date: 1999/09/16 12:08:59;  author: aqw;  state: Exp;  lines: +107 -143
Clean up import/include/export, references in particular
Add archetypeRef to content models, minimally
New example of datatype+attr
----------------------------
revision 1.10.2.18
date: 1999/09/15 22:06:29;  author: aqw;  state: Exp;  lines: +26 -3
Two clarifications following discussion with andrew
1) what it would take to remove the two symbol spaces problem
2) How <archetype> allows either datatypeRef or contentType
----------------------------
revision 1.10.2.17
date: 1999/09/15 20:30:49;  author: aqw;  state: Exp;  lines: +114 -105
change date, incorporate edited dtd
----------------------------
revision 1.10.2.16
date: 1999/09/15 19:52:39;  author: aqw;  state: Exp;  lines: +90 -76
Encorporate/respond to Eve Maler's suggested edits
----------------------------
revision 1.10.2.15
date: 1999/09/13 16:14:12;  author: aqw;  state: Exp;  lines: +306 -335
Finish consistency pass through 3.4
Brutal 'element type' -> element
----------------------------
revision 1.10.2.14
date: 1999/09/09 14:22:29;  author: aqw;  state: Exp;  lines: +53 -56
cleanup pass, down to 3.3
----------------------------
revision 1.10.2.13
date: 1999/09/08 18:23:47;  author: ht;  state: Exp;  lines: +41 -41
more type back to archetype
----------------------------
revision 1.10.2.12
date: 1999/09/08 18:03:06;  author: aqw;  state: Exp;  lines: +214 -216
put archetype back in, imperfectly, I expect
----------------------------
revision 1.10.2.11
date: 1999/09/07 21:50:36;  author: bu;  state: Exp;  lines: +124 -63
fix paradigm contexts, extend example, consolidate example in appendix
----------------------------
revision 1.10.2.10
date: 1999/09/07 16:54:39;  author: aqw;  state: Exp;  lines: +514 -521
syntax paradigms now properly distributed, I think
----------------------------
revision 1.10.2.9
date: 1999/09/07 15:53:06;  author: ht;  state: Exp;  lines: +5 -8
fixed minor validity errors
----------------------------
revision 1.10.2.8
date: 1999/09/07 15:31:58;  author: aqw;  state: Exp;  lines: +288 -285
working on integrating syntax paradigms
----------------------------
revision 1.10.2.7
date: 1999/09/07 09:44:57;  author: aqw;  state: Exp;  lines: +630 -33
added ALL concrete syntax boxes at once
----------------------------
revision 1.10.2.6
date: 1999/09/06 14:55:04;  author: ht;  state: Exp;  lines: +35 -2
added one e: syntax exposition
----------------------------
revision 1.10.2.5
date: 1999/09/02 15:28:27;  author: ht;  state: Exp;  lines: +6 -6
fix URLs for self, a bit
----------------------------
revision 1.10.2.4
date: 1999/09/02 12:53:34;  author: aqw;  state: Exp;  lines: +108 -95
Added not-status-quo marks, changed e.g. String to string
----------------------------
revision 1.10.2.3
date: 1999/09/01 17:02:14;  author: aqw;  state: Exp;  lines: +587 -977
integration of 2.3 from simple
more renaming
----------------------------
revision 1.10.2.2
date: 1999/08/23 15:32:16;  author: aqw;  state: Exp;  lines: +730 -248
Modified simple integration to give preliminary consistency
----------------------------
revision 1.10.2.1
date: 1999/08/22 17:44:40;  author: aqw;  state: Exp;  lines: +317 -260
Textual integration of Simple update of 1999-08-13
----------------------------
revision 1.10
date: 1999/07/20 19:47:27;  author: ht;  state: Exp;  lines: +5 -5
branches:  1.10.2;
fixed dates, dangling reference
----------------------------
revision 1.9
date: 1999/07/19 09:31:26;  author: ht;  state: Exp;  lines: +34 -38
David Beech: 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.
----------------------------
revision 1.8
date: 1999/06/23 10:00:31;  author: aqw;  state: Exp;  lines: +1 -1
fix Id:
----------------------------
revision 1.7
date: 1999/06/23 09:51:15;  author: aqw;  state: Exp;  lines: +28 -28
Restrict content model of 'all' in schema and dtd, change entities for
point releases
----------------------------
revision 1.6
date: 1999/06/23 09:10:01;  author: aqw;  state: Exp;  lines: +147 -187
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
----------------------------
revision 1.5
date: 1999/06/21 16:31:59;  author: aqw;  state: Exp;  lines: +569 -551
Really moved validity-oriented definitions to 6.3 (previous revision
was just housekeeping)
----------------------------
revision 1.4
date: 1999/06/21 16:25:21;  author: aqw;  state: Exp;  lines: +45 -36
moved validity-oriented definitions to 6.3
----------------------------
revision 1.3
date: 1999/06/21 12:25:21;  author: aqw;  state: Exp;  lines: +3540 -3650
Low-level: Normalise line ends, quotes
Editorial: Move all constraintnotes to new separate section
----------------------------
revision 1.2
date: 1999/05/27 14:13:54;  author: aqw;  state: Exp;  lines: +2 -2
fix stylesheet and dtd urls to local versions
----------------------------
revision 1.1
date: 1999/05/23 16:51:11;  author: ht;  state: Exp;
branches:  1.1.1;
Initial revision
]]></eg>
</div1>
<div1 id="openIssues">
<head>Open Issues</head>
<p>A tabulation of open issues flagged above follows:</p>
</div1>
</back>
</spec>
