<?xml version='1.0'?>
<?xml:stylesheet type='text/xsl' href='xmlschema.msxsl'?>
<!-- $Id: structures.xml,v 1.46.1.48.2.3 2000/02/25 02:14:44 ht 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 "<bibref ref='ref-xsp2'/>">
   <!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 -->
   <!ENTITY constraint "identity-constraint">
   <!ENTITY Constraint "Identity-constraint"> <!-- for replacement later? -->
   <!ATTLIST eg text CDATA #IMPLIED> <!-- experimental pointer to out-of-line
                                          example text -->
   <!ELEMENT propdef ANY> <!-- best we can do without editing xml-spec -->
   <!ATTLIST propdef id ID #REQUIRED
                     name CDATA #REQUIRED>
   <!ELEMENT propref EMPTY>
   <!ATTLIST propref ref IDREF #REQUIRED>
   <!ELEMENT xpropref (#PCDATA)>
   <!ATTLIST xpropref href CDATA #IMPLIED>
   <!ELEMENT compdef (proplist)>
   <!ATTLIST compdef name CDATA #REQUIRED
                     ref IDREF #REQUIRED>
   <!ELEMENT proplist (propdef*)>
   <!ELEMENT reprdef (reprelt*,reprcomp*)>
   <!ELEMENT reprelt EMPTY>
   <!ATTLIST reprelt eltname NMTOKENS #REQUIRED
                     local NMTOKEN #IMPLIED>
   <!ELEMENT reprcomp (reprdep?,propmap*)>
   <!ATTLIST reprcomp ref IDREF #REQUIRED
                      abstract CDATA #REQUIRED>
   <!ELEMENT propmap ANY> <!-- best we can do without editing xml-spec -->
   <!ATTLIST propmap name IDREF #REQUIRED>
   <!ELEMENT reprdep ANY> <!-- best we can do without editing xml-spec -->
   <!ELEMENT eltref EMPTY>
   <!ATTLIST eltref ref NMTOKEN #REQUIRED>
   <!ELEMENT stale ANY>
   <!ENTITY % local.p.class "|stale">
   <!ENTITY % local.termdef.class "|propdef">
   <!ENTITY % local.ref.class "|propref|xpropref|eltref">
   <!ENTITY % local.illus.class "|compdef|reprdef|proplist">
   <!ENTITY i-attribute "<xpropref href='http://www.w3.org/TR/xml-infoset#infoitem.element'>attribute</xpropref>">
   <!ENTITY i-children "<xpropref href='http://www.w3.org/TR/xml-infoset#infoitem.element'>children</xpropref>">
   <!ENTITY i-attributes "<xpropref href='http://www.w3.org/TR/xml-infoset#infoitem.element'>attributes</xpropref>">
   <!ENTITY i-attrChildren "<xpropref href='http://www.w3.org/TR/xml-infoset#infoitem.attribute'>children</xpropref>">
   <!ENTITY i-value "<xpropref href='http://www.w3.org/TR/xml-infoset#infoitem.attribute'>value</xpropref>">
   <!ENTITY i-ccode "<xpropref
href='http://www.w3.org/TR/xml-infoset#infoitem.character'>character code</xpropref>">
 ]>
<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.46.1.48.2.3 2000/02/25 02:14:44 ht 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-19991217/">http://www.w3.org/TR/1999/WD-xmlschema-1-19991217/</loc>
    <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>
Following a 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 March, 2000, and to submit this specification thereafter 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>
</p>
     <p>This working draft has been substantially restructured since the previous public
release.  This structural reorganisation is not yet complete.
In this
draft, unrestructured material is distinguished as follows:</p>
     <stale><p>This material may be in the wrong section, and is likely to
contain broken references, particularly to now-vanished abstract syntax
productions, and out-of-date terminology.</p>
     </stale>
     <p>The restructuring of Chapters 1 through 3 is largely completed:
Attributes and Attribute groups give the clearest picture of how Chapters 5 and
6 will eventually look.</p>
     <p>The lengthy introductory example material from the old Chapter 2 has
been moved out of line into a non-normative companion document (<bibref ref="bib-expo"/> and expanded
considerably.  Pointers to this will in due course be added to this document.</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.  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> specifies the XML Schema definition language,
          which offers 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).  This specification depends on <emph>XML Schema Part 2:
            Datatypes</emph>.</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 XML Schemas, including
        an introduction to the nature of XML Schemas and a formal specification
of the XML Schema abstract data model, along with
        other terminology used throughout this document. </p>
      <p>Chapter 3, <specref ref="components"/>, specifies the precise
semantics of each component of the abstract model.</p>
     <p>Chapter 4, <specref ref="declare"/>, presents the XML representation
that maps to the abstract model, in the form
of a DTD and XML Schema for an XML Schema document type, along with rules and
conventions for identifying the components needed for any particular
validation.</p>
      <p>Chapter 5 presents <specref ref="composition"/>, including the
connection between documents and schemas, the import and inclusion of declarations and definitions and
        the foundations of schema-validity.</p>
      <p>Chapter 6 discusses <specref ref="conformance"/>, including the rules
        by which documents are validated, and responsibilities of schema-aware
        processors. </p>
      <p>The normative appendices include a <specref ref="normative-schemaDTD"/>
        and a <specref ref="normative-schemaSchema"/> for the transfer syntax, a <specref ref="normative-glossary"/> [not yet written] and
        <specref ref="normative-references"/>.</p>
    <div2 id="intro-purpose">
      <head>Purpose</head>
      <p>The purpose of &XSP1; is to define the nature of XML schemas
and their component parts,
provide an inventory of XML markup
        constructs with which to represent schemas, and define the
application of schemas to XML documents. </p>
      <p>The purpose of an &XSP1; schema is to define and describe a class of
        XML documents by using schema components to constrain and document the meaning,
        usage and relationships of their constituent parts: datatypes, elements and
        their content and attributes and their values. Schemas may also provide for the specification of additional
        document information, such as default values for attributes
and elements. Schemas have
facilities for self-documentation. 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 allows 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">
    <!-- This section was very charter-like; removed most of it because either it's
    already in the charter, or a separate document should cover how well we met our
    requirements, or the References appendix already covers things.  It's possible
    that this list should be in the Conformance section instead. elm -->
      <head>Dependencies on Other Specifications</head>
      <p>The definition of &XSP1; depends on the following specifications:
      <bibref ref="ref-uri"/>,
      <bibref ref="ref-xmlinfo"/>,
      <bibref ref="ref-xml-namespaces"/>,
      <bibref ref="bib-xpath"/>, and
      <bibref ref="ref-xsp2"/>.
      </p>
    </div2>
    <div2 id="intro-terminology">
        <head>Documentation Conventions and Terminology</head>
        <p>The following highlighting and typography is used to present technical material in
          this document: </p>
        <p>Special terms are defined at their point of
introduction in the text; hyperlinks connect other uses of the
term to the definition.  For example, a definition of
<termref def="key-sampledef">term</termref> might read: <termdef id="key-sampledef" term="term">A <term>term</term> is
          something we use a lot</termdef>.  The definition is labeled as such and the term is highlighted
typographically.  The end of the definition is not specially marked
in the displayed or printed text.</p>
      <p>The following terms are used in building
        definitions and 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>
      </glist>
     <stale>
      <glist><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></glist>
     </stale>
          <p>Non-normative examples are set off
typographically and accompanied by a brief
explanation:</p>
        <note role="example">
          <eg xml:space="preserve">&lt;schema
        targetNamespace="http://www.muzmo.com/XMLSchema/1.0/mySchema" &gt;</eg>
          <p>And an explanation of the example.</p>
      </note>
      <p>The definition of each kind of schema component consists of a list of
      its properties and their contents, followed by descriptions of the
      semantics of the properties:</p>
        <compdef name="Example" ref="intro-terminology">
   <proplist>
  <propdef id="xmpl-prop" name="example property">
Definition of the property.
   </propdef>
  </proplist>
 </compdef>
      <p>The correspondence between an element information item which is part
of the XML representation of a schema and one or more schema components is presented in a tableau
which illustrates the element information item(s) involved,
followed by a tabulation of the correspondence between properties of the component
and properties of the information item.  Where context may determine which of
several different components may arise, several tabulations, one per component,
are given.  In the XML representation, bold-face
attribute names (e.g. <term>count</term> below) indicate a required
attribute information item, and the rest are
optional.  Where an attribute information item has an enumerated type
definition, the values are shown separated by vertical bars, as for
<code>size</code> below; if there is a default value, it is shown
following a colon.  The allowed content of the information item is
shown as a grammar fragment, using the Kleene operators <code>?</code>,
<code>*</code> and <code>+</code>.  The property correspondences are normative, but
the illustration of the XML representation element information items is not.</p>
<reprdef>
 <reprelt eltname="example"/>
 <reprcomp abstract="Example" ref="intro-terminology">
<propmap name="xmpl-prop">Description of what the property corresponds to, e.g. the value of the <code>size</code>
&i-attribute;
</propmap>
</reprcomp>
 </reprdef>

      <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 Group.</edtext>
      </ednote>

      <note>
        <p>General comments directed to all readers. </p>
      </note>
    </div2>
  </div1>
  <div1 id="concepts">
    <head>Conceptual Framework</head>
<p>This chapter gives an overview of &XSP1; at the level of its abstract data model.  (<specref ref="components"/> provides details on this model, and subsequent
chapters define
a normative representation in XML for the components of the model.)
Readers interested primarily in learning to write schema documents may wish to first read <bibref ref="bib-expo"/>  and then consult <specref ref="declare"/>, using the sections below as a guide to the underlying formal structure of the schema language.</p>
   <div2>
    <head>Overview of XML Schema</head>
    <p>An XML Schema
defines a set of schema-valid XML documents.  At a minimum, it consists of type definitions
and element declarations.  It
identifies a set of well-formed element information items (as defined
in <bibref ref="ref-xmlinfo"/>), and furthermore
may specify augmentations to those items and their descendants.  This augmentation makes explicit information which may have
been implicit in the original document, such as default values for
attributes and elements and
the types of element and attribute information items.</p>
    <p>The process of schema validation consists of determining
whether an element information item is a member of the set defined by an XML Schema, and if so of
adding any appropriate augmentations.</p>
   </div2>
   <div2 id="concepts-data-model">
    <head>XML Schema Abstract Data Model</head>
    <p>This specification builds on <bibref ref="ref-xml"/> and
<bibref ref="ref-xml-namespaces"/>.  The concepts and definitions used
herein regarding XML are framed at the abstract level of <xtermref href="http://www.w3.org/TR/1999/WD-xml-infoset-19991220#infoitem">information
items</xtermref> as defined in <bibref ref="ref-xmlinfo"/>.  By
definition, this use of the infoset provides <emph>a priori</emph> guarantees of <xtermref href="http://www.w3.org/TR/REC-xml#sec-well-formed">well-formedness</xtermref>
(as defined in <bibref ref="ref-xml"/>) and <xtermref href="http://www.w3.org/TR/REC-xml-names/#Conformance">namespace
conformance</xtermref> (as defined in <bibref ref="ref-xml-namespaces"/>) for all candidates for schema-validity.</p>
    <p>Just as <bibref ref="ref-xml"/> and
<bibref ref="ref-xml-namespaces"/> can be described in terms of
information items, XML Schemas can be described in terms of an
abstract data model.  In defining XML Schemas in terms of an abstract
data model, this specification rigorously specifies the information which
must be available to a conforming XML Schema processor.  The abstract
model for schemas is conceptual only, and does not mandate any
particular implementation or representation of this information.  To
facilitate interoperation and sharing of schema information, a
normative interchange format for schemas is described in <specref ref="declare"/></p>
<ednote>
<edtext>The datatype spec's use of the word "component" makes things somewhat confusing
next to this specification's use of the same word.  Perhaps the terminology in the datatype spec should be revised?</edtext>
</ednote>
<p><termdef id="key-component" term="schema component"> <term>Schema component</term> is the generic term for the building blocks that comprise the abstract data model of the schema.
</termdef>
<termdef id="key-schema" term="XML Schema">
An <term>XML Schema</term> is a
set of <termref def="key-component">schema component</termref>s.</termdef>  There are 12 kinds of
component in all, falling into three groups.  The primary components
are as follows.  They may have names, and (except for some element
declarations) may be independently accessed:</p>
<ulist>
<item><p>Simple type definitions
</p></item>
<item><p>Complex type definitions</p></item>
<item><p>Element declarations</p></item>
</ulist><p>The secondary components are as follows. Like the primary
components, they may have names and be independently accessed:</p>
<ulist>
<item><p>Attribute group definitions</p></item>
<item><p>&Constraint; definitions</p></item>
<item><p>Model group definitions</p></item>
<item><p>Notation declarations</p></item>
</ulist>
<p>Finally, the <quote>helper</quote> components provide small parts of
other components; they are not independent of their context and
cannot be independently accessed:</p>
<ulist>
<item><p>Annotations</p></item>
<item><p>Attribute declarations</p></item>
<item><p>Model groups</p></item>
<item><p>Particles</p></item>
<item><p>Wildcards</p></item>
</ulist>
     <p>During validation, <termdef id="key-declaration" term="declaration"><term>Declaration</term> components are associated by
(qualified) name to information items being validated</termdef>.</p>
<p>On the other hand, <termdef id="key-definition" term="definition"><term>definition</term> components define
internal schema components that can be used in other schema components.</termdef>
</p>
<p>
<termdef id="key-compName" term="component name">Declarations and
definitions may have and be identified by <term>name</term>s, which are NCNames as defined by <bibref ref="ref-xml-namespaces"/></termdef>.</p>

    <p>  <termdef id="key-targetNS" term="target namespace">Several kinds
of component have a <term>target namespace</term>, which is either
<termref def="key-null">null</termref> or a namespace URI, also as
defined by <bibref ref="ref-xml-namespaces"/></termdef>.  The target
namespace serves to identify the namespace within which the
association between the component and its name exists.  In the case of
declarations, this in turn determines the namespace URI of, for example, the element
information items it may validate.</p>
    <note>
     <p>At the abstract level, there is
no requirement that the components of a schema share a
<termref def="key-targetNS">target namespace</termref>.  Any schema for use in
schema-validation of documents containing names from more than one namespace
will of necessity include components with different <termref def="key-targetNS">target namespaces</termref>.  This contrasts with
the situation at the level of the <specref ref="declare"/>, in which each schema document contributes
definitions and declarations to a single target namespace.</p>
    </note>
    <p>Schema-validity, defined in detail in <specref ref="conformance"/>, is a
relation between information items and schema components.  For example, an
attribute information item may be schema-valid with respect to an attribute
declaration, a list of element information items may be schema-valid with
respect to a content model, and so on.  The following sections briefly
introduce the kinds of components in the
schema abstract data model, other major features of the abstract model, and how they contribute to the overall definition of
schema-validity.  </p>

     <div3 id="Type_Definition_Summary">
<head>Type Definition Components</head>
<p>The abstract model provides two kinds of type definition component: simple
and complex.</p>
<p><termdef id="key-typeDefn" term="type definition">This specification uses
the phrase <term>type definition</term> in cases where no distinction
need be made between simple and complex types.</termdef></p>
<p>Type definitions form a hierarchy with a single root.  First we describe characteristics of that
hierarchy, then provide an introduction to simple and complex type definitions themselves.</p>
<div4 id="Type_Derivation">
<head>Type Definition Hierarchy</head>
<p>
<termdef id="key-typeDefinitionHierarchy" term="Type Definition
Hierarchy">Except for a distinguished <termref def="key-urType">ur-type definition</termref>, every <termref def="key-typeDefn">type definition</termref> is, by construction, either a
<termref def="key-typeRestriction">restriction</termref>, an <termref def="key-typeExtension">extension</termref> of some other type definition.  Collectively, the graph of these relationships forms a tree known as the <term>Type Definition Hierarchy</term>.</termdef>
</p>
<p><termdef id="key-typeRestriction" term="restriction">A type
definition whose
declarations or facets are in a one-to-one relation with those of another type
definition, with each in turn restricting the possibilities of the one it
corresponds to, is said to be a <term>restriction</term>.</termdef>
The specific restrictions might include narrowed ranges or reduced
alternatives.
Members of a type, A, whose definition is a <termref def="key-typeRestriction">restriction</termref> of the definition of another type, B, are always members of type B as well.</p>
<p><termdef id="key-typeExtension" term="extension">A complex type definition
which allows element or attribute content in addition to that allowed by another type
definition is said to be an <term>extension</term>.</termdef></p>
<p><termdef id="key-urType" term="ur-type definition">A distinguished <term>ur-type
definition</term> is present in each <termref def="key-schema">XML Schema</termref>, serving as the root of the type
definition hierarchy for that schema.</termdef>  The ur-type definition has
the unique characteristic that it can function as a complex or a
simple type definition, according to context.
Specifically, <termref def="key-typeRestriction">restriction</termref>s of the ur-type definition can
themselves be either simple or complex type definitions.
</p>
<p><termdef id="key-baseTypeDefinition" term="base type definition">A type definition used as the
basis for an <termref def="key-typeExtension">extension</termref> or
<termref def="key-typeRestriction">restriction</termref> is known as
the <term>base type definition</term> of that definition.</termdef>
</p>
<ednote><edtext>Should use this as a target for other references
throughout the text.</edtext></ednote>
</div4><div4 id="Simple_Type_Definition">

     <head>Simple Type Definition</head>
     <p>A simple type definition is a set of constraints on strings and information about the values they encode, applicable to the &i-children; of an attribute
information item or of an element information item with no element children.
Informally, it applies to attribute values and text-only content of elements.
</p>
     <p>Each simple type definition, whether built-in (that is, defined in &XSP2;) or
user-defined, is a  <termref def="key-typeRestriction">restriction</termref> of some particular
simple <termref def="key-baseTypeDefinition">base type
definition</termref>, which can be the <termref def="key-urType">ur-type definition</termref>.</p>


     <p>For details on the composition and
schema-validation contributions of simple type definitions, see <specref ref="Simple_Type_Definition_details"/> and &XSP2;.  The latter also defines an extensive inventory of
pre-defined simple types.  See <specref ref="declare-datatype"/> for the XML representation of
simple type definitions, and <specref ref="coss-st"/> for constraints on simple
type definition components as such.</p>
</div4>
<div4 id="Complex_Type_Definition">
<head>Complex Type Definition</head>
<p>A complex type definition is a set of attribute declarations and a content type, applicable to the &i-attributes; and
&i-children; of an element information item respectively.  The content type may require the &i-children; to be empty, to be a string which is schema-valid with respect to particular simple type or to contain element information items which is schema-valid with respect to a particular model group, with or without character information items as well.</p>
     <p>Each is complex type definition is either a:
<ulist>
<item>
<p>A <termref def="key-typeRestriction">restriction</termref> of a complex <termref def="key-baseTypeDefinition">base
type definition</termref>, or...</p>
</item>
<item>
<p>An <termref def="key-typeExtension">extension</termref> of a simple or complex <termref def="key-baseTypeDefinition">base
type definition</termref>, or...</p>
</item>
<item>
<p>A <termref def="key-typeRestriction">restriction</termref> of the
<termref def="key-urType">ur-type definition</termref>.</p>
</item>
</ulist>
</p>
<p> A
complex type which extends another does so by having additional content model
particles at the end of the other definition's content model,
or by having additional attribute declarations, or both.
  <note>
   <p>This specification allows only appending, and not other kinds of
extensions. This decision
simplifies application processing required to cast instances from derived to
base type.  Future versions may allow more kinds of extension, requiring more
complex transformations to effect casting.</p>
  </note></p>
     <p>
See <specref ref="Complex_Type_Definition_details"/> for the composition and
schema-validation contributions of complex type definition schema components, <specref ref="declare-type"/> for the XML representation of
complex type definitions and <specref ref="coss-ct"/> for constraints on complex
type definition components as such.</p>
</div4>
</div3>

     <div3 id="Declarations_Summary">
<head>Declaration Components</head>
<p>There are three kinds of declaration component: element, attribute, and
notation.  Each described in a section below. Also included is a discussion of element equivalence
classes, which is a feature provided in conjunction with element declarations.  </p>
<div4 id="Element_Declaration">
<head>Element Declaration</head>
<p>An element declaration is an association of a name with a type definition, either simple or
complex, an (optional) default value and a set of &constraint;
definitions.  The association is either global or scoped to a containing complex type definition.  A
global element declaration with name 'A' is broadly comparable to a pair of
DTD declarations as follows, where the associated type definition
fills in the ellipsis:</p>
<eg>&lt;!ELEMENT A . . .&gt;
&lt;!ATTLIST A . . .&gt;
</eg>
<p>Element declarations contribute to
schema-validity as part of model group validation, when their defaults and type components are checked against an element
information item with a matching name and namespace, and by triggering
&constraint; definition validation.</p>
     <p>
See <specref ref="Element_Declaration_details"/> for the composition and
schema-validation contributions of element declaration schema components, <specref ref="declare-element"/> for the XML representation of
element declarations and <specref ref="coss-element"/> for constraints on
element declaration components as such.</p>
</div4>
<div4 id="Element_Equivalence_Class">
<head>Element Equivalence Class</head>
<p>In XML 1.0, the name and content of an element must correspond exactly to the element type referenced in the corresponding content model.</p>
<p><termdef id="key-equivalenceClass" term="element equivalence class">Through the new mechanism of <term>element equivalence classes</term>, XML Schemas provides a more powerful model supporting substitution of one named element for another.</termdef>
Any global element declaration can serve as the defining element, or
exemplar, for an element equivalence class.  Other global element declarations, regardless of target namespace, can be designated as members of the class defined by the exemplar.  In a suitably enabled content model, a reference to the exemplar validates not just the exemplar itself, but elements corresponding to any member of the equivalence class as well.
</p>
<p>All such members must have type definitions which are either the same as the
exemplar's type definition or
restrictions or extensions of it.
Therefore, although the names of elements can vary widely as new
namespaces and members of the equivalence class are defined, the
content of member elements is strictly limited according to the type
definition of the equivalence class exemplar.</p>
<p>Note that element equivalence classes are not represented as separate components.  They are
specified in the property values for element declarations (see <specref ref="Element_Declaration"/>).</p>
</div4>
<div4 id="Attribute_Declaration">
<head>Attribute Declaration</head>
<p>An attribute declaration is an association between a name and a simple type definition, together
with occurrence information and (optionally) a default value. The
association is local to its containing complex type definition.  Attribute declarations contribute to
schema-validity as part of complex type definition validation, when their
occurrence, defaults and type components are checked against an attribute
information item with a matching name and namespace.</p>
     <p>
See <specref ref="Attribute_Declaration_details"/> for the composition and
schema validation contributions of attribute declaration schema components, <specref ref="declare-attribute"/> for the XML representation of
attribute declarations and <specref ref="coss-attribute"/> for constraints on
attribute declaration components as such.</p>
</div4>
<div4 id="Notation_Declaration">
<head>Notation Declaration</head>
<p>A notation declaration is an association between a name and an identifier for a
notation.  For an attribute information item to be schema-valid with respect to a
<code>NOTATION</code> simple type definition, its value must have been declared
with a notation declaration.</p>
     <p>
See <specref ref="Notation_Declaration_details"/> for the composition and
schema validation contributions of notation declaration schema components, <specref ref="declare-notation"/> for the XML representation of
notation declarations and <specref ref="coss-notation"/> for constraints on
notation declaration components as such.</p>
</div4>
</div3>

     <div3 id="Model_Group_Summary">
<head>Model Group Components</head>
<p>The model group, particle, and wildcard components contribute to
the portion of a complex type definition that controls an element
information item's content type.</p>
<div4 id="Model_Group">
<head>Model Group</head>
<p>A model group is a constraint in the form of a grammar fragment that applies to
lists of element information items.  It consists of a list of particles, i.e.
element declarations, wildcards and model groups.  There are three varieties of
model group:</p>
<ulist>
<item><p>Sequence (the element information items
match the particles in sequential order)</p></item>
<item><p>Conjunction (the element information items match the
particles, in any order)</p></item>
<item><p>Disjunction (the element information items match
one of the particles)</p></item>
</ulist>
     <p>
See <specref ref="Model_Group_details"/> for the composition and
schema-validation contributions of model group schema components, <specref ref="Complex_Type_Definition_details"/> for the use of model groups as content models, <specref ref="declare-contentModel"/> for the XML representation of
model groups and <specref ref="coss-modelGroup"/> for constraints
on model group components as such.</p>
</div4>
<div4 id="Particle">
<head>Particle</head>
<p>A particle is a term in the grammar for element content, consisting of either an element
declaration, a wildcard or a model group, together with
occurrence constraints.  Particles contribute to
schema-validity as part of complex type validation, when they allow anywhere
from zero to many element information items or sequences thereof, depending on
their contents and occurrence
constraints.</p>
      <p><termdef id="key-contentModel" term="content model">A particle can
be used in a complex type definition to express a validity
constraint on the &i-children; of an element information item; such a particle is called
a <term>content model</term></termdef>.
<note>
<p>&XSP1; <termref def="key-contentModel">content model</termref>s are similar to but more expressive than
<bibref ref="ref-xml"/> content models; unlike <bibref ref="ref-xml"/>, &XSP1; applies <termref def="key-contentModel">content model</termref>s to the validation of both mixed and element-only content. </p>
</note></p>
     <p>
See <specref ref="Particle_details"/> for the composition and
schema-validation contributions of particle schema components, <specref ref="declare-contentModel"/> for the XML representation of
particles and <specref ref="coss-particle"/> for constraints
on particle components as such.</p>
</div4>
<div4 id="Wildcard">
<head>Wildcard</head>
<p>A wildcard is a special kind of particle which matches element information items dependent on their namespace URI, independently
of their local names.</p>
     <p>
See <specref ref="Wildcard_details"/> for the composition and
schema-validation contributions of wildcard schema components, <specref ref="declare-openness"/> for the XML representation of
wildcards and <specref ref="coss-wildcard"/> for constraints
on wildcard components as such.</p>
</div4>
</div3>

     <div3 id="&Constraint;_Definition">
<head>&Constraint; Definition Components</head>
<p>A &constraint; definition is an association between a name and one of
several varieties of
&constraint; related to uniqueness and reference.  All the
varieties use <bibref ref="bib-xpath"/> expressions to pick out sets of
information items relative to particular target element
information items which are unique, or a key, or a valid reference, within
a specified scope. An element information item is only schema-valid with
respect to an element declaration
with &constraint; definitions if those definitions are all satisfied for all the descendants
of that element information item which they pick out.</p>
     <p>
See <specref ref="&Constraint;_Definition_details"/> for the composition and
schema-validation contributions of &constraint; definition schema components, <specref ref="declare-key"/> for the XML representation of
&constraint; definitions and <specref ref="coss-&constraint;"/> for constraints
on &constraint; definition components as such.</p>
    </div3>
<div3 id="Group_Definitions">
<head>Group Definition Components</head>
<p>There are two kinds of convenience definitions available for use
in reusing pieces of complex type definitions: model group definitions
and attribute group definitions.</p>
<div4 id="Model_Group_Definition">
<head>Model Group Definition</head>
<p>A model group definition is an association between a name and a model group,
for use in reusing the same model group in several complex type
definitions.</p>
     <p>
See <specref ref="Model_Group_Definition_details"/> for the composition and
schema validation contributions of model group definition schema components, <specref ref="declare-namedModelGroup"/> for the XML representation of
model group definitions and <specref ref="coss-groupDef"/> for constraints
on model group definition components as such.</p>
</div4>
<div4 id="Attribute_Group_Definition">
<head>Attribute Group Definition</head>
<p>An attribute group definition is an association between a name and a set of attribute declarations,
for use in reusing the same set in several complex type
definitions.</p>
     <p>
See <specref ref="Attribute_Group_Definition_details"/> for the composition and
schema-validation contributions of attribute group definition schema components, <specref ref="declare-attributeGroup"/> for the XML representation of
attribute group definitions and <specref ref="coss-attrGroup"/> for constraints
on attribute group definition components as such.</p>
</div4>
</div3>
    <div3 id="Annotation">
     <head>Annotation Components</head>
     <p>An annotation is information for human and/or mechanical
consumers. The interpretation of such information is
not defined in this specification.</p>
     <p>
See <specref ref="Annotation_details"/> for the composition and
schema-validation contributions of annotation schema components, <specref ref="declare-annotation"/> for the XML representation of
annotations and <specref ref="coss-annotation"/> for constraints
on annotation components as such.</p>
<ednote>
<edtext>We need a Chapter 2 intro to the interchange syntax.</edtext>
</ednote>
     </div3>
   </div2>
    <div2 id="concepts-schemaConstraints">
      <head>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>The preceding section focussed on schema-validity, that is
the constraints on information items which schema components supply.  In fact
however this specification provides four different kinds of normative statements about schema
        components, their representations in XML and their contribution to the
schema-validation of information items:</p>
      <glist>
        <gitem>
          <label><termdef id="gloss-cos" term="Constraint on Schemas"><term>Constraint on Schemas</term></termdef>
          </label>
          <def>
            <p>Constraints on the schema components themselves, i.e.
conditions components must satisfy to be components at all.  Largely to be
found in <specref ref="conformance"/>.</p>
          </def>
        </gitem>
       <gitem>
        <label><termdef id="gloss-src" term="Schema Representation Constraint"><term>Schema Representation Constraint</term></termdef></label>
        <def>
         <p>Constraints on the
representation of schema components in XML.  Some but not all of these are expressed in <specref ref="normative-schemaDTD"/> and <specref ref="normative-schemaSchema"/>.  Largely to be
found in <specref ref="declare"/>.</p>
        </def>
       </gitem>
        <gitem>
          <label><termdef id="gloss-cvc" term="Validity Contribution"><term>Validity Contribution</term></termdef> </label>
          <def>
            <p>Constraints expressed by schema components which information
items must satisfy to
              be schema-valid.  Largely to be
found in <specref ref="components"/>.</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-schema-validation information sets
expressed by schema components, which follow
              as a consequence of schema-validation.
Largely to be
found in <specref ref="components"/>.</p>
          </def>
        </gitem>
      </glist>
        <p>Schema information set
          contributions are not new.  XML 1.0
          validation augments the XML 1.0 information set in similar ways,
for example by
          providing values for attributes not present in instances, and by implicitly
          exploiting type information for normalisation or access.
(As an example of the latter case, consider the
          effect of <code>NMTOKENS</code> on attribute whitespace, and the semantics of
          <code>ID</code> and <code>IDREF</code>.) By including schema
information set contributions, this specification makes explicit some features
that XML 1.0 left implicit.</p>

    </div2>
<div2 id="concepts-conformance">
<head>Conformance</head>
<p>This specification describes three levels of conformance for schema aware processors.  The first is
required of all processors.  Support for the other two will depend on the application environments
for which the processor is intended.</p>
<p><termdef id="key-minimallyConforming" term="minimally conforming"><term>Minimally conforming</term> processors must completely and
correctly implement the <termref def="gloss-cos">Constraints on
Schemas</termref>, <termref def="gloss-cvc">Validity Contributions</termref>,
and <termref def="gloss-sic">Schema Information
Set Contributions</termref> contained in this specification.</termdef></p>
<p><termdef id="key-interchange" term="conformance to the XML Representation of Schemas">Processors which accept
schemas in the form of XML documents as described in <specref ref="declare"/> are
additionally said to provide <term>conformance to the XML Representation of Schemas</term>.
</termdef>
Such processors must, when processing schema documents, completely and
correctly implement all <termref def="gloss-src">Schema Representation
Constraint</termref>s in this specification, and must adhere exactly to the
specifications in <specref ref="declare"/> for mapping the contents of such documents to <termref def="key-component">schema component</termref>s for use in validation.</p>
<note>
<p>By separating the conformance requirements relating to the concrete syntax of XML schema
documents, this specification admits  processors
which validate using schemas stored in optimised binary
representations, dynamically created schemas represented as programming language data structures, or implementations in which particular schemas are compiled into executable code
such as C or Java.  Such processors can be said to be <termref def="key-minimallyConforming">minimally conforming</termref> but not necessarily in <termref def="key-interchange">conformance to the XML Representation of Schemas</termref>.</p>
</note>
<p><termdef id="key-fullyConforming" term="fully conforming"> <term>Fully conforming</term>
processors are network-enabled processors which support both levels of conformance described
above, and which must additionally be capable of accessing
schema documents from the World Wide Web according to <specref ref="web-representation"/> and XXX.
</termdef>.
</p>
<ednote>
<edtext>A a reference to the rules for handling
schema location, dereference of namespace Uris, etc.</edtext>
</ednote>
<note><p>Although this specification provides just these three standard levels of conformance, it is
anticipated that other conventions can be established in the future.  For example, the World Wide
Web Consortium is considering conventions for packaging on the Web a variety of
resources relating to individual documents and namespaces.  Should such
developments lead to new conventions for representing schemas, or for accessing them on the Web,
new levels of conformance can be established and named at that time.  There is no need to modify
or republish this recommendation to define such additional levels of conformance.</p></note>
</div2>
    <div2 id="concepts-nameSymbolSpaces">
      <head>Names and Symbol Spaces</head>
      <p>As discussed in <specref ref="concepts-data-model"/>, most schema
        components (may) have <termref def="key-compName">name</termref>s.
If all such names were assigned from the same <quote>pool</quote>, then
        it would be impossible to have, for example, a simple type definition and an element
declaration both with the name
<quote>title</quote> in a given <termref def="key-targetNS">target namespace</termref>.</p>
      <p>
This specification
therefore introduces the term
        <termdef id="key-symbolSpace" term="symbol space"><term>symbol space</term> to represent a
collection of names, each of which is unique with respect to the others.</termdef>  A symbol space 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"/>.
There is a single distinct symbol space within a given <termref def="key-targetNS">target
namespace</termref> for each kind of definition and declaration component
identified in <specref ref="concepts-data-model"/>, except that within a target namespace, simple
type definitions and complex type definitions share a symbol space.
Within a given symbol space, names are unique, but the same name may appear in more than one symbol space without conflict. For example, the same name can appear in both a type definition and an element declaration, without conflict or necessary relation between the two.
</p>
      <p>Attribute declarations and locally scoped element
declarations are special with regard to symbol spaces.
Every complex type definition defines its own attribute declaration
symbol space and local element declaration symbol
        space, where these symbol spaces are distinct from each other and from any of the other
symbol spaces.  So, for example, several complex type definitions having
the same target namespace can contain
an attribute declaration for the unqualified name <quote>priority</quote>, or contain a local element declaration
for the name <quote>address</quote>, without conflict or necessary relation between
the two.</p>
    </div2>
<div2 id="Instance_Document_Constructions"> <head>Schema-Related Markup in
Documents Being Schema-Validated</head>
  <p>The XML representation of schema components uses a vocabulary
identified by the namespace URI <code>&XMLSchemaNS;</code>.
&XSP1; also defines several attributes for direct use in XML documents.  These attributes are in a different namespace,
which has the namespace URI <code>&XMLSchemaInstanceNS;</code>.
For brevity, the text and examples in this specification use the prefix
<code>xsi:</code> to stand for this latter namespace; in practice,
any prefix can be used.
</p>
<div3 id="xsi:type">
<head>xsi:type</head>
<p>The <specref ref="Simple_Type_Definition"/> or <specref ref="Complex_Type_Definition"/> used to validate an element is usually
determined by reference to the appropriate schema components.
However, when permitted by those components, an element can
explicitly assert its type using the attribute <code>xsi:type</code>.
The value of this attribute is a <xtermref href="&XSP2.URI;#QName">QName</xtermref>;  see <specref ref="src-qname"/> for
the means by which the <xtermref href="&XSP2.URI;#QName">QName</xtermref> is
associated with a type definition.
</p>
</div3>
<div3 id="xsi:null">
<head>xsi:null</head>
<p>&XSP1; introduces a distinguished <code>null</code> value for XML document elements.  An
element has the null value if it has no &i-children; and carries the attribute <code>xsi:null</code>.</p>
<ednote>
<edtext>Are other attributes allowed?  Must sync with validation rules.</edtext>
</ednote>
</div3>
<div3 id="xsi:schemaLocation">
<head>xsi:schemaLocation</head>
<p>The <code>xsi:schemaLocation</code> attribute can be used in a document to provide
hints as to the physical location of schema documents to be used for validation.
</p>
</div3></div2>
<div2 id="web-representation">
<head>Representation of Schemas on the World Wide Web</head>
<p>On the World Wide Web, schemas are conventionally represented as documents of MIME type
"text/xml", conforming to the specifications in <specref ref="declare"/>.   </p>
</div2>
 </div1>
  <div1 id="components">
   <head>Schema Component Details</head>
   <p>The following sections provide full details on the properties and
significance of each kind of schema component.  For each property, its range,
that is the kinds of values it may have, is defined.  This can be understood as
defining a schema as a labelled directed graph, where every vertex is a schema
component or a literal (string, boolean, number) and every labelled edge a property.  Any property not
identified as optional is required to be present, optional properties which are absent are taken to have <termref def="key-null">null</termref> as their value.  Any
property identified as a having a set, subset or list value may have an empty value unless this is explicitly
ruled out:  this is <emph>not</emph> the same as <termref def="key-null">null</termref>.  Any property value identified as subset of some set may be equal to that set, unless a proper subset is explicitly called for.
By 'string' here and below is meant a
sequence of ISO 10646 character codes identified as <xtermref href="http://www.w3.org/TR/REC-xml#charset">legal XML character codes</xtermref>
in <bibref ref="ref-xml"/>.</p>
   <ednote>
    <edtext>Or the UNICODE 3 addendum, where/when?</edtext>
   </ednote>
   <p>Throughout the following sections, when we refer to the &i-value; of some
attribute information item, we mean by this a string composed of, in order, the
&i-ccode; of each character information item in the &i-attrChildren; of that
attribute information item.</p>
   <p>Many properties of schema components are identified below as having
other schema components as values.  For the purposes of exposition, the definitions in
this section assume that (unless the property is explicitly identified as
optional) all such values are in fact present.  When schema
components are constructed from XML representations involving reference by name
to other components, this assumption may be violated if one or more references
cannot be discharged.  This specification addresses the matter of missing
components in a uniform manner, described in <specref ref="conformance-missing"/>:  no mention of
handling missing components will be found in the individual component
descriptions below.</p>
   <note>
    <p>Schema components are an idealisation of the information a schema-aware
processor requires:  implementations are not constrained in how they provide
it.  In particular, no implications about literal embedding versus indirection
follow from the use above of language such as "properties . . . having . . .
components as values".</p>
   </note>
   <note>
    <p>Readers whose primary interest is in the XML representation of schemas
may wish to skip this chapter on the first reading, concentrating on <specref ref="declare"/> and &expo;.</p>
   </note>
<ednote>
<edtext>Due to time constraints in preparing this draft, the {annotation} properties are not explicitly described for the
components below.  In all cases, the property is an annotation
(see "Annotation Details" below).</edtext>
</ednote>
   <div2 id="Attribute_Declaration_details">
    <head>Attribute Declaration Details</head>
    <p>Attribute declarations provide for:</p>
    <ulist>
     <item><p>Requiring/preventing the appearance of attribute information items;</p></item>
     <item><p>Constraining attribute information item values by a simple type definition;</p></item>
     <item><p>Providing default or fixed values for an attribute information item.</p></item>
    </ulist>
    <p>The attribute declaration schema component has the following
properties:</p>
    <compdef name="Attribute Declaration" ref="Attribute_Declaration">
     <proplist>
      <propdef id="a-name" name="name">An NCName as defined by
<bibref ref="ref-xml-namespaces"/>.</propdef>
      <propdef id="a-target_namespace" name="target namespace">Either <termref def="key-null">null</termref> or
a namespace URI, as defined in <bibref ref="ref-xml-namespaces"/>.</propdef>
      <propdef id="a-simple_type_definition" name="simple type definition">A
simple type definition.</propdef>
      <propdef id="a-min_occurs" name="min occurs"><pt>0</pt> or
<pt>1</pt></propdef>
      <propdef id="a-max_occurs" name="max occurs"><pt>0</pt> or
<pt>1</pt></propdef>
      <propdef id="a-value_constraint" name="value constraint">Optional.  A pair
consisting of a string and one of <pt>default</pt>, <pt>fixed</pt>.</propdef>
      <propdef id="a-annotation" name="annotation">Optional.  An annotation</propdef>
     </proplist>
    </compdef>
<p>The <propref ref="a-name"/> property must match the local part of the names of attributes being validated.</p>
<p>A <quote>qualified</quote> attribute name is one that appears with a namespace prefix which is itself declared with a
value other than the empty string.  A non-<termref def="key-null">null</termref> value of the <propref ref="a-target_namespace"/> property provides for validation of
such attributes qualified with an identical namespace URI.  Null values of <propref ref="a-target_namespace"/> provide for validation of local
(unprefixed) attributes. Each complex type definition provides its own symbol space for the
names of its associated local attribute declarations. (E.g. an attribute
named <code>title</code> within one type definition need not have the same
simple type definition as one declared within another complex
type; neither of these need agree with the declaration for a similarly named qualified attribute.)</p>
<p>A <propref ref="a-min_occurs"/> of 1 specifies that the corresponding attribute must
be present; a value of 0 allows for optional attributes.
Similarly, a <propref ref="a-max_occurs"/> of 0 indicates an attribute that must
not be present; a value of 1 (the normal case) allows the attribute to occur
explicitly.</p>
<p>The value of the attribute must conform to the supplied <propref ref="a-simple_type_definition"/>.</p>
<p><propref ref="a-value_constraint"/> reproduces the functions of XML 1.0 default and #FIXED
attribute values.  <pt>fixed</pt> indicates that the attribute value must match the supplied
constraint string; <pt>default</pt> specifies that the attribute is to appear unconditionally in
the post-schema-validation information set, with the supplied value used
whenever the attribute is not actually present.</p>
<note><p>A more complete and formal presentation of the semantics of <propref ref="a-name"/>, <propref ref="a-target_namespace"/>,
<propref ref="a-min_occurs"/>, <propref ref="a-max_occurs"/> and
<pt>default</pt> <propref ref="a-value_constraint"/> is provided in
conjunction with other aspects of complex type validation (see <specref ref="cvc-complex-type"/>.)</p></note>
    <p><bibref ref="ref-xmlinfo"/> distinguishes namespace declarations such as <code>xmlns</code> or <code>xmlns:xsl</code> from
attributes.  Accordingly, it is unnecessary and in fact not possible for
schemas to contain attribute declarations corresponding to such
namespace declarations, see <specref ref="no-xmlns"/>.  No means is provided to supply a
default value for a namespace declaration.</p>
    <p>See <specref ref="declare-attribute"/> for the XML representation of
attribute declarations and <specref ref="coss-attribute"/> for constraints on attribute
declaration components as such.</p>
<constraintnote type="cvc" id="cvc-attribute">
     <head>Attribute Valid</head>
     <p>For an attribute information item to be schema-valid with respect to an
attribute declaration, its &i-value; must
      <ulist>
       <item>
        <p>be schema-valid with respect to the <propref ref="a-simple_type_definition"/> as per <specref ref="cvc-simple-type"/>;</p>
       </item>
       <item>
        <p>match the string of the <propref ref="a-value_constraint"/> if it is
present and <pt>fixed</pt>.</p>
       </item>
      </ulist>
     </p>
    </constraintnote>

    <constraintnote type="sic" id="sic-attrType">
     <head>Attribute Type</head>
     <p>In the post-schema
validation infoset a <xpropref>schema type</xpropref> property is added to the attribute information item with the <propref ref="a-simple_type_definition"/> as its value.</p>
    </constraintnote>
   </div2>
   <div2 id="Element_Declaration_details">
    <head>Element Declaration Details</head>
       <p>Element declarations provide for:</p>
    <ulist>
     <item><p>Establishing the validity of element information items.</p></item>
     <item><p>Determining schema information set contributions, such as default values.</p></item>
     <item><p>Establishing uniquenesses and reference constraint relationships among the values of related elements and
attributes.</p>
</item>
     <item><p>Controlling the substitutability of elements through the
mechanism of <termref def="key-equivalenceClass">element equivalence classes</termref>.</p>
     </item>
    </ulist><p>The element declaration schema component has the following
properties:</p>

    <compdef name="Element Declaration" ref="Element_Declaration">
     <proplist>
      <propdef id="e-name" name="name">An NCName as defined by
<bibref ref="ref-xml-namespaces"/>.</propdef>
      <propdef id="e-target_namespace" name="target namespace">Either <termref def="key-null">null</termref> or
a namespace URI, as defined in <bibref ref="ref-xml-namespaces"/>.</propdef>
      <propdef id="scope" name="scope">Optional.  Either <pt>global</pt> or a complex type
definition.</propdef>
      <propdef id="type_definition" name="type definition">Either a simple type
definition or a complex type definition.</propdef>
      <propdef id="nullable" name="nullable">A boolean</propdef>
      <propdef id="e-value_constraint" name="value constraint">Optional.  A
pair consisting of a string and one of <pt>default</pt>, <pt>fixed</pt>.</propdef>
      <propdef id="&constraint;_definitions" name="&constraint; definitions">A set
of constraint definitions.</propdef>
      <propdef id="class_exemplar" name="equivalence class affiliation">Optional.  A global
element definition.</propdef>
      <propdef id="e-final" name="equivalence class exclusions">A subset of
{<pt>extension</pt>, <pt>list</pt>,
<pt>restriction</pt>, <pt>reproduction</pt>}.  </propdef>
      <propdef id="e-exact" name="disallowed substitutions">A subset of {<pt>equivClass</pt>, <pt>extension</pt>, <pt>list</pt>,
<pt>restriction</pt>, <pt>reproduction</pt>}.</propdef>
      <propdef id="e-abstract" name="abstract">A boolean</propdef>
      <propdef id="e-annotation" name="annotation">Optional.  An annotation</propdef>
     </proplist>

    </compdef>
<p>The <propref ref="e-name"/> property must match the local part of the names
of elements being validated.</p>
<p>A <propref ref="scope"/> of <pt>global</pt> declares elements available for use in content
models throughout the schema.  Locally scoped elements are available for use only within the
complex type identified by the <propref ref="scope"/> property.  For globally scoped element declarations, a non-<termref def="key-null">null</termref> value of the <propref ref="a-target_namespace"/> property provides for validation of
namespace qualified elements.  <termref def="key-null">Null</termref> values of
<propref ref="a-target_namespace"/> validate unqualified elements, including
locally scoped elements.  This property is also <termref def="key-null">null</termref> in the case of non-<pt>global</pt> declarations within named model groups:  their scope will be determined when they are used in the construction of complex type definitions.</p>
<p>An element is schema-valid
if it obeys the schema validity constraints of the <propref ref="type_definition"/>.  For such an
element, the schema information set contributions from the <propref ref="type_definition"/> are applied to the
corresponding element information item in the post-schema-validation information set.  <propref ref="type_definition"/> must not be an
<pt>abstract</pt> type definition.
</p>
<p>If <propref ref="nullable"/> is <pt>true</pt>, then the element is also schema valid if it has
no text or element content, and
carries the namespace qualified attribute with <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> <code>null</code> from namespace <code>&XMLSchemaInstanceNS;</code> (see <specref ref="xsi:null"/>). Formal details of element validation are described in <specref ref="cvc-elt"/>.</p>
<p><propref ref="e-value_constraint"/> establishes a default or fixed value for an element.  If <pt>default</pt> is specified, and if the element
being validated is empty, then the supplied
constraint string becomes <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.character">character</xpropref>
&i-children; of the validated element in the post-schema-validation
infoset.  If <pt>fixed</pt> is specified, then the element's content
must either be empty, in which case <pt>fixed</pt> behaves as <pt>default</pt>,
or it must match the supplied constraint string.</p>
<p><propref ref="&constraint;_definitions"/> express constraints establishing uniquenesses and reference relationships among the values of related elements and
attributes.  See <specref ref="&Constraint;_Definition_details"/>.</p>
<p>Element declarations are members of the equivalence class, if any, identified
by <propref ref="class_exemplar"/>.  Membership is transitive;  an element
declaration is implicitly a member of any class of which its <propref ref="class_exemplar"/> is a member.</p>
<p>An empty <propref ref="e-final"/> creates an equivalence
class admitting other element declarations having the same <propref ref="type_definition"/> or
types derived therefrom.  The explicit
values of <propref ref="e-final"/> exclude from the equivalence class elements having types which
are <pt>extension</pt>s, <pt>list</pt>s, <pt>restriction</pt>s or <pt>reproduction</pt>s respectively of <propref ref="type_definition"/>.  If all values are specified, then no equivalence class is possible based on this element declaration.</p>

<p>The supplied values for <propref ref="e-exact"/> determine
whether an element declaration appearing in a <termref def="key-contentModel">content model</termref> will be prevented from additionally
validating elements (a) with an <specref ref="xsi:type"/> that identifies an
<pt>extension</pt>, <pt>list</pt>, <pt>restriction</pt> and/or <pt>reproduction</pt> of the type of the declared element, and/or (b) from validating elements which are in the same
equivalence class (<pt>equivClass</pt>) as the declared element.
If <propref ref="e-exact"/> is empty, then all derived types and equivalence class members are valid.</p>
<p>Element declarations for which <propref ref="e-abstract"/> is <pt>true</pt> can appear in
content models only when equivalence class substitution is allowed;
such declarations may not themselves ever be used to validate element content.</p>
<p>See <specref ref="declare-element"/> for the XML representation of
element declarations and <specref ref="coss-element"/> for constraints on element
declaration components as such.</p>
    <constraintnote type="cvc" id="cvc-elt">
     <head>Element Valid (Explicit)</head>
     <p>An element information item is schema-valid with respect to an
element declaration if
      <olist>
       <item>
        <p>If <propref ref="nullable"/> is false there is no attribute information item among the element
information item's &i-attributes; whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref> is identical to <code>&XMLSchemaInstanceNS;</code> and whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> is <code>null</code>;</p>
       </item>
       <item>
        <p>If <propref ref="nullable"/> is true and there is such an attribute
information item and its &i-value; is <code>true</code>, then
         <olist>
          <item>
           <p>the element information item must have no character or element information item
&i-children;;</p>
          </item>
          <item>
           <p>there is no <pt>fixed</pt> <propref ref="e-value_constraint"/>.</p>
          </item>
         </olist>
        </p>
       </item>
      </olist>
     </p>
     <p>If there is an attribute information item among the element
information item's &i-attributes; whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref> is identical to <code>&XMLSchemaInstanceNS;</code> and whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> is <code>type</code>, then
      <olist>
       <item>
        <p>The &i-value; of that attribute information item is
schema-valid with respect to the built-in <xtermref href="&XSP2.URI;#QName">QName</xtermref> simple type, as defined by <specref ref="cvc-simple-type"/>;</p>
       </item>
       <item>
        <p>The <termref def="q-local">local name</termref> and <termref def="q-uri">namespace URI</termref> (as defined in <specref ref="src-qname"/>), of the &i-value; of that attribute information item resolve to a type definition, as defined in <specref ref="src-resolve"/> -- <termdef id="key-ltd" term="item type definition">call this type definition the <term>item type definition</term></termdef>;</p></item>
       <item>
        <p>The <termref def="key-ltd">item type definition</termref> is
validly derived from the <propref ref="type_definition"/> given the <propref ref="e-exact"/> as defined in <specref ref="cos-st-derived-ok"/> (if it is a simple type definition) or as defined in <specref ref="cos-ct-derived-ok"/> (if it is a complex type definition).</p>
       </item>
      </olist>
      <termdef id="key-atd" term="actual type definition">We refer below to the
<term>actual type definition</term>.  If the above three clauses obtain, this
should be understood as referring to the <termref def="key-ltd">local type
definition</termref>, otherwise to the <propref ref="type_definition"/>.</termdef>
     </p>
     <p>If the declaration has a <propref ref="e-value_constraint"/>, then
provided clause 1.2 has not obtained
      <olist>
       <item>
        <p>If the element information item has no character information item
&i-children; and the <termref def="key-atd">actual type definition</termref> is a <termref def="key-ltd">local type
definition</termref>, the <propref ref="e-value_constraint"/> string is schema-valid with respect to the <termref def="key-atd">actual
type definition</termref> as defined by <specref ref="cvc-simple-type"/> (if
the <termref def="key-atd">actual
type definition</termref> is a simple type definition) or else (the <termref def="key-atd">actual
type definition</termref> is a complex type definition) the string must
be a valid default for the <termref def="key-atd">actual
type definition</termref> as defined in <specref ref="cos-valid-default"/>;</p>
       </item>
       <item>
        <p>If the <propref ref="e-value_constraint"/> is
<pt>fixed</pt>, the element information item must have no element information
item &i-children;, and the string composed of the element information item's character information item
&i-children;
in order must be either empty or match the string of the <propref ref="e-value_constraint"/>;</p>
       </item>
      </olist>
     </p>
     <p>Otherwise (the element information item has character information item
&i-children; or there is no <propref ref="e-value_constraint"/>) if the <termref def="key-atd">actual type definition</termref> is a simple type
definition, then
      <olist>
       <item><p>The element information item's &i-attributes; must be empty,
excepting those whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref> is identical to <code>&XMLSchemaInstanceNS;</code> and whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> is one of <code>type</code>, <code>nullable</code> or <code>schemaLocation</code>;</p></item>
       <item>
        <p>The element information item must have no element information item &i-children;;</p>
       </item>
       <item>
        <p>the string composed of the &i-ccode; of each of the element information item's character information item
&i-children;
in order must be schema-valid with respect to the
<termref def="key-atd">actual type definition</termref> as defined by <specref ref="cvc-simple-type"/>
        </p>
       </item>

      </olist>
otherwise (the <termref def="key-atd">actual type definition</termref> is a complex type
definition)
      <olist>
       <item>
        <p>The element information item must be schema-valid with respect to the <termref def="key-atd">actual type definition</termref> as per <specref ref="cvc-complex-type"/>;</p>
       </item>
       <item>
        <p>The element information item must be schema-valid with respect to
each of the <propref ref="&constraint;_definitions"/> as per <specref ref="cvc-&constraint;"/>.</p>
       </item>
      </olist>
</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 in Chapter 6, if so, this needs
to be spelled out.</p>
 </issue>
<ednote><edtext>The above also allows null elements to have
attributes, i.e. it's their CONTENT which is null.  Was that the
designers' intention?  See related ednote under xsi:null in chapter 2.</edtext></ednote>

    </constraintnote>
    <note><p>The <propref ref="e-name"/> and <propref ref="e-target_namespace"/> properties are not
mentioned above because they are checked during particle validation, as per
<specref ref="cvc-particle"/>.</p></note>
    <constraintnote type="sic" id="sic-eltDefault">
     <head>Element Default Value</head>
     <p>If the <propref ref="e-value_constraint"/> is present and the element
information item has no character or element information item &i-children;, the post-schema
validation infoset has a list of character information items, one per character
in the <propref ref="e-value_constraint"/> string, appended to its &i-children;.</p>
    </constraintnote>
    <ednote>
     <edtext>Should we add a property to indicate THAT the value was supplied by default?</edtext>
    </ednote>
    <constraintnote type="sic" id="sic-eltType">
     <head>Element Type</head>
     <p>In the post-schema
validation infoset a <xpropref>schema type</xpropref> property is added to the element information item with the <termref def="key-atd">actual type definition</termref> as its value.</p>
    </constraintnote>
    <constraintnote type="sic" id="sic-eltNull">
     <head>Element Null</head>
     <p>If clause 1.2 of <specref ref="cvc-elt"/> above obtains, in the post-schema
validation infoset a <xpropref>null</xpropref> property is added to the element
information item with the value true.</p>
    </constraintnote>
   </div2>
   <div2 id="Complex_Type_Definition_details">
    <head>Complex Type Definition Details</head>
<p>Complex Type Definitions provide for:</p>
<ulist>
     <item><p>Constraining element information items by providing <specref ref="Attribute_Declaration"/>s governing the appearance and content of
&i-attributes;</p></item>
     <item><p>Constraining element information item &i-children; to be empty, or to conform to a specified element-only or mixed content model.</p></item>
     <item><p>Using the mechanisms of <specref ref="Type_Derivation"/> to derive a complex type from another simple or complex type.</p></item>
     <item>
<p>Specifying contributions to the post-schema-validation information set for elements. </p>
</item>
     <item><p>Limiting the ability to derive additional types from a given complex type.</p></item>
     <item><p>Controlling the permission to substitute, in an instance, elements of a derived
type for elements declared in a content model to be of a given complex type.</p></item>
<item><p>Determining <termref def="gloss-sic">post-schema-validation
information set contributions</termref>.</p></item>
</ulist>

<p>A complex type definition schema component has the following
properties:</p>

  <compdef name="Complex Type Definition" ref="Complex_Type_Definition">
   <proplist>
  <propdef id="ct-name" name="name">
    Optional.  An NCName as defined by <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="ct-target_namespace" name="target namespace">
    Either <termref def="key-null">null</termref> or a namespace URI, as defined in <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="ct-base_type_definition" name="base type definition">
    Either a simple type definition or a complex type definition.
   </propdef>
  <propdef id="derivation_method" name="derivation method">
    One of <pt>extension</pt>, <pt>restriction</pt>, <pt>reproduction</pt>
   </propdef>
   <propdef id="ct-final" name="final">
    A subset of {<pt>extension</pt>, <pt>restriction</pt>, <pt>reproduction</pt>}.
   </propdef>
   <propdef id="ct-abstract" name="abstract">
    A boolean
   </propdef>   <propdef id="ct-attribute_declarations" name="attribute declarations">
    A set of attribute declarations.
   </propdef>
  <propdef id="ct-attribute_wildcard" name="attribute wildcard">
    Optional.  One of <pt>any</pt>; a pair of <pt>not</pt> and a namespace URI
or <termref def="key-null">null</termref>; or a set whose
members are either namespace URIs or <termref def="key-null">null</termref>.
   </propdef>
   <propdef id="content_type" name="content type">One of <pt>empty</pt>, a simple type definition or a pair
consisting of a <termref def="key-contentModel">content model</termref> (I.e a <specref ref="Particle"/>) and one of <pt>mixed</pt>, <pt>element-only</pt>.
   </propdef>
  <propdef id="ct-exact" name="prohibited-substitutions">
    A subset of {<pt>extension</pt>, <pt>restriction</pt>, <pt>reproduction</pt>}.
   </propdef>
    <propdef id="ct-annotation" name="annotation">Optional.  An annotation</propdef>
</proplist>

  </compdef>
<p>Complex types are identified by their <propref ref="ct-name"/> and <propref ref="ct-target_namespace"/>.  Except
for anonymous complex types (those with no <propref ref="ct-name"/>), complex
type definitions must be uniquely identified within an <termref def="key-schema">XML
Schema</termref>.  Complex type <propref ref="ct-name"/>s and <propref ref="ct-target_namespace"/>s
are provided for reference from
instances (see <specref ref="xsi:type"/>), and for use in the <specref ref="declare"/>
(specifically in <eltref ref="element"/> and <eltref ref="attribute"/>).  See <specref ref="composition-schemaImport"/> for the use of component
identifiers when importing one schema into another.</p>
<note>
<p>The <propref ref="ct-name"/> of a complex type is not <emph>ipso
facto</emph> the <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">(local) name</xpropref> of the
  element information items validated by that definition. The connection between a
  name and a type definition is described in <specref ref="Element_Declaration_details"/>. </p>
</note>
   <p>As described in <specref ref="Type_Derivation"/>, each complex type is derived from a
<propref ref="ct-base_type_definition"/> which is itself either a <specref ref="Simple_Type_Definition"/> or a <specref ref="Complex_Type_Definition"/>.  <propref ref="derivation_method"/> specifies the means of derivation as either <pt>extension</pt> or <pt>restriction</pt> (see <specref ref="Type_Derivation"/>).</p>

<p>A complex type with an empty specification for <propref ref="ct-final"/> can be used as a
<propref ref="ct-base_type_definition"/> for other types derived by any of
extension, restriction or reproduction; the explicit values <pt>extension</pt>,
<pt>restriction</pt> and <pt>reproduction</pt> prevent further
derivations by extension, restriction and reproduction respectively.  If all values are specified, then the complex type is said to be
<termdef id="key-ct-final" term="final"><term>final</term>: no
further derivations are possible. </termdef></p>

<p>A complex type for which <propref ref="ct-abstract"/> is <pt>true</pt> must not appear as the
<propref ref="type_definition"/> of an <specref ref="Element_Declaration"/>, and must not be referenced from an
<specref ref="xsi:type"/> attribute in an instance document;  such abstract complex types can be
used as <propref ref="ct-base_type_definition"/>s, but they are never used directly to validate
element content.</p>

<p><propref ref="ct-attribute_declarations"/> are a set of individual <specref ref="Attribute_Declaration"/>s
to be used for schema-validating the
&i-attributes;
of element information items.  See <specref ref="cvc-complex-type"/>
and <specref ref="cvc-attribute"/> for details of attribute validation.</p>
<p><propref ref="ct-attribute_wildcard"/>s provide a more flexible specification for validation of
attributes not explicitly included in <propref ref="ct-attribute_declarations"/>.
Informally, the specific values
of <propref ref="ct-attribute_wildcard"/> are interpreted as follows:
<ulist><item>
<p><pt>any</pt>: &i-attributes; can include attributes with any qualified or unqualified name.</p>
</item>
<item>
<p>a set whose
members are either namespace URIs or <termref def="key-null">null</termref>: &i-attributes; can
include any attribute(s) from the specified namespace(s).  If <termref def="key-null">null</termref> is included in the set, then any unqualified attributes are (also) allowed.</p>
</item>
<item>
<p><pt>'not'</pt> and a namespace URI: &i-attributes; cannot include attributes from the specified namespace.</p>
</item>
<item>
<p><pt>'not'</pt> and <termref def="key-null">null</termref>: &i-attributes; cannot include
unqualified attributes.</p>
</item></ulist>
See <specref ref="cvc-complex-type"/> and <specref ref="cvc-wildcard-namespace"/> for formal
details of attribute wildcard validation. </p>
<p><propref ref="content_type"/> determines the schema-validation of &i-children; of element information items.  Informally:
<ulist>
<item>
<p>A <propref ref="content_type"/> with the distinguished value <pt>empty</pt> validates elements
with no character or element information item &i-children;.</p>
</item>
<item>
<p>A <propref ref="content_type"/> which is a <specref ref="Simple_Type_Definition"/> validates
elements with character-only &i-children;.</p>
</item>
<item>
<p>An <pt>element-only</pt> <propref ref="content_type"/> validates elements with &i-children; that
conform to the supplied <termref def="key-contentModel">content model</termref>.</p>
</item>
<item>
<p>A <pt>mixed</pt> <propref ref="content_type"/> validates elements whose element information-
children (I.e. specifically ignoring other &i-children; such as character information items)
conform to the supplied <termref def="key-contentModel">content model</termref>.</p>
</item></ulist>
</p>
<p><propref ref="ct-exact"/> determine
whether an element declaration appearing in a <termref def="key-contentModel">
content model</termref> is prevented from additionally
validating elements with an <specref ref="xsi:type"/> attribute that
identifies an <pt>extension</pt>, <pt>restriction</pt> or <pt>reproduction</pt> of the type of the declared element.
If <propref ref="ct-exact"/> is empty,
then all such substitutions are valid.
</p>
<p>See <specref ref="cvc-complex-type"/>
for a formal specification of element content validation.</p>
<p>See <specref ref="declare-type"/> for the XML representation of
complex type definitions and <specref ref="coss-ct"/> for constraints on
complex type definition components as such.</p>
    <constraintnote type="cvc" id="cvc-complex-type">
     <head>Element Children and Attributes Valid</head>
     <p>An element information item is schema valid with respect to a complex type definition if:
      <olist>
       <item>
        <p><propref ref="ct-abstract"/> is false;</p>
       </item>
       <item>
        <olist>
         <item>
        <p>If the <propref ref="content_type"/> is <pt>empty</pt>, the element
information item has no character or element information item &i-children;;</p>
       </item>
       <item>
        <p>If the <propref ref="content_type"/> is  a simple
type definition, the element information item has no element
information item &i-children;, and the string composed of the &i-ccode; of each of the element information item's character information item
&i-children;
in order is schema-valid with respect to that simple type definition as defined by <specref ref="cvc-simple-type"/>;</p>
       </item>
       <item>
        <p>If the <propref ref="content_type"/> is <pt>element-only</pt>, the
element information item has no character information item &i-children; other
than those whose &i-ccode; is defined as a <xtermref href="http://www.w3.org/TR/REC-xml#NT-S">white space</xtermref>
in <bibref ref="ref-xml"/>;</p>
       </item>
       <item>
        <p>If the <propref ref="content_type"/> is <pt>element-only</pt> or
<pt>mixed</pt>, the sequence of the element information item's element
information item &i-children;, if any, taken in order, is schema-valid with
respect to the <propref ref="content_type"/>'s particle, as defined in <specref ref="cvc-particle"/></p>
       </item>
        </olist>
       </item>
       <item>
        <p>For each attribute information item in the element information
item's &i-attrChildren; excepting those whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref> is identical to <code>&XMLSchemaInstanceNS;</code> and whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> is one of <code>type</code>, <code>nullable</code> or <code>schemaLocation</code>, if
there is among the <propref ref="ct-attribute_declarations"/> one whose
<propref ref="a-name"/> matches the attribute information item's <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> and whose <propref ref="a-target_namespace"/> is identical to the attribute information item's <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref>
         <olist>
          <item>
           <p>the attribute information item is schema-valid with respect to that attribute declaration as defined in <specref ref="cvc-attribute"/>;</p>
          </item>
         </olist>
         otherwise (there is no matching attribute declaration)
         <olist>
          <item>
           <p>there is an <propref ref="ct-attribute_wildcard"/> and the
attribute information item's <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref> is schema-valid with respect to it as defined in <specref ref="cvc-wildcard-namespace"/>;</p>
<ednote>
<edtext> If there is an unlisted declaration, presumably for a qualified attribute, this implies
that type validity is not checked.  Is this right?</edtext>
</ednote>
          </item>
         </olist>
        </p>
       </item>
       <item>
        <p>Each attribute declaration in the <propref ref="ct-attribute_declarations"/> with a <propref ref="a-min_occurs"/> of <code>1</code> matches one of the attribute information items in the element information item's &i-attrChildren; as per clause 3 above.</p>
       </item>
      </olist>
     </p>
    </constraintnote>
    <constraintnote type="sic" id="sic-attrDefault">
     <head>Attribute Default Value</head>
     <p>For each attribute declaration in the <propref ref="ct-attribute_declarations"/> with a <propref ref="a-min_occurs"/> of <code>0</code> which has a <propref ref="a-value_constraint"/> and does not match one of the attribute information items in the element information item's &i-attrChildren; as per clause 3 of <specref ref="cvc-complex-type"/> above, the post-schema
validation infoset has an attribute information item whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> is that attribute declaration's <propref ref="a-name"/>
whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref> is the attribute declaration's <propref ref="a-target_namespace"/> and whose &i-attrChildren; are a list of character information items, one per character
in the declaration's <propref ref="a-value_constraint"/> string, added to the
&i-attributes; of the element information item .</p>
    </constraintnote>

<p>There is a complex type definition version of the <termref def="key-urType">ur-type definition</termref> present in every
schema by definition.  It has the following properties:</p>
    <table border="1" style="margin-left: 2em; margin-right: 2em">
     <thead>
      <tr>
       <th align="left"><B>Complex Type Definition of the Ur-Type</B></th>
      </tr>
     </thead>
     <tbody>
<tr>
<td><table border="0"><thead>
      <tr>
       <th align="left">Property</th>
       <th align="left">Value</th>
      </tr>
     </thead>
     <tbody valign="top">
      <tr>
       <td><propref ref="ct-name"/></td>
       <td>
        Not specified.
       </td>
      </tr>
      <tr>
       <td><propref ref="ct-target_namespace"/></td>
       <td>
<termref def="key-null">null</termref>.
       </td>
      </tr>
      <tr>
       <td><propref ref="ct-base_type_definition"/></td>
       <td>
       Itself.
       </td>
      </tr>
     <tr>
       <td><propref ref="derivation_method"/></td>
       <td>
        <pt>reproduction</pt>
       </td>
      </tr>
      <tr valign="top">
       <td><propref ref="content_type"/></td>
       <td>
        A pair
consisting of <pt>mixed</pt> and a particle with the following properties: <table>
          <tbody valign="top">
          <tr>
           <td><propref ref="term"/></td>
           <td>a <termref def="Wildcard_details">wildcard</termref> with an
<pt>any</pt> <propref ref="namespace_constraint"/>
           </td>
          </tr>
          <tr valign="top">
           <td><propref ref="p-min_occurs"/></td>
           <td>0</td>
          </tr>
           <tr valign="top">
           <td><propref ref="p-max_occurs"/></td>
           <td>*</td>
          </tr>
         </tbody>
         </table>
       </td>
      </tr>
      <tr>
       <td><propref ref="ct-attribute_declarations"/></td>
       <td>
        The empty set.
       </td>
      </tr>
      <tr>
       <td><propref ref="ct-attribute_wildcard"/></td>
       <td>
        <propref ref="namespace_constraint"/> is <pt>any</pt>
       </td>
      </tr>
      <tr>
       <td><propref ref="ct-final"/></td>
       <td>The empty set.
       </td>
      </tr>
      <tr>
       <td><propref ref="ct-exact"/></td>
       <td>
        The empty set.
       </td>
      </tr>
      <tr>
       <td><propref ref="ct-abstract"/></td>
       <td>
        False.
       </td>
      </tr>
     </tbody></table></td>
</tr>
</tbody>
     </table>
    <ednote>
     <edtext>This should be handled with a generic tableau markup</edtext>
    </ednote>
    <p>The <code>mixed</code> content specification together with the
unconstrained wildcard content model and attribute specification produce the defining property for the
complex ur-type definition, namely that <emph>every</emph> complex type definition is
either an extension of a simple type definition or (eventually) a restriction
of the complex ur-type definition: its permissions and requirements are
the least restrictive possible.</p>

   </div2>
   <div2 id="Attribute_Group_Definition_details">
    <head>Attribute Group Definition Details</head>
<p>A schema can name a group of attribute declarations so that they may be incorporated as a
group into complex type definitions.</p>
<p>
Attribute group definitions do not participate in schema-validation as such, but the
<propref ref="ct-attribute_declarations"/> and <propref ref="ct-attribute_wildcard"/> of one or
more complex type definitions may be constructed in whole or part by reference to an attribute group.
Attribute group definitions are provided primarily for reference from the <specref ref="declare"/>
(see <eltref ref="complexType"/> and <eltref ref="attributeGroup"/>).
Thus, attribute group definitions provide a
replacement for some uses of XML's
<termref def="gloss-parameterEntity">parameter entities</termref>.</p>
    <p>The attribute group definition schema component has the
following properties:</p>

  <compdef name="Attribute Group Definition" ref="Attribute_Group_Definition">
   <proplist>
  <propdef id="ag-name" name="name">
    An NCName as defined by <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="ag-target_namespace" name="target namespace">
    Either <termref def="key-null">null</termref> or a namespace URI, as defined in <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="ag-attribute_declarations" name="attribute declarations">
    A set of attribute declarations.
   </propdef>
  <propdef id="ag-attribute_wildcard" name="attribute wildcard">
    Optional.  One of <pt>any</pt>; a pair of <pt>not</pt> and a namespace URI
or <termref def="key-null">null</termref>; or a set whose
members are either namespace URIs or <termref def="key-null">null</termref>.
   </propdef>
    <propdef id="ag-annotation" name="annotation">Optional.  An annotation</propdef>
</proplist>

  </compdef>

  <p>Attribute groups are identified by their <propref ref="ag-name"/> and <propref ref="ag-target_namespace"/>; attribute group identities must be unique within an <termref def="key-schema">XML Schema</termref>.  See <specref ref="composition-schemaImport"/> for the use of component
identifiers when importing one schema into another.</p>
<p><propref ref="ag-attribute_declarations"/> is a set of attribute declarations specifically identified as
members of the attribute group.</p>
<p><propref ref="ag-attribute_wildcard"/> provides for an attribute wildcard to be included in an
attribute group.
See above under <specref ref="Complex_Type_Definition_details"/> for the
interpretation of
attribute wildcards during validation.</p>
<p>See <specref ref="cvc-complex-type"/> and <specref ref="cvc-wildcard-namespace"/> for formal
details of attribute wildcard validation.
See <specref ref="declare-attributeGroup"/> for the XML representation of
attribute group definitions, and <specref ref="coss-attrGroup"/> for constraints on
attribute group definition components as such.</p>
   </div2>
   <div2 id="Model_Group_Definition_details">
    <head>Model Group Definition Details</head>
<p>A model group definition associates a name and optional annotations with a <specref ref="Model_Group"/>.
By reference to the name, the entire model group can be incorporated by reference into a <propref ref="term"/>.</p>
<p>
Model group definitions are provided
primarily for reference from the <specref ref="declare-type"/> (see <eltref ref="complexType"/>
and <eltref ref="group"/>).  Thus, model group definitions provide a
replacement for some uses of XML's
<termref def="gloss-parameterEntity">parameter entities</termref>.
</p>    <p>The model group definition schema component has the following
properties:</p>

  <compdef name="Model Group Definition" ref="Model_Group_Definition">

   <proplist>
  <propdef id="mg-name" name="name">
    An NCName as defined by <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="mg-target_namespace" name="target namespace">
    Either <termref def="key-null">null</termref> or a namespace URI, as defined in <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="model_group" name="model group">
    A model group.
   </propdef>
    <propdef id="mg-annotation" name="annotation">Optional.  An annotation</propdef>
</proplist>
  </compdef>
<p>Model group definitions are identified by their <propref ref="mg-name"/> and <propref ref="mg-target_namespace"/>; model group identities must be unique within an <termref def="key-schema">XML Schema</termref>.  See <specref ref="composition-schemaImport"/> for the use of component
identifiers when importing one schema into another.</p>
<p>Model group definitions per se do not participate in schema-validation, but the <propref ref="term"/> of
a particle may correspond in whole or in part
to a model group from a model group definition.</p>
<p><propref ref="model_group"/> is the <specref ref="Model_Group"/> for which the model group definition provides a name.</p>

     <p>See <specref ref="declare-namedModelGroup"/> for the XML representation of
model group definitions and <specref ref="coss-groupDef"/> for constraints on model group definition components as such.</p>

   </div2>
   <div2 id="Model_Group_details">
    <head>Model Group Details</head>
    <p>
When the &i-children; of element information items are not constrained
to be <pt>empty</pt> or by reference to a simple type definition
(<specref ref="Simple_Type_Definition_details"/>), the sequence of element
information item &i-children; content may be specified in
more detail with a model group.  Because the <propref ref="term"/> property of a particle can be a
model group, and model groups contain particles, model groups can indirectly contain other model groups; the grammar for content models
is therefore recursive.</p>

    <p>The model group schema component has the following
properties:</p>

  <compdef name="Model Group" ref="Model_Group">
   <proplist>
  <propdef id="compositor" name="compositor">
    One of <pt>all</pt>, <pt>choice</pt> or <pt>sequence</pt>.
   </propdef>
  <propdef id="particles" name="particles">
    A list of particles
   </propdef>
    <propdef id="amg-annotation" name="annotation">Optional.  An annotation</propdef>
</proplist>
  </compdef>
<p><propref ref="compositor"/>determines whether the element
information item &i-children; validated by the model group must:
<ulist>
<item><p>(<pt>sequence</pt>) correspond, in order, to the specified <propref ref="particles"/>;</p>
</item>
<item><p>(<pt>choice</pt>) corresponded to exactly one of the specified <propref ref="particles"/>;</p>
</item>
<item><p>(<pt>all</pt>, (in which case <propref ref="particles"/> is restricted to contain local and global element
declarations, with minOccurs=maxOccurs=1) contain exactly one of each element specified in <propref ref="particles"/>.  The elements can occur in any order.</p>
</item>
</ulist></p>
<p><propref ref="amg-annotation"/>Description to be supplied in a future draft.</p>
<constraintnote type="cvc" id="cvc-model-group">
 <head>Element Sequence Valid</head>
 <p><termdef id="key-partition" term="partition">We define a
<term>partition</term> of a sequence as a sequence of sub-sequences, some or
all of which may be empty, such that concatenating all the sub-sequences yields
the original sequence.</termdef></p>
 <p>A sequence (possibly empty) of element information items is schema-valid with respect to
a model group if
  <olist>
   <item>
    <p>The <propref ref="compositor"/> is <pt>sequence</pt> and there is a
<termref def="key-partition">partition</termref> of the sequence into <code>n</code> sub-sequences where <code>n</code> is the length of <propref ref="particles"/> such that each of the sub-sequences in order is schema-valid
with respect to the corresponding particle in the <propref ref="particles"/> as defined in <specref ref="cvc-particle"/>;</p>
   </item>
  </olist>
  or
  <olist>
   <item>
    <p>The <propref ref="compositor"/> is <pt>choice</pt> and there is a
particle among the <propref ref="particles"/> such that the sequence is
schema-valid with respect to that particle as defined in <specref ref="cvc-particle"/>;</p>
   </item>
  </olist>
  or
  <olist>
   <item>
    <p>The <propref ref="compositor"/> is <pt>all</pt> and there is a
<termref def="key-partition">partition</termref> of the sequence into <code>n</code> sub-sequences where <code>n</code> is the length of <propref ref="particles"/> such that there is a one-to-one mapping between the sub-sequences and the <propref ref="particles"/> where each sub-sequence is schema-valid with respect to the corresponding particle as defined in <specref ref="cvc-particle"/>;</p>
   </item>
  </olist>
 </p>
 <p>Nothing in the above should be understood as ruling out groups whose
<propref ref="particles"/> is empty:  although no sequence can be schema-valid
with respect to such a group whose <propref ref="compositor"/> is
<pt>choice</pt>, the empty sequence <emph>is</emph> schema valid with respect
to empty groups whose <propref ref="compositor"/> is <pt>sequence</pt> or <pt>all</pt>.</p>
</constraintnote>
    <note>
     <p>The above definition is implicitly non-deterministic, and should not be
taken as a recip&eacute; for implementations.  Note in particular that when  <propref ref="compositor"/> is <pt>all</pt>, particles is restricted to a list of local and global element declarations (see <specref ref="coss-modelGroup"/>).   A much simpler implementation is possible for than would arise from a literal interpretation of the definition above; informally, the content is valid when each declared element occurs exactly once, and each is valid with respect to its corresponding declaration.  The elements can occur in arbitrary order.</p>
    </note>
    <ednote>
         <edtext>The above depends on chapter 6 to rule out 'all' except
directly within content type.</edtext>
        </ednote>
<p>See <specref ref="declare-contentModel"/> for the XML representation of
model groups and <specref ref="coss-modelGroup"/> for constraints
on model group components as such.</p>

   </div2>
   <div2 id="Particle_details">
    <head>Particle Details</head>

    <p>As described in <specref ref="Model_Group_details"/>, particles contribute to the definition
of content models.  The particle schema component has the following properties:</p>

  <compdef name="Particle" ref="Particle">
   <proplist>
    <propdef id="p-min_occurs" name="min occurs">A non-negative
integer</propdef>
    <propdef id="p-max_occurs" name="max occurs">Either a non-negative integer
or <pt>*</pt></propdef>
    <propdef id="term" name="term">One of a model group, a wildcard, a local
element declaration or global element declaration together with the following
additional properties:
     <proplist>
      <propdef id="p-value_constraint" name="value constraint">Optional.  A
pair consisting of a string and one of <pt>default</pt>, <pt>fixed</pt>.</propdef>
      <propdef id="p-nullable" name="nullable">A boolean</propdef>
      <propdef id="p-exact" name="disallowed substitutions">A subset of
{<pt>extension</pt>, <pt>restriction</pt>, <pt>equivClass</pt>}.</propdef>
      <propdef id="p-abstract" name="abstract">A boolean</propdef>
      <propdef id="p-annotation" name="annotation">Optional.  An annotation</propdef>
     </proplist>
    </propdef>
   </proplist>

  </compdef>
<p>The following is an informal overview of the properties of a particle.  Formal interpretation of
these properties is found in  <specref ref="cvc-particle"/>.</p>
<p>In general, multiple element
information item &i-children;, possibly with intervening character &i-children; if the content type
is <pt>mixed</pt>, can be validated with respect to a single particle. <propref ref="p-min_occurs"/> determines the minimum number of such element &i-children; that can validly occur.  The number of such children must be greater than or equal to <propref ref="p-min_occurs"/>.  If <propref ref="p-min_occurs"/> is <pt>0</pt>, then occurrence of such children is optional.   </p>
<p>The number of such element &i-children; must be less than or equal to any numeric specification of
<propref ref="p-max_occurs"/>; if <propref ref="p-max_occurs"/> is <pt>*</pt>, then there is no
upper bound on the number of such children.</p>
<p><propref ref="p-nullable"/>, <propref ref="p-exact"/> and <propref ref="p-value_constraint"/>, if
specified, merge with the corresponding properties of the supplied element declaration.</p>
<constraintnote type="cvc" id="cvc-particle">
 <head>Element Sequence Valid (Particle)</head>
 <p>A sequence (possibly empty) of element information items is schema-valid
with respect to a particle if
  <olist>
   <item>
    <p>The length of the sequence is greater than or equal to the <propref ref="p-min_occurs"/>;</p>
   </item>
   <item>
    <p>The length of the sequence is less than or equal to the <propref ref="p-max_occurs"/>;</p>
   </item>
   <item>
    <p>Either
    <olist>
     <item>
      <p>the <propref ref="term"/> is a model group and there is a <termref def="key-partition">partition</termref> of the sequence into sub-sequences such that each sub-sequence is schema-valid with respect to that model group as defined in <specref ref="cvc-model-group"/>;</p>
     </item>
    </olist>
    or
    <olist>
     <item>
      <p>the <propref ref="term"/> is a wildcard and the <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">namespace URI</xpropref> of each element
information item in the sequence is schema-valid with respect to the <propref ref="namespace_constraint"/> of the wildcard.</p>
     </item>
    </olist>
     or
    <olist>
     <item>
      <p>the <propref ref="term"/> is an element declaration;</p>
     </item>
      <item>
       <p>for each element
information item in the sequence either
        <olist>
         <item>
          <p>the element declaration is local (i.e. its
<propref ref="scope"/> is not <pt>global</pt>), its <propref ref="e-abstract"/> is false, the element information
item's <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">namespace URI</xpropref> is identical to the element declaration's <propref ref="e-target_namespace"/>, the element information
item's <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">local
name</xpropref> matches the element declaration's <propref ref="e-name"/> and the element information item is schema-valid with respect to the
declaration as defined in <specref ref="cvc-elt"/>;</p>
         </item>
        </olist>
        or
        <olist>
         <item>
          <p>the element declaration is global (i.e. its
<propref ref="scope"/> is <pt>global</pt>), the particle's <propref ref="p-abstract"/> is false, the element declaration's <propref ref="e-abstract"/> is false, the element information
item's <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">namespace URI</xpropref> is identical to the element declaration's <propref ref="e-target_namespace"/>, the element information
item's <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">local
name</xpropref> matches the element declaration's <propref ref="e-name"/> and the element information item is schema-valid with respect to the
element declaration as defined in <specref ref="cvc-elt"/>, with the values of
the particle's <propref ref="p-value_constraint"/>, <propref ref="p-nullable"/>
and <propref ref="p-exact"/> being merged with the corresponding
properties of the element declaration;</p>
         </item>
        </olist>
        or
        <olist>
         <item>
          <p>the element declaration is global (i.e. its
<propref ref="scope"/> is <pt>global</pt>), the particle's <propref ref="p-exact"/> does not contain <pt>equivClass</pt>, the element declaration's <propref ref="e-exact"/> does not contain <pt>equivClass</pt>,
the <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">local
name</xpropref> and <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">namespace URI</xpropref> of the element information item resolve to an element definition, as
defined in <specref ref="src-resolve"/> -- <termdef id="key-eqd" term="equivalent declaration">call this declaration the <term>equivalent declaration</term></termdef>, the <termref def="key-eqd">equivalent declaration</termref> together with the particle's <propref ref="p-exact"/> is validly equivalent to the particle's element declaration as defined in <specref ref="cos-equiv-derived-ok-rec"/> and the element information item is schema-valid with respect to the
<termref def="key-eqd">equivalent declaration</termref> as defined in <specref ref="cvc-elt"/>, with the values of
the particle's <propref ref="p-value_constraint"/>, <propref ref="p-nullable"/>
and <propref ref="p-exact"/> being merged with the corresponding
properties of the <termref def="key-eqd">equivalent declaration</termref>.</p>
         </item>
        </olist>
       </p>
      </item>
    </olist>
    </p>
   </item>
  </olist>
 </p>
</constraintnote>
      <p>
See <specref ref="declare-contentModel"/> for the XML representation of
particles and <specref ref="coss-particle"/> for constraints
on particle components as such.</p>

   </div2>
   <div2 id="Wildcard_details">
    <head>Wildcard Details</head>
    <p>A wildcard provides for validation of element information items dependent on their namespace
URI, but independently
of their local name.  The wildcard schema component has the following properties:</p>
     <compdef name="Wildcard" ref="Wildcard">
   <proplist>
  <propdef id="namespace_constraint" name="namespace constraint">
    One of <pt>any</pt>; a pair of <pt>not</pt> and a namespace URI
or <termref def="key-null">null</termref>; or a set whose
members are either namespace URIs or <termref def="key-null">null</termref>.
   </propdef>
    <propdef id="w-annotation" name="annotation">Optional.  An annotation</propdef>
</proplist>
 </compdef>
    <ednote>
     <edtext>missing the processContents property, and a descriptions of the
processing options for material allowed by an any, i.e. strict (must validate,
find the defs and decls you need or invalid; lax, i.e. validate when you can
find the defs and decls, OK if you can't; skip, i.e. don't try, call it valid
no matter what.</edtext>
    </ednote>
<p><propref ref="namespace_constraint"/> provides for validation of elements that:
<ulist>
<item>
<p>(<pt>any</pt>) have any namespace or are not namespace qualified;</p>
</item>
<item>
<p>(<pt>not</pt> and a namespace URI) have any namespace other than the specified namespace URI, or
are not namespace qualified;</p>
</item>
<item>
<p>(<pt>not</pt> and <termref def="key-null">null</termref>) are namespace qualified;</p>
</item>
<item>
<p>(a set whose
members are either namespace URIs or <termref def="key-null">null</termref>) have any of the
specified namespaces and/or, if <termref def="key-null">null</termref> is included in the set, are unqualified.</p>
</item>
</ulist></p>
    <constraintnote type="cvc" id="cvc-wildcard">
     <head>Element Valid (Wildcard)</head>
     <p><termdef id="cd-allowed-ns" term="allowed namespace">watch this space</termdef></p>
    </constraintnote>
    <constraintnote type="cvc" id="cvc-wildcard-namespace">
     <head>Wildcard allows Namespace URI</head>
     <p>A value which is either a namespace URI or <termref def="key-null">null</termref> is schema valid with respect to a wildcard constraint (the
value of a <propref ref="namespace_constraint"/> or a
<propref ref="ct-attribute_wildcard"/>) if
      <olist>
       <item>
        <p>the constraint is <pt>any</pt>;</p>
       </item>
      </olist>
      or
      <olist>
       <item>
        <p>the constraint is a pair of <pt>not</pt> and a namespace URI, and
the value is not identical to the namespace URI;</p>
       </item>
      </olist>
      or
      <olist>
       <item>
        <p>the constraint is a set, and the value is identical to one of the members of the set.</p>
       </item>
      </olist>
     </p>
    </constraintnote>
     <p>
See <specref ref="declare-openness"/> for the XML representation of
wildcards and <specref ref="coss-wildcard"/> for constraints
on wildcard components as such.</p>
   </div2>
<div2 id="&Constraint;_Definition_details">
    <head>&Constraint; Definition Details</head>
<p>&Constraint; definition components provide for uniqueness and reference constraints with respect
to the contents of multiple elements and attributes.  The &constraint; definition schema component has the following
properties:
</p>   

  <compdef name="&Constraint; Definition" ref="&Constraint;_Definition">

   <proplist>
  <propdef id="c-name" name="name">
    An NCName as defined by <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="c-target_namespace" name="target namespace">
    Either <termref def="key-null">null</termref> or a namespace URI, as defined in <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="&constraint;_name" name="&constraint; category">
    One of <pt>key</pt>, <pt>keyref</pt> or <pt>unique</pt>.
   </propdef>
  <propdef id="selector" name="selector">
    An XPath expression, as defined in <bibref ref="bib-xpath"/>
   </propdef>
  <propdef id="fields" name="fields">
    An a non-empty list of XPath expressions, as defined in <bibref ref="bib-xpath"/>
   </propdef>
  <propdef id="referenced_key" name="referenced key">
    Required if <propref ref="&constraint;_name"/> is <pt>keyref</pt>, forbidden
otherwise.  A &constraint; definition with <propref ref="&constraint;_name"/>
equal to <pt>key</pt> or <pt>unique</pt>.
   </propdef>
    <propdef id="rc-annotation" name="annotation">Optional.  An annotation</propdef>
</proplist>
  </compdef>
<p>&Constraint; definitions are identified by their <propref ref="c-name"/> and <propref ref="c-target_namespace"/>; &Constraint; definition identities must be unique within an <termref def="key-schema">XML Schema</termref>.  See <specref ref="composition-schemaImport"/> for the use of component
identifiers when importing one schema into another.</p>
<p>Informally, <propref ref="&constraint;_name"/> identifies the &Constraint; definition as playing one of
three roles:
<ulist>
 
<item><p>(<pt>unique</pt>) the &Constraint; definition asserts uniqueness, with respect to the content
identified by <propref ref="selector"/>, of the tuples resulting from evaluation of the <propref ref="fields"/> Xpath(s). </p></item>
 
<item>
<p>(<pt>key</pt>) the &Constraint; definition asserts uniqueness as for
<pt>unique</pt>.  <pt>key</pt> further asserts that all selected content
actually has such tuples.</p>
</item>
<item><p>(<pt>keyref</pt>) the &Constraint; definition asserts a correspondence, with respect to the content
identified by <propref ref="selector"/>, of the tuples resulting from evaluation of the <propref ref="fields"/> Xpath(s), with those of the <propref ref="referenced_key"/>. </p></item>
</ulist> </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 are specified 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>
     <item>
      <p>The comparison between <pt>keyref</pt> <propref ref="fields"/> and
<pt>key</pt> or <pt>unique</pt> <propref ref="fields"/> is by value equality,
not by string equality, so that a decimal <code>0.5</code> will match a decimal <code>.5</code>.</p>
     </item>
    </ulist>
    <p><propref ref="selector"/> specifies an XPath expression <bibref ref="bib-xpath"/> relative to
instances of the element being declared.  This must identify a node set of subelements (i.e. elements contained within the declared element) to which the constraint applies.</p>
    <p><propref ref="fields"/> specifies XPath expressions relative to each
element selected by a <propref ref="selector"/>.  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 <propref ref="fields"/>s, to cater to multi-field keys,
keyrefs, and uniqueness constraints.
     <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>
XPath expressions can take arbitrarily complicated forms and it is unnecessary to burden
XML Schema implementations with supporting every feature of XPath.  The XPaths
in <propref ref="selector"/> and <propref ref="fields"/> should be restricted to certain specified simple forms.</p>
     <p>The WG has asked the editor to bring forward a proposal.  Here's the
starting point, feedback invited:</p>
     <slist>
      <sitem>|, /, //, .., @QName, QName, *, ancestor::, []</sitem>
      <sitem>or, and, =</sitem>
      <sitem>the not, name and position functions</sitem>
      <sitem>string and number literals</sitem>
      <sitem>prefixes interpreted per in-scope namespace declarations</sitem>
     </slist>
    </issue>
    <issue id="islandValidConstraint">
     <p>What are the interactions between &constraint;s and opportunistic
validation inside wildcards?</p>
    </issue>

<p>A formal description of &Constraint; definition validation is given below in <specref ref="cvc-&constraint;"/></p>

 <constraintnote type="cvc" id="cvc-&constraint;">
  <head>&Constraint; Satisfied</head>
  <p>An element information item is schema-valid with respect to a &constraint; if
   <olist>
    <item>
     <p>The <propref ref="selector"/>, with the element information item as the
context node, evaluates to a node-set (as defined in
<bibref ref="bib-xpath"/>).  <termdef id="key-tns" term="target node set">Call this the <term>target node set</term></termdef>;</p>
    </item>
    <item>
     <p>Each node in the <termref def="key-tns">target node set</termref> is an
element node;</p>
    </item>
    <item>
     <p>For each node in the <termref def="key-tns">target node set</termref> all of the <propref ref="fields"/>, with that node as the context
node, evaluate to either an empty node-set or a node-set with exactly one
member.  <termdef id="key-ks" term="key-sequence">Call the sequence of the values (as defined in <bibref ref="ref-xsp2"/>) of those node-sets in order the <term>key-sequence</term> of the node</termdef>;
     </p>
    </item>
   </olist>
  </p>
  <p>
   <termdef id="key-qns" term="qualified node set">Call the subset of the <termref def="key-tns">target node set</termref> for
which all the <propref ref="fields"/> evaluate to a node-set with exactly one
member which is an element or attribute node the <term>qualified node set</term></termdef>;</p>
  <p><olist>
    <item>
     <p>The <propref ref="&constraint;_name"/> is <pt>unique</pt>;</p>
    </item>
    <item>
     <p>No two members of the <termref def="key-qns">qualified node
set</termref> have <termref def="key-ks">key-sequences</termref> whose members
are pairwise equal;</p>
    </item>
   </olist>
   or
   <olist>
    <item>
     <p>The <propref ref="&constraint;_name"/> is <pt>key</pt>;</p>
    </item>
    <item>
     <p>The <termref def="key-tns">target node set</termref> and the <termref def="key-qns">qualified node
set</termref> are equal, that is, every member of the <termref def="key-tns">target node set</termref> is also a member of the <termref def="key-qns">qualified node
set</termref> and <emph>vice versa</emph>;</p>
    </item>
    <item>
     <p>No two members of the <termref def="key-qns">qualified node
set</termref> have <termref def="key-ks">key-sequences</termref> whose members
are pairwise equal;</p>
    </item>
   </olist>
   or
   <olist>
    <item>
     <p>The <propref ref="&constraint;_name"/> is <pt>keyref</pt>;</p>
    </item>
    <item>
     <p>For each member of the <termref def="key-qns">qualified node
set</termref> (call this the <B>keyref member</B>), there must be a member of the <termref def="key-nt">node table</termref> associated with the
<propref ref="referenced_key"/> in the <xpropref>&constraint; table</xpropref>
of the element information item (see <specref ref="sic-key"/>, which must be
understood as logically prior to this clause of this constraint, below) whose
<termref def="key-ks">key-sequence</termref> is equal to the
<B>keyref member's</B> <termref def="key-ks">key-sequence</termref> member for member.</p>
    </item>
    <item>
     <ednote>
      <edtext>The fields cardinality of a keyref must be equal to the fields
cardinality of its [referenced key], checked in chapter 6.</edtext>
     </ednote>
     <ednote>
<edtext>This is simpler (and in one respect, the hyper-uniqueness implied by
the uniqueness requirement built in to the merger of the tables defined below, stronger) recursive descent implied than the apparently agreed design: is it acceptable for
v.1, as I don't see how to do better?</edtext>
</ednote>
    </item>
   </olist>
  </p>
  <ednote>
   <edtext>Check the resolution of the nested domains issue -- is the above
correct wrt that?</edtext>
  </ednote>
 </constraintnote>
 <constraintnote type="sic" id="sic-key">
  <head>&Constraint; Table</head>
  <p><termdef id="key-ec" term="eligible &constraint;">An <term>eligible
&constraint;</term> of an element information item is one such that clauses 2.1.[1-2] or 2.2.[1-3] of <specref ref="cvc-&constraint;"/> obtains
with respect to that item and that constraint,
or such that any of the element information item &i-children; of that item have a
<xpropref>&constraint; table</xpropref> with an entry for that constraint</termdef>.</p>
  <p><termdef id="key-nt" term="node table">A <term>node table</term> is a set of pairs each consisting of
a <termref def="key-ks">key-sequence</termref> and an element node</termdef>.</p>
  <p>Whenever an element information item has one or more <termref def="key-ec">eligible constraints</termref>, a new
<xpropref>&constraint; table</xpropref> is added to the post-schema-validation
infoset for that element information item, consisting of pairs of &constraint;s
and <termref def="key-nt">node tables</termref>, one for each of the item's
<termref def="key-ec">eligible constraints</termref>, with the <termref def="key-nt">node table</termref> in each pair defined as follows:  There is a member in the <termref def="key-nt">node table</termref>
associated with an <termref def="key-ec">eligible constraint</termref> of an
element information item consisting of a <termref def="key-ks">key-sequence</termref> (call it <B>k</B>) and a node (call it <B>n</B>) if and only if
   <olist>
    <item>
     <p>
   <olist>
    <item>
     <p>There is a member in one of the <termref def="key-nt">node
tables</termref> associated with the <termref def="key-ec">eligible
constraint</termref> in at least one of the <xpropref>&constraint;
tables</xpropref> of the element information item &i-children; of the element
information item whose <termref def="key-ks">key-sequence</termref> is <B>b</B> and whose node is <B>n</B>;</p>
    </item>
   </olist>
  or
   <olist>
    <item>
     <p><B>n</B> is in the <termref def="key-qns">qualified node
set</termref> for the <termref def="key-ec">eligible
constraint</termref> of the element information item with <termref def="key-ks">key-sequence</termref> <B>b</B>.</p>
    </item>
   </olist>
  </p>
    </item>
    <item>
     <p>There is no member in one of the <termref def="key-nt">node
tables</termref> associated with the <termref def="key-ec">eligible
constraint</termref> in any of the <xpropref>&constraint;
tables</xpropref> of the element information item &i-children; of the element
information item whose <termref def="key-ks">key-sequence</termref> is <B>b</B>
and whose node is a node other than <B>n</B>;</p>
    </item>
    <item>
     <p>Some node distinct from <B>n</B> is in the <termref def="key-qns">qualified node
set</termref> for the <termref def="key-ec">eligible
constraint</termref> of the element information item with <termref def="key-ks">key-sequence</termref> <B>b</B>.</p>
    </item>
   </olist>
  </p>
 </constraintnote>
 <ednote>
  <edtext>This is considerably less than transparent.  The intention is to
recursively construct r-c tables at one level by merging the still-unique
members of each corresponding table one level down, if any, with the new
entries arising from evaluating the r-c at this level, if any, throwing out any which conflict.</edtext>
 </ednote>
 
<p>
See <specref ref="declare-key"/> for the XML representation of
&constraint; definitions and <specref ref="coss-&constraint;"/> for constraints
on &constraint; definition components as such.</p>
   </div2>
   <div2 id="Notation_Declaration_details">
    <head>Notation Declaration Details</head>
<ednote><edtext>Cleanup of the descriptive text below, and descriptions of individual properties to be provided in a
future draft.  </edtext></ednote>
    <p>
The notation declaration schema component has the following
properties:</p>

  <compdef name="Notation Declaration" ref="Notation_Declaration">
   <proplist>
  <propdef id="n-name" name="name">
    An NCName as defined by <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="n-target_namespace" name="target namespace">
    Either <termref def="key-null">null</termref> or a namespace URI, as defined in <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="system_identifier" name="system identifier">
    Optional if <propref ref="public_identifier"/> is present.  A URI reference.
   </propdef>
  <propdef id="public_identifier" name="public identifier">
    Optional if <propref ref="system_identifier"/> is present.  A public identifier, as defined in <bibref ref="ref-xml"/>.
   </propdef>
    <propdef id="n-annotation" name="annotation">Optional.  An annotation</propdef>
</proplist>

  </compdef>
    <p>Notation declarations do not participate in schema-validation as such.
They are referenced in the course of schema-validating strings as members of
the <xtermref href="&XSP2.URI;#NOTATION">NOTATION</xtermref> simple type.</p>
     <p>
See <specref ref="declare-notation"/> for the XML representation of
notation declarations and <specref ref="coss-notation"/> for constraints on
notation declaration components as such.</p>

   </div2>
   <div2 id="Annotation_details">
    <head>Annotation Details</head>
<ednote><edtext>Cleanup of the descriptive text below, and descriptions of individual propert