<?xml version='1.0'?>
<!-- Id: structures.xml,v 1.106 2000/10/24 13:17:18 ht Exp  -->
<?xml-stylesheet type='text/xsl' href='../xmlschema.xsl'?>
<!DOCTYPE spec PUBLIC "-//HST//DTD Specification::19990423//EN" "xmlspec-19990429.dtd" [
   <!ENTITY SchemaWG "<loc
href='http://www.w3.org/XML/Activity#schema-wg'>W3C XML Schema Working
Group</loc>">
   <!ENTITY XSP1 "<emph>XML Schema: Structures</emph>">
   <!ENTITY XSP2 "<bibref ref='ref-xsp2'/>">
   <!ENTITY doc.date "24 October 2000">
   <!ENTITY w3c.doc.date "24-October-2000">
   <!ENTITY iso.doc.date "20001024">
   <!ENTITY XSP1.version "1.0">
   <!ENTITY doc.audience "Public: Candidate Recommendation">
   <!ENTITY doc.distribution "unrestricted">

   <!ENTITY eacute "&#233;" > <!-- small e, acute accent -->
   <!ENTITY constraint "identity-constraint">
   <!ENTITY Constraint "Identity-constraint"> <!-- for replacement later? -->
   <!ENTITY PSVI "post-schema-validation infoset">
   <!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|p)*>
   <!ELEMENT reprelt EMPTY>
   <!ATTLIST reprelt eltname NMTOKENS #REQUIRED
                     type NMTOKEN #IMPLIED
                     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
                    inside NMTOKEN #IMPLIED>
   <!ELEMENT stale ANY>
   <!ELEMENT restrictCases (restrict+)>
   <!ELEMENT restrict (any|all|choice|elt|seq)*>
   <!ATTLIST restrict case NMTOKEN #REQUIRED>
   <!ELEMENT any (#PCDATA)>
   <!ELEMENT all (#PCDATA)>
   <!ELEMENT elt (#PCDATA)>
   <!ELEMENT choice (#PCDATA)>
   <!ELEMENT seq (#PCDATA)>
   <!ELEMENT schemaComp (head,pvlist+)>
   <!ATTLIST schemaComp id ID #REQUIRED>
   <!ELEMENT pvlist (pvpair+)>
   <!ELEMENT pvpair ANY>
   <!ATTLIST pvpair ref IDREF #REQUIRED>
   <!ENTITY % local.p.class "|stale">
   <!ENTITY % local.termdef.class "|propdef">
   <!ENTITY % local.ref.class "|propref|xpropref|eltref">
   <!ENTITY % local.illus.class "|compdef|reprdef|proplist|schemaComp|restrictCases">
   <!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-value "<termref def='key-nv'>normalized value</termref>">
   <!ENTITY r-value "<termref def='key-iv'>initial value</termref>">
   <!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>structures-&iso.doc.date;</w3c-designation>
    <w3c-doctype>W3C Candidate Recommendation</w3c-doctype>
    <pubdate>
      <day>24</day>
      <month>October</month>
      <year>2000<!-- Id: structures.xml,v 1.106 2000/10/24 13:17:18 ht Exp --></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="http://www.w3.org/TR/2000/CR-xmlschema-1-20001024/structures.xml">XML</loc> (with its own <loc href="http://www.w3.org/TR/2000/CR-xmlschema-1-20001024/xmlspec-19990429.dtd">DTD</loc>, <loc href="http://www.w3.org/TR/2000/CR-xmlschema-1-20001024/xmlschema.xsl">XSL
stylesheet</loc> (Nov REC version)) and <loc href="http://www.w3.org/TR/2000/CR-xmlschema-1-20001024/structures.html">HTML</loc>), with separate provision of the <loc href="http://www.w3.org/2000/10/XMLSchema.xsd">schema</loc> and <loc href="http://www.w3.org/2000/10/XMLSchema.dtd">DTD</loc> for schemas described herein.</p>
</notice>
    <publoc> <loc href="http://www.w3.org/TR/2000/CR-xmlschema-1-20001024/">http://www.w3.org/TR/2000/CR-xmlschema-1-20001024/</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/2000/WD-xmlschema-1-20000922/">http://www.w3.org/TR/2000/WD-xmlschema-1-20000922/</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>for 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 specification of the XML Schema language is a Candidate
Recommendation of the World Wide Web Consortium.  This means that the <loc href="http://www.w3.org/XML/Activity#schema-wg">XML 
Schema Working Group</loc>considers the specification to
be stable and encourages implementation and comment on the
specification during this period. The Candidate Recommendation review
period ends on 15 December 2000. Please send review comments before
the review period ends to <loc href="mailto:www-xml-schema-comments@w3.org">www-xml-schema-comments@w3.org</loc> (<loc href="http://lists.w3.org/Archives/Public/www-xml-schema-comments/">public mailing list archive</loc>).  Readers may find <specref ref="changes"/> helpful in identifying the major changes since the Last Call Public Working Draft.</p>
     <p>During the Candidate Recommendation phase, although feedback based on
any aspect of implementation experience is welcome, there are certain aspects of the
design presented herein for which the Working Group is particularly
interested in feedback. These are designated <emph>priority feedback</emph> aspects
of the design, and identified as such in editorial notes throughout
this draft.</p>
     <p>Should this specification prove very difficult or impossible to
implement, the Working Group will return the document to Working Draft
status and make necessary changes. Otherwise, the Working Group
anticipates asking the W3C Director to advance this document to
Proposed Recommendation.</p>
     <p>This document has been produced as part of the W3C <loc href="http://www.w3.org/XML/">XML Activity</loc>. The
authors of this document are the XML Schema WG members. Different
parts of this specification have different editors.</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, including those which exploit the XML
Namespace facility. The schema language, which is itself represented in XML
            1.0 and uses namespaces, substantially reconstructs and considerably extends 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 an introduction
to 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"/>, describes how to represent
schemas as one or more XML documents, with reference to a DTD and XML Schema
for an XML Schema document type, along with a detailed mapping between the elements and
attribute vocabulary of this representation and the components and properties
of the abstract model.</p>
     <p>Chapter 5 presents <specref ref="conformance-details"/>, which provide
detailed constraints on the internal structure of each component of the
abstract model.</p>
      <p>Chapter 6 presents <specref ref="composition"/>, including the
connection between documents and schemas, the import, inclusion and redefinition of declarations and definitions and
        the foundations of schema-validity assessment.</p>
      <p>Chapter 7 discusses <specref ref="conformance"/>, including the
overall approach to schema-validity assessment of documents, and responsibilities of schema-aware
        processors. </p>
      <p>The normative appendices include a <specref ref="normative-schemaSchema"/> for the XML representation of schemas and
        <specref ref="normative-references"/>.</p>
     <p>The non-normative appendices include the <specref ref="nonnormative-schemaDTD"/> and a <specref ref="normative-glossary"/>.</p>
     <p>This document is primarily intended as a language definition reference.
As such, although it contains a few examples, it is <emph>not</emph> designed
primarily to serve as a motivating introduction to the design and its features,
but rather as a careful and fully explicit definition of that design, suitable
for guiding implementations.  For those in search of a step-by-step
introduction to the design, the non-normative <bibref ref="bib-expo"/> is a much better
starting point than this document.</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 normalization and defaulting of attribute
and element values. 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 implemented 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-xmlinfo"/>,
      <bibref ref="ref-xml-namespaces"/>,
      <bibref ref="bib-xpath"/>, and
      <bibref ref="ref-xsp2"/>.  Before this specification is finally completed, we will
need to account for any changes <bibref ref="ref-xbase"/> makes to the Infoset in the areas of
<termref def="gloss-QName">QName</termref> interpretation and value space and
the interpretation of all aspects of schemas involving values identified as
being of type <code>uriReference</code>, including in particular
<code>xsi:schemaLocation</code>, <code>xsi:noNamespaceSchemaLocation</code> and
<code>targetNamespace</code>.  See <bibref ref="ref-xsp2"/> for the details of
the <code>uriReference</code> type and all uses of URI references in this specification.</p>
     <p>See <specref ref="infoset"/> for a tabulation of the information items
and properties specified in <bibref ref="ref-xmlinfo"/> which this
specification requires as a precondition to schema-aware processing.</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>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.example.com/XMLSchema/1.0/mySchema"&gt;</eg>
          <p>And an explanation of the example.</p>
      </note>
     <p>References to properties of information items as defined in <bibref ref="ref-xmlinfo"/> are notated as links to the relevant section thereof, set off with square brackets, for example &i-children;.</p>
      <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>References to properties of schema components are notated as links to
the relevant definition as exemplified above, set off with curly braces, for instance <propref ref="xmpl-prop"/>.</p>
      <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 context,
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,
as are the illustrations of the XML representation element information items.
</p>
     <note>
      <p>The illustrations are derived automatically from the <specref ref="normative-schemaSchema"/>.  In the case of apparent conflict, the <specref ref="normative-schemaSchema"/> takes precedence, as it, together with the <termref def="gloss-src">Schema Representation Constraints</termref> provide the normative statement of
the form of XML representations.</p>
     </note>
<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>

      <ednote role="pf">
        <edtext>Identification of priority feedback aspects of this draft.</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
consists of components such as type definitions
and element declarations.  These can be used to assess the validity 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 normalized and/or default values for
attributes and elements and
the types of element and attribute information items.</p>
    <p>Schema-validity assessment has two aspects:
<olist><item><p>determining local schema-validity, that is
whether an element or attribute information item satisfies the
constraints embodied in the relevant
components of an XML Schema;</p></item>
<item><p>Synthesising an overall validation outcome for the item,
combining local schema-validity with the results of schema-validity
assessments of its descendants, if any, and
adding appropriate augmentations to the infoset to record this outcome.</p></item></olist></p>
    <p>Throughout this specification, <termdef id="key-vn" term="valid">the
word <term>valid</term> and its derivatives are used to refer to
item 1 above, the determination of local
schema-validity.</termdef></p>
<p>Throughout this specification, <termdef id="key-va" term="assessment"> the work <term>assessment</term> is used to refer
to the whole rich process of
local validation, schema-validity assessment and infoset augmentation.</termdef></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/2000/WD-xml-infoset-20000726#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 <termref def="key-va">assessment</termref> and for all schema documents.</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>
    
  <note>
    <p>We have not so far seen any need to reconstruct the XML 1.0 notion of
      <emph>root</emph>. For the connection from document instances to schemas, see
<specref ref="composition-instances"/> and <specref ref="conformance"/>.</p>
  </note>
<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>Attribute declarations</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>Model groups</p></item>
<item><p>Particles</p></item>
<item><p>Wildcards</p></item>
</ulist>
     <p>During <termref def="key-vn">validation</termref>, <termdef id="key-declaration" term="declaration"><term>declaration</term> components are associated by
(qualified) name to information items being <termref def="key-vn">validated</termref></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">absent</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 <termref def="key-vn">validate</termref>.</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
<termref def="key-va">assessment</termref> 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><termref def="key-vn">Validation</termref>, defined in detail in <specref ref="components"/>, is a
relation between information items and schema components.  For example, an
attribute information item may <termref def="key-vn">validate</termref> respect to an attribute
declaration, a list of element information items may <termref def="key-vn">validate</termref> 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 <termref def="key-vn">validation</termref>.</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> or an <termref def="key-typeExtension">extension</termref> of some other type definition.  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
specified 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 specified 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, whose
name is <B>anyType</B>, 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>
</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-value; 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>.  For the built-in primitive types, this is the simple
version of the <termref def="key-urType">ur-type
definition</termref>, whose name is <B>anySimpleType</B>, which
 is in turn understood to be a restriction of the ur-type definition.  Simple types may
also be defined whose members are lists of items
themselves constrained by some other simple type definition, or whose
membership is the union of the memberships of some other simple type
definitions.  List and union simple type definitions are also understood as
restrictions of the simple <termref def="key-urType">ur-type
definition</termref>.</p>
     <p>For details on the composition of simple type definitions and the
<termref def="key-vn">validation</termref> semantics associated with them, 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 contain neither element nor character information
items, to be a string which belongs to a particular simple
type or to contain a sequence of element information items which conforms to a particular model group, with or without character information items as well.</p>
     <p>Each complex type definition is either
      <ulist>
       <item>
        <p>a restriction of a complex <termref def="key-baseTypeDefinition">base
type definition</termref></p>
       </item>
      </ulist>
      or
      <ulist><item>
<p>an <termref def="key-typeExtension">extension</termref> of a simple or complex <termref def="key-baseTypeDefinition">base
type definition</termref></p>
</item>
</ulist>
      or
      <ulist>
       <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
<termref def="key-vn">validation</termref> semantics 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 is described in a section below. Also included is a discussion
of element substitution groups, 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 (possibly empty) 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 ellipses:</p>
<eg>&lt;!ELEMENT A . . .&gt;
&lt;!ATTLIST A . . .&gt;
</eg>
<p>Element declarations contribute to
<termref def="key-vn">validation</termref> as part of model group <termref def="key-vn">validation</termref>, when their defaults and type components are checked against an element
information item with a matching name and namespace, and by triggering
&constraint; definition <termref def="key-vn">validation</termref>.</p>
     <p>
See <specref ref="Element_Declaration_details"/> for the composition and
<termref def="key-vn">validation</termref> semantics 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 Substitution Group</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 substitution group">Through
the new mechanism of <term>element substitution groups</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
head, for an element substitution group.  Other global element declarations,
regardless of target namespace, can be designated as members of the
substitution group headed by this element.  In a suitably enabled content
model, a reference to the head <termref def="key-vn">validates</termref> not just the head itself, but elements
corresponding to any member of the substitution group as well.
</p>
<p>All such members must have type definitions which are either the same as the
head'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 substitution group are defined, the
content of member elements is strictly limited according to the type
definition of the substitution group head.</p>
<p>Note that element substitution groups 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 either global, or local to its containing complex type definition.  Attribute declarations contribute to
<termref def="key-vn">validation</termref> as part of complex type definition <termref def="key-vn">validation</termref>, 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
<termref def="key-vn">validation</termref> semantics 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 <termref def="key-vn">valid</termref> 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
<termref def="key-vn">validation</termref> semantics 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
<termref def="key-vn">validation</termref> semantics 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
<termref def="key-vn">validation</termref> as part of complex type definition <termref def="key-vn">validation</termref>, 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 constrain the <termref def="key-vn">validation</termref>
of 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 <termref def="key-vn">validation</termref> of both mixed and element-only content. </p>
</note></p>
     <p>
See <specref ref="Particle_details"/> for the composition and
<termref def="key-vn">validation</termref> semantics 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 and attribute information items dependent on their namespace URI, independently
of their local names.</p>
     <p>
See <specref ref="Wildcard_details"/> for the composition and
<termref def="key-vn">validation</termref> semantics 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>An &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 <termref def="key-vn">valid</termref> reference, within
a specified scope. An element information item is only <termref def="key-vn">valid</termref> 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
<termref def="key-vn">validation</termref> semantics 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 provided to enable
the re-use of 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,
enabling re-use of the same model group in several complex type
definitions.</p>
     <p>
See <specref ref="Model_Group_Definition_details"/> for the composition and
<termref def="key-vn">validation</termref> semantics 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,
enabling re-use of the same set in several complex type
definitions.</p>
     <p>
See <specref ref="Attribute_Group_Definition_details"/> for the composition and
<termref def="key-vn">validation</termref> semantics 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
<termref def="key-vn">validation</termref> semantics 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>

     </div3>
   </div2>
    <div2 id="concepts-schemaConstraints">
      <head>Constraints and Validation Rules</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 <termref def="key-vn">validation</termref>, 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
<termref def="key-vn">validation</termref> of information items:</p>
      <glist>
        <gitem>
          <label>Constraint on Schemas
          </label>
          <def>
            <p><termdef id="gloss-cos" term="Constraint on Schemas">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-details"/>.</termdef></p>
          </def>
        </gitem>
       <gitem>
        <label>Schema Representation Constraint</label>
        <def>
         <p><termdef id="gloss-src" term="Schema Representation Constraint">Constraints on the
representation of schema components in XML.  Some but not all of these are expressed in <specref ref="nonnormative-schemaDTD"/> and <specref ref="normative-schemaSchema"/>.  Largely to be
found in <specref ref="declare"/>.</termdef></p>
        </def>
       </gitem>
        <gitem>
          <label>Validation Rules </label>
          <def>
            <p><termdef id="gloss-cvc" term="Validition
Rules">Contributions to <termref def="key-vn">validation</termref> associated with schema components.  Largely to be
found in <specref ref="components"/>.</termdef></p>
          </def>
        </gitem>
      </glist>
     <p>The definition of the above constraints sometimes involves many
clauses, some as alternatives, some as joint requirements.  The presentations
below number all clauses:  clauses at the same level are either clearly
identified as alternatives with words such as <emph>either</emph> and
<emph>or</emph>, or should be understood as joint.</p>
     <glist>
      <gitem>
          <label>Schema Information Set
            Contribution</label>
          <def>
            <p><termdef id="gloss-sic" term="Schema Information Set Contribution">Augmentations to &PSVI;s
expressed by schema components, which follow
              as a consequence of <termref def="key-vn">validation</termref> and/or <termref def="key-va">assessment</termref>.
Largely to be
found in <specref ref="components"/>.</termdef></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 normalization or access.
(As an example of the latter case, consider the
          effect of <code>NMTOKENS</code> on attribute white space, 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 Rules</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 <termref def="key-vn">validation</termref> and <termref def="key-va">assessment</termref>.</p>
<note>
<p>By separating the conformance requirements relating to the concrete syntax of XML schema
documents, this specification admits processors
which use schemas stored in optimized 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 <specref ref="schema-loc"/>.
</termdef>.
</p>
<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 specification to define such additional levels of conformance.</p></note>
 <p>See <specref ref="composition"/> for a more detailed explanation of the
mechanisms supporting these levels of conformance.</p>
</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 denote 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>Locally scoped attribute and element
declarations are special with regard to symbol spaces.
Every complex type definition defines its own local attribute and element declaration symbol
        spaces, where these symbol spaces are distinct from each other and from any of the other
symbol spaces.  So, for example, two complex type definitions having
the same target namespace can contain
a local 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 Validated</head>
  <p>The XML representation of schema components uses a vocabulary
identified by the namespace URI <code>http://www.w3.org/2000/10/XMLSchema</code>.  For brevity, the text and examples in this specification use the prefix
<code>xs:</code> to stand for this namespace; in practice,
any prefix can be used.</p>
 <p>&XSP1; also defines several attributes for direct use in any XML documents.  These attributes are in a different namespace,
which has the namespace URI <code>http://www.w3.org/2000/10/XMLSchema-instance</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 in <termref def="key-vn">validation</termref> of an element is usually
determined by reference to the appropriate schema components.
An element information item in an instance may, however,
explicitly assert its type using the attribute <code>xsi:type</code>.
The value of this attribute is a <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#QName">QName</xtermref>;  see <specref ref="src-qname"/> for
the means by which the <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#QName">QName</xtermref> is
associated with a type definition.
</p>
</div3>
<div3 id="xsi_null">
<head>xsi:null</head>
<p>&XSP1; introduces a mechanism for signalling that an element's content is
missing, or <quote>null</quote> in the terminology of databases.  An
element has null content if it has the attribute <code>xsi:null</code> with
the value <code>true</code>.  An element so labelled must be empty, but can
carry attributes if permitted by the corresponding complex type.</p>
</div3>
<div3 id="xsi_schemaLocation">
<head>xsi:schemaLocation, xsi:noNamespaceSchemaLocation</head>
<p>The <code>xsi:schemaLocation</code> and <code>xsi:noNamespaceSchemaLocation</code> attributes can be used in a document to provide
hints as to the physical location of schema documents which may be used for <termref def="key-va">assessment</termref>.
See <specref ref="schema-loc"/> for details on the use of these attributes.</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"/>. For more information on
the representation and use of schema documents on the World Wide Web see <specref ref="schema-repr"/> and
<specref ref="schema-loc"/>. </p>
</div2>
 </div1>
  <div1 id="components">
   <head>Schema Component Details</head>
   <p>The following sections provide full details on the properties and
significance of the schema itself and 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 the root is a schema, and
every other vertex is a schema
component or a literal (string, boolean, number) and every labelled edge a
property.  The graph is <emph>not</emph> acyclic:  multiple copies of
components with the same name in the same <termref def="key-symbolSpace">symbol space</termref> may not exist, so in some cases re-entrant chains
of properties must exist.  Equality of components for the purposes of this
specification is always addressed at the level of names (including target
namespaces) within symbol spaces.</p>
   <p><termdef id="key-null" term="absent">Throughout this specification, the
term <term>absent</term> is used as a distinguished value denoting absence.</termdef></p>
   <p>Any property not
identified as optional is required to be present, optional properties which are
not present are taken to have <termref def="key-null">absent</termref>.  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">absent</termref>.  Any property value identified as superset or subset of some set may be equal to that set, unless a proper superset or subset is explicitly called for.
By 'string' in Part 1 of this specification is meant a
sequence of ISO 10646 character codes identified as <xtermref href="http://www.w3.org/TR/REC-xml#charsets">legal XML character codes</xtermref>
in <bibref ref="ref-xml"/>.</p>
   <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 <bibref ref='bib-expo'/>.</p>
   </note>
   <p>Throughout this specification, <termdef id="key-iv" term="initial value">when we refer to the
<term>initial value</term> of some
attribute information item, we mean by this the value of the
<xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">normalized
value</xpropref> property of that item.  Similarly, when
we refer to the <term>initial value</term> of an element information item, we mean the string composed of, in order, the
&i-ccode; of each character information item in the &i-children; of that
element information item</termdef>.</p>
   <p>The above definition means that comments and processing instructions,
even in the midst of text, are ignored for all <termref def="key-vn">validation</termref> purposes.</p>
   <p><termdef id="key-nv" term="normalized value">When we refer to the
<term>normalized value</term> of an element or
attribute information item, we mean an &r-value; whose white space, if any, has been
normalized according to the value of the <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes.html#whiteSpace">whiteSpace facet</xtermref> of the
simple type definition used in its <termref def="key-vn">validation</termref>:
 </termdef>
    <glist>
     <gitem>
      <label>preserve</label>
      <def>
       <p>No normalization is done, the value is the &i-value;</p>
      </def>
     </gitem>
     <gitem>
      <label>replace</label>
      <def>
       <p>All occurrences of <code>#x9</code> (tab), <code>#xA</code> (linefeed) and
<code>#xD</code> (carriage return) are replaced with <code>#x20</code> (space).</p>
      </def>
     </gitem>
     <gitem>
      <label>collapse</label>
      <def>
       <p>Subsequent to the replacements specified above under <B>replace</B>,
contiguous sequences of <code>#x20</code>s are collapsed to a single
<code>#x20</code>, and initial and/or final <code>#x20</code>s are deleted.</p>
      </def>
     </gitem>
    </glist>
   </p>
   <p>These three levels of normalization correspond to the processing mandated
in XML 1.0 for element content, CDATA attribute content and tokenized
attributed content, respectively.  See <xspecref href="http://www.w3.org/TR/REC-xml#AVNormalize">Attribute Value Normalization</xspecref> in <bibref ref="ref-xml"/> for the precedent for <B>replace</B> and <B>collapse</B> for attributes.  Extending this processing to element content is necessary to ensure a consistent <termref def="key-vn">validation</termref> semantics for simple types, regardless of whether they are applied to attributes or elements.  Performing it twice in the case of attributes whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">normalized
value</xpropref> has already been subject to replacement or collapse on the basis of
information in a DTD is necessary to ensure consistent treatment of attributes
regardless of the extent to which DTD-based information has been made use of
during infoset construction.</p>
   <note>
    <p>Even when DTD-based information <emph>has</emph> been appealed to, and
<xspecref href="http://www.w3.org/TR/REC-xml#AVNormalize">Attribute Value
Normalization</xspecref> has taken place, the above definition of &i-value; may
mean <emph>further</emph> normalization takes place, as for instance when
character entity references in attribute values result in white space characters
other than spaces in their &r-value;s.</p>
   </note>
   <p>Many properties are identified below as having
other schema components or sets of 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 resolved.  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>
   <p>It is important to recognise that processors cannot be sure that names
will not resolve only on the basis of the schema document in which they occur. 
By the time the component corresponding to the XML representation which
includes the name is actually needed for <termref def="key-vn">validation</termref> an appropriately-named component may have become available:  see <specref ref="conformance"/> for details.</p>
      <p>As the above makes clear, at the level of schema components and <termref def="key-vn">validation</termref>, reference to components by name is normally not involved.  In a
few cases, however, qualified names appearing in information items being
<termref def="key-vn">validated</termref> must be resolved to schema components by such lookup.  The following
constraint is appealed to in these cases.</p>
   <constraintnote type="cvc" id="cvc-resolve-instance">
  <head>QName resolution (Instance)</head>
  <p>A pair of a local name and a namespace URI (or <termref def="key-null">absent</termref>)
resolve to a schema component of a specified kind in the context of <termref def="key-vn">validation</termref> by appeal to the appropriate
property of the schema being used for the <termref def="key-va">assessment</termref>.  Each such property indexes components by name.  The table to use is determined by the kind of component specified, that is, the table which is the value of:
   <olist>
    <item>
     <p> the <propref ref="type_definitions"/> if the kind specified is simple or complex type definition;</p>
    </item>
    <item>
     <p>the <propref ref="attribute_declarations"/> if the kind specified is attribute declaration;</p> 
    </item>
    <item>
     <p>the <propref ref="element_declarations"/> if the kind specified is element declaration;</p> 
    </item>
    <item>
     <p>the <propref ref="attribute_group_definitions"/> if the kind specified
is attribute group;</p> 
    </item>
    <item>
     <p>the <propref ref="model_group_definitions"/> if the kind specified is
model group;</p>
    </item>
    <item>
     <p>the <propref ref="notation_declarations"/> if the kind specified is notation declaration;</p> 
    </item>
   </olist>
   whose <B>{local name}</B> matches the local name and whose <B>{target namespace}</B> is identical to the namespace URI of the pair.
  </p>
 </constraintnote>
   <note>
    <p>A schema and its components as defined in this chapter 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>
   <div2 id="Schema_details">
    <head>Schema details</head>
    <p>At the abstract level, the schema itself is just a container for its components.</p>
    <compdef name="Schema" ref="key-schema">
     <proplist>
      <propdef id="type_definitions" name="type definitions">A set of
named simple and complex type definitions</propdef>
      <propdef id="attribute_declarations" name="attribute declarations">A set of
named global attribute declarations</propdef>
      <propdef id="element_declarations" name="element declarations">A set of
named global element declarations</propdef>
      <propdef id="attribute_group_definitions" name="attribute group definitions">A set of named
attribute group definitions</propdef>
      <propdef id="model_group_definitions" name="model group definitions">A set of named
model group definitions</propdef>
      <propdef id="notation_declarations" name="notation declarations">A set of
notation declarations</propdef>
      <propdef id="annotations" name="annotations">A set of annotations</propdef>
     </proplist>
    </compdef>
    <p>See <specref ref="declare-schema"/> for the XML representation of
schemas and <specref ref="coss-schema"/> for constraints on schemas as such.</p>
    <constraintnote type="sic" id="sic-schema">
     <head>Schema Information</head>
     <p>Schema components provide a wealth of information about the basis of
<termref def="key-va">assessment</termref>, which may well be of relevance to
subsequent processing.  Reflecting component structure into a form suitable for
inclusion in the &PSVI; is the way this specification provides for making this
information available.</p>
     <p>Accordingly, <termdef id="key-iso" term="item isomorphic to a component"> we refer below to an <term>item isomorphic to a component</term>, meaning an information item whose type is equivalent to the component's, with one property per property of the component, with the same name, and value either the same atomic value, or an information item corresponding in the same way to its component value, recursively, as necessary.</termdef></p>
     <p>In the &PSVI; a <xpropref>schema information</xpropref> property is added
to the element information item at which <termref def="key-va">assessment</termref> began.  Its value
is a set of <B>namespace schema information</B> information items, one for each namespace URI which appears as the
<B>{target namespace}</B> of any schema component in the schema used for that
assessment, and one for <termref def="key-null">absent</termref> if any schema
component in the schema had no <B>{target namespace}</B>.  Each <B>namespace schema information</B> information item has the
following properties and values:
      <glist>
       <gitem>
        <label><xpropref>schema namespace</xpropref></label>
        <def>
         <p>a namespace
URI or <termref def="key-null">absent</termref></p>
        </def>
       </gitem>
       <gitem>
        <label><xpropref>schema components</xpropref></label>
        <def>
         <p>a (possibly
empty) list of <B>schema component</B> information items, each one an <termref def="key-iso">item isomorphic to a component</termref> whose <B>{target
namespace}</B> is the sibling <xpropref>schema namespace</xpropref>
property above, drawn from the schema used for <termref def="key-va">assessment</termref>.</p>
        </def>
       </gitem>
       <gitem>
        <label><xpropref>schema documents</xpropref></label>
        <def>
         <p>a
(possibly empty) list of <B>schema document</B> information items, with
properties and values as follows:
          <glist>
           <gitem>
            <label><xpropref>document
location</xpropref></label>
            <def>
             <p>either a URI reference, if available, otherwise
<termref def="key-null">absent</termref></p>
            </def>
           </gitem>
           <gitem>
            <label><xpropref>document</xpropref></label>
            <def>
             <p>a <B>document
information item</B>, if available, otherwise <termref def="key-null">absent</termref></p>
            </def>
           </gitem>
          </glist>
          for a schema document which
contributed components to the schema, and whose
<code>targetNamespace</code> matches the sibling <xpropref>schema namespace</xpropref> property above (or was absent
but contributed components to that namespace by being <eltref ref="include"/>d
by a schema document with that <code>targetNamespace</code> as per <specref ref="compound-schema"/>).
         </p>
        </def>
       </gitem>
      </glist>
     </p>
     <p>The <xpropref>schema components</xpropref> property is provided for
processors which wish to provide a single access point to the
components of the schema which was used during <termref def="key-va">assessment</termref>.  Lightweight processors are free to leave it empty, but if it <emph>is</emph> provided, it must contain at a minimum all the top-level (i.e. named) components which actually figured in the <termref def="key-va">assessment</termref>, either directly or (because an anonymous component which figured is contained within) indirectly.</p>
    </constraintnote>
   </div2>
   <div2 id="Attribute_Declaration_details">
    <head>Attribute Declaration Details</head>
    <p>Attribute declarations provide for:</p>
    <ulist>
     <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">absent</termref> or
a namespace URI, as defined in <bibref ref="ref-xml-namespaces"/>.</propdef>
      <propdef id="a-simple_type_definition" name="type definition">A
simple type definition.</propdef>
            <propdef id="a-scope" name="scope">Optional.  Either <pt>global</pt> or a complex type
definition.</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 <termref def="key-vn">validated</termref>.</p>
    <p>A <propref ref="a-scope"/> of <pt>global</pt> identifies attribute declarations
available for use in complex type definitions throughout the schema.  Locally scoped declarations are available for use only within the
complex type definition identified by the <propref ref="a-scope"/> property.  This property is <termref def="key-null">absent</termref> in the case of declarations within attribute group definitions:  their scope will be determined when they are used in the construction of complex type definitions.
</p>
    <p>A non-<termref def="key-null">absent</termref> value of the <propref ref="a-target_namespace"/> property provides for <termref def="key-vn">validation</termref> of
namespace-qualified attribute information items (which must be explicitly
prefixed in the character-level form of XML documents).  <termref def="key-null">Absent</termref> values of
<propref ref="a-target_namespace"/> <termref def="key-vn">validate</termref> unqualified (unprefixed) items.</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 <code>#FIXED</code>
attribute values.  <pt>default</pt> specifies that the attribute is to appear unconditionally in
the &PSVI;, with the supplied value used
whenever the attribute is not actually present; <pt>fixed</pt> indicates that the attribute value if present must match the supplied
constraint string, and if absent receives the supplied value as for <pt>default</pt>.</p>
    <p>See <specref ref="Annotation_details"/> for the significance of the
<propref ref="a-annotation"/> property.</p>
<note><p>A more complete and formal presentation of the semantics of <propref ref="a-name"/>, <propref ref="a-target_namespace"/> and <propref ref="a-value_constraint"/> is provided in
conjunction with other aspects of complex type <termref def="key-vn">validation</termref> (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 in
this specification 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 Locally Valid</head>
     <p>An attribute information item is locally <termref def="key-vn">valid</termref> with respect to an
attribute declaration if 
      <olist>
       <item>
        <p>The declaration is non-<termref def="key-null">absent</termref> (see <specref ref="conformance-missing"/> for
how this can fail to be the case);</p>
       </item>
       <item>
        <p>its &i-value; is locally <termref def="key-vn">valid</termref> with respect to that <propref ref="a-simple_type_definition"/> as per <specref ref="cvc-simple-type"/>;</p>
       </item>
       <item>
        <p>its &i-value; matches the string of the <propref ref="a-value_constraint"/>, if it is
present and <pt>fixed</pt>.</p>
       </item>
      </olist>
     </p>
    </constraintnote>
    <constraintnote type="sic" id="sic-attr-error-code">
     <head>Validation Failure (Attribute)</head>
     <p>If the local <termref def="key-vn">validity</termref>, as defined by <specref ref="cvc-attribute"/>
above, of an attribute information item has been assessed,
in the &PSVI; the item has a
list-valued <xpropref>schema error code</xpropref>
property.  If the item is not <termref def="key-vn">valid</termref>, applications wishing to provide
information as to the reason(s) for this are encouraged to record one or more
error codes (see <specref ref="outcomes"/> therein.</p>
    </constraintnote>
    <constraintnote type="sic" id="sic-attr-decl">
     <head>Attribute Declaration</head>
     <p>If an attribute information item is <termref def="key-vn">valid</termref> with respect to an attribute
declaration as per <specref ref="cvc-attribute"/> then in the &PSVI; the element
information item has, optionally</p>
     <olist>
     <item>
      <p>an <xpropref>attribute declaration</xpropref> property,
containing an <termref def="key-iso">item isomorphic to the declaration component</termref> itself.</p>
     </item>
     </olist>
    </constraintnote>
    <constraintnote type="sic" id="sic-attrType">
     <head>Attribute Validated by Type</head>
     <p>If clause 1.3 of <specref ref="cvc-attribute"/> applies with
respect to an attribute information item, in the &PSVI; the attribute information item has 
<olist>
 <item>
  <p>a <xpropref>schema normalized value</xpropref> property, whose value is
the &i-value; of the item as <termref def="key-vn">validated</termref>;</p>
 </item>
</olist>
and either
<olist>
<item><p>a single <xpropref>type definition</xpropref> property,
containing an <termref def="key-iso">item isomorphic</termref> to the relevant attribute declaration's
<propref ref="a-simple_type_definition"/> component.</p></item>
<item>
        <p>if the <xpropref>type definition</xpropref> has <propref ref="variety"/> <pt>union</pt>, then additionally there
is a <xpropref>member type definition</xpropref> property, containing an
<termref def="key-iso">item isomorphic to that member</termref> of the <propref ref="st-member_type_definitions"/> which actually <termref def="key-vn">validated</termref> the attribute item's <xpropref>normalized value</xpropref>.</p>
       </item></olist>
or
      <olist>
       <item>
        <p>four properties as
described in <specref ref="sic-eltType"/>.</p>
       </item>
       <item>
        <p>if the <xpropref>type definition</xpropref> has <propref ref="variety"/> <pt>union</pt>, then there are three additional properties as described in the parallel case for <specref ref="sic-eltType"/>, where the <termref def="key-amt">actual member type definition</termref> is that member of the <propref ref="st-member_type_definitions"/> which actually <termref def="key-vn">validated</termref> the attribute item's <xpropref>normalized value</xpropref>.</p>
       </item>
      </olist>
     </p>
     <p>See below under <specref ref="sic-eltType"/> for a discussion of the
alternatives given above.</p>     
     <p>Also, if the declaration has a <propref ref="a-value_constraint"/>, the item's
<xpropref>schema default</xpropref> is set to the declaration's <propref ref="a-value_constraint"/> string.</p>
     <p>If the attribute information item was not <termref def="key-svaa">strictly assessed</termref>, then in the &PSVI; the item has
      <olist>
       <item>
        <p>a <xpropref>schema normalized value</xpropref> property, whose value is
the &r-value; of the item;</p>
       </item>
       <item>
        <p>properties as described above under clauses 1.2.1 or 1.3.1 based on the <termref def="simple-ur-type-itself">simple ur-type definition</termref>.</p>
       </item>
      </olist>
     </p>   
    </constraintnote>
    <constraintnote id="cvc-assess-attr" type="cvc">
     <head>Schema-Validity Assessment (Attribute)</head>
     <p>The schema-validity assessment of an attribute information item depends
on its <termref def="key-vn">validation</termref> alone.</p>
  <p>An attribute information item's schema-validity has been assessed if
      <olist>
       <item>
        <p>
      <olist>
       <item>
        <p>A non-<termref def="key-null">absent</termref> attribution declaration is known for it, either because its <termref def="key-dd">context-dependent declaration</termref> has been established or 
because its <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> and <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref> resolve to an attribute declaration as defined by <specref ref="cvc-resolve-instance"/>;</p>
       </item>
       <item>
        <p>Its <termref def="key-vn">validity</termref> with respect to that
declaration has been evaluated as per <specref ref="cvc-attribute"/></p>
       </item>
       <item>
        <p>clause 1.1 of <specref ref="cvc-attribute"/> was satisfied.</p>
       </item>
      </olist></p>
        <p><termdef id="key-svaa" term="strictly assessed">If the above holds, the attribute information item has been <term>strictly assessed</term>.</termdef></p>
       </item>
      </olist>
     </p>     
    </constraintnote>
    <constraintnote id="sic-a-outcome" type="sic">
     <head>Assessment Outcome (Attribute)</head>
     <p>If the schema-validity of an element information item has been assessed
as per <specref ref="cvc-assess-attr"/>, then in the &PSVI; it has properties as follows:
      <glist>
       <gitem>
        <label><xpropref>validation context</xpropref></label>
        <def><p>the nearest ancestor element information item with a <xpropref>schema
information</xpropref> property.</p></def>
       </gitem>
       <gitem>
        <label><xpropref>validity</xpropref></label>
        <def>
         <olist>
       <item>
        <p>If it was <termref def="key-svaa">strictly assessed</termref>, then if
        it was
<termref def="key-vn">valid</termref> as defined by <specref ref="cvc-attribute"/>
           then <pt>valid</pt>, otherwise <pt>invalid.</pt>
        </p>
       </item>
       <item>
        <p>otherwise <pt>notKnown</pt></p>
       </item>
      </olist>
        </def>
       </gitem>
       <gitem>
        <label><xpropref>validation attempted</xpropref></label>
        <def><olist>
       <item>
        <p>If it was <termref def="key-svaa">strictly assessed</termref> then <pt>full</pt></p>
       </item>
       <item>
        <p>otherwise <pt>none</pt></p>
       </item>
      </olist></def>
       </gitem>
      </glist>   
      </p>
    </constraintnote>
   </div2>
   <div2 id="Element_Declaration_details">
    <head>Element Declaration Details</head>
       <p>Element declarations provide for:</p>
    <ulist>
     <item><p>Establishing the local validity of element information items.</p></item>
     <item><p>Determining schema information set contributions, such as
normalized and/or 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 substitution groups</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">absent</termref> or
a namespace URI, as defined in <bibref ref="ref-xml-namespaces"/>.</propdef>
      <propdef id="type_definition" name="type definition">Either a simple type
definition or a complex type definition.</propdef>
      <propdef id="e-scope" name="scope">Optional.  Either <pt>global</pt> or a complex type
definition.</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="nullable" name="nullable">A boolean</propdef>
      <propdef id="&constraint;_definitions" name="&constraint; definitions">A set
of constraint definitions.</propdef>
      <propdef id="class_exemplar" name="substitution group affiliation">Optional.  A global
element definition.</propdef>
      <propdef id="e-final" name="substitution group exclusions">A subset of
{<pt>extension</pt>,
<pt>restriction</pt>}.</propdef>
      <propdef id="e-exact" name="disallowed substitutions">A subset of {<pt>substitution</pt>, <pt>extension</pt>,
<pt>restriction</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 element information items being <termref def="key-vn">validated</termref>.</p>
<p>A <propref ref="e-scope"/> of <pt>global</pt> identifies element declarations available for use in content
models throughout the schema.  Locally scoped declarations are available for use only within the
complex type identified by the <propref ref="e-scope"/> property.  This property is <termref def="key-null">absent</termref> in the case of  declarations within named model groups:  their scope will be determined when they are used in the construction of complex type definitions.</p>
    <p>A non-<termref def="key-null">absent</termref> value of the <propref ref="e-target_namespace"/> property provides for <termref def="key-vn">validation</termref> of
namespace-qualified element information items.  <termref def="key-null">Absent</termref> values of
<propref ref="e-target_namespace"/> <termref def="key-vn">validate</termref> unqualified items.</p>
<p>An element information item is <termref def="key-vn">valid</termref>
if it satisfies the <propref ref="type_definition"/>.  For such an
item, schema information set contributions appropriate to the <propref ref="type_definition"/> are added to the
corresponding element information item in the &PSVI;.
</p>
<p>If <propref ref="nullable"/> is <pt>true</pt>, then an element may
also be <termref def="key-vn">valid</termref> if it
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>http://www.w3.org/2000/10/XMLSchema-instance</code> and value <code>true</code> (see <specref ref="xsi_null"/>) even if it has
no text or element content despite a <propref ref="content_type"/> which would
otherwise require content. Formal details of element <termref def="key-vn">validation</termref> 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 <termref def="key-vn">validated</termref> is empty, then the supplied
constraint string becomes the <xpropref>schema normalized value</xpropref> of the <termref def="key-vn">validated</termref> element in the &PSVI;.  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 substitution group, if any, identified
by <propref ref="class_exemplar"/>.  Membership is transitive but not symmetric;  an element
declaration is a member of any group of which its <propref ref="class_exemplar"/> is a member.</p>
<p>An empty <propref ref="e-final"/> allows a declaration to be nominated as
the <propref ref="class_exemplar"/> of other element declarations having the same <propref ref="type_definition"/> or
types derived therefrom.  The explicit
values of <propref ref="e-final"/> rule out element declarations having types which
are <pt>extension</pt>s or <pt>restriction</pt>s respectively of <propref ref="type_definition"/>.  If
both values are specified, then the declaration may not be nominated as the
<propref ref="class_exemplar"/> of any other 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
<termref def="key-vn">validating</termref> elements (a) with an <specref ref="xsi_type"/> that identifies an
<pt>extension</pt> or <pt>restriction</pt> of the type of the declared element, and/or (b) from <termref def="key-vn">validating</termref> elements which are in the
substitution group headed by the declared element.
If <propref ref="e-exact"/> is empty, then all derived types and substitution group members are allowed.</p>
<p>Element declarations for which <propref ref="e-abstract"/> is <pt>true</pt> can appear in
content models only when substitution is allowed;
such declarations may not themselves ever be used to <termref def="key-vn">validate</termref> 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 Locally Valid (Element)</head>
     <p>An element information item is locally <termref def="key-vn">valid</termref> with respect to an
element declaration if
      <olist>
       <item>
        <p>The declaration is non-<termref def="key-null">absent</termref>;</p>
       </item>
      </olist>
      and
      <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>http://www.w3.org/2000/10/XMLSchema-instance</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>http://www.w3.org/2000/10/XMLSchema-instance</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
<termref def="key-vn">valid</termref> with respect to the built-in <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#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="cvc-resolve-instance"/> -- <termdef id="key-ltd" term="local type definition">call this type definition the <term>local type definition</term></termdef>;</p></item>
       <item>
        <p>The <termref def="key-ltd">local type definition</termref> is
validly derived from the <propref ref="type_definition"/> given the
<propref ref="e-exact"/>, as defined in <specref ref="cos-ct-derived-ok"/> (if it is a complex type definition), or as defined in <specref ref="cos-st-derived-ok"/> (if it is a simple 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.2 has not obtained
      <olist>
       <item>
        <p>If the element information item has an empty &i-value; and the <termref def="key-atd">actual type definition</termref> is a <termref def="key-ltd">local type
definition</termref>, either
         <olist>
          <item>
           <p>the <termref def="key-atd">actual
type definition</termref> or its <propref ref="content_type"/> is a simple type
definition, in which case the <propref ref="e-value_constraint"/> string must be <termref def="key-vn">valid</termref> 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 by its
<propref ref="content_type"/> (if that is a simple type definition)</p>
          </item>
         </olist>
 or else 
        <olist>
         <item>
          <p>if the <termref def="key-atd">actual
type definition</termref> is a complex type definition whose <propref ref="content_type"/> is not a simple type definition, the <propref ref="e-value_constraint"/> 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>
        </olist></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 &i-value; 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 a non-empty &i-value; or
there is no <propref ref="e-value_constraint"/>)
      <olist>
       <item>
       <p>the element information item
must be <termref def="key-vn">valid</termref> with respect to the <termref def="key-atd">actual type definition</termref> as defined by <specref ref="cvc-type"/></p>
       </item>
       <item>
        <p>The element information item must be <termref def="key-vn">valid</termref> with respect to
each of the <propref ref="&constraint;_definitions"/> as per <specref ref="cvc-&constraint;"/>.</p>
       </item>
      </olist>
     </p>
    </constraintnote>
    <constraintnote type="sic" id="sic-elt-error-code">
     <head>Validation Failure (Element)</head>
     <p>If the local <termref def="key-vn">validity</termref>, as defined by <specref ref="cvc-elt"/>
above, of an element information item has been assessed,
in the &PSVI; the item has a
list-valued <xpropref>schema error code</xpropref>
property.  If the item is not <termref def="key-vn">valid</termref>, applications wishing to provide
information as to the reason(s) for this are encouraged to record one or more
error codes (see <specref ref="outcomes"/> therein.</p>
    </constraintnote>
    <ednote role="pf">
     <edtext>The Working Group solicits feedback from implementors and users
on the extent to which the xsi:null feature provides useful functionality and
satisfactorily addresses requirements in the area of data interchange.</edtext>
    </ednote>
    <note><p>The <propref ref="e-name"/> and <propref ref="e-target_namespace"/> properties are not
mentioned above because they are checked during particle <termref def="key-vn">validation</termref>, as per
<specref ref="cvc-particle"/>.</p></note>
    <constraintnote type="sic" id="sic-elt-decl">
     <head>Element Declaration</head>
     <p>If an element information item is <termref def="key-vn">valid</termref> with respect to an element
declaration as per <specref ref="cvc-elt"/> then in the &PSVI; the element
information item has a either
     <olist>
     <item>
      <p>a single <xpropref>element declaration</xpropref> property,
containing an <termref def="key-iso">item isomorphic to the declaration component</termref> itself.</p>
     </item>
     </olist>
      or
     <olist>
      <item>
       <p>a <xpropref>null</xpropref> property, with value <pt>true</pt> if clause 1.2.2 of <specref ref="cvc-elt"/> above obtains,
otherwise <pt>false</pt>.</p>
      </item>
     </olist>.</p>
    </constraintnote>
    <constraintnote type="sic" id="sic-eltDefault">
     <head>Element Default Value</head>
     <p>If an element information item is <termref def="key-vn">valid</termref> with respect to an element
declaration as per <specref ref="cvc-elt"/> and the <propref ref="e-value_constraint"/> is present, but clause 1.2.2
of <specref ref="cvc-elt"/> above does not obtain and the element
information item has no element or character information item &i-children;, the &PSVI; has the <propref ref="e-value_constraint"/>'s string as the
item's <xpropref>schema normalized value</xpropref> property and its
<xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">specified</xpropref> is set to <pt>schema</pt>.  Otherwise, the item's
<xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">specified</xpropref> is set to <pt>instance</pt>.</p>
    </constraintnote>
    <constraintnote type="cvc" id="cvc-type">
     <head>Element Locally Valid (Type)</head>
     <p>An element information item is locally <termref def="key-vn">valid</termref> with respect to a type definition if
      <olist>
       <item>
        <p>The type definition is non-<termref def="key-null">absent</termref>;</p>
       </item>
       <item> 
     <p>If the type definition 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>http://www.w3.org/2000/10/XMLSchema-instance</code> and whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> is one of <code>type</code>, <code>null</code>, <code>schemaLocation</code> or <code>noNamespaceSchemaLocation</code>;</p></item>
       <item>
        <p>The element information item must have no element information item &i-children;;</p>
       </item>
       <item>
        <p>the &i-value; must be <termref def="key-vn">valid</termref> with respect to the type definition as defined by <specref ref="cvc-simple-type"/>
        </p>
       </item>
      </olist>
otherwise (the type definition is a complex type definition)
      <olist>
       <item>
        <p>The element information item must be <termref def="key-vn">valid</termref> with respect to the type definition as per <specref ref="cvc-complex-type"/>;</p>
       </item>
      </olist>
     </p>
       </item>
      </olist>
     </p>
    </constraintnote>
    <constraintnote type="sic" id="sic-eltType">
     <head>Element Validated by Type</head>
     <p>If an element information item is <termref def="key-vn">valid</termref> with respect to a <termref def="key-typeDefn">type definition</termref>
as per <specref ref="cvc-type"/>, in the &PSVI; the item has 
      <olist>
 <item>
  <p>a <xpropref>schema normalized value</xpropref> property, whose value is
the &i-value; of the item as <termref def="key-vn">validated</termref>
(provided clause 1.2.1.3 of <specref ref="cvc-type"/> has applied, and <specref ref="sic-eltDefault"/> above has <emph>not</emph> applied);</p>
 </item>
</olist>
      and either
      <olist>
       <item>
       <p>a single <xpropref>type definition</xpropref> property,
containing an <termref def="key-iso">item isomorphic</termref> to the <termref def="key-typeDefn">type definition</termref> component itself.</p></item>
       <item>
        <p>if the <termref def="key-typeDefn">type definition</termref> has a
simple type definition <propref ref="content_type"/>, and that type
definition has <propref ref="variety"/> <pt>union</pt>, then additionally there
is a <xpropref>member type definition</xpropref> property, containing an
<termref def="key-iso">item isomorphic to that member</termref> of the <propref ref="st-member_type_definitions"/> which actually <termref def="key-vn">validated</termref> the element item's &i-value;.</p>
       </item>
      </olist> 
      or
      <olist>
      <item>
       <p>four properties as follows:
      <glist>
       <gitem>
        <label><xpropref>type definition type</xpropref></label>
        <def>
         <p><pt>simple</pt> or <pt>complex</pt>, depending on the type definition</p>
        </def>
       </gitem>
       <gitem>
        <label><xpropref>type definition namespace</xpropref></label>
        <def>
         <p>the <B>{target namespace}</B> of the type definition</p>
        </def>
       </gitem>
       <gitem>
        <label><xpropref>type definition anonymous</xpropref></label>
        <def>
         <p><pt>true</pt> if the <B>{name}</B> of the type definition is <termref def="key-null">absent</termref>, otherwise <pt>false</pt></p>
        </def>
       </gitem>
       <gitem>
        <label><xpropref>type definition name</xpropref></label>
        <def>
         <p>the <B>{name}</B> of the type definition, if it is not <termref def="key-null">absent</termref>.  If it is
<termref def="key-null">absent</termref>, schema processors may, but need not,
provide a value unique to the definition.</p>
        </def>
       </gitem>
      </glist>
       </p>
      </item>
       <item>
        <p>if the type definition has a
simple type definition <propref ref="content_type"/>, and that type
definition has <propref ref="variety"/> <pt>union</pt>, then calling
         <termdef id="key-amt" term="actual member type definition"> that
member of the <propref ref="st-member_type_definitions"/> which actually
<termref def="key-vn">validated</termref> the element item's &i-value; the
<term>actual member type definition</term></termdef>, there are three additional properties:
         <glist>
          <gitem>
        <label><xpropref>member type definition namespace</xpropref></label>
        <def>
         <p>the <B>{target namespace}</B> of the <termref def="key-amt">actual
member type definition</termref></p>
        </def>
       </gitem>
       <gitem>
        <label><xpropref>member type definition anonymous</xpropref></label>
        <def>
         <p><pt>true</pt> if the <B>{name}</B> of the <termref def="key-amt">actual member type definition</termref> is <termref def="key-null">absent</termref>, otherwise <pt>false</pt></p>
        </def>
       </gitem>
       <gitem>
        <label><xpropref>member type definition name</xpropref></label>
        <def>
         <p>the <B>{name}</B> of the <termref def="key-amt">actual member type definition</termref>, if it is not <termref def="key-null">absent</termref>.  If it is
<termref def="key-null">absent</termref>, schema processors may, but need not,
provide a value unique to the definition.</p>
        </def>
       </gitem>
         </glist>
        </p>
       </item>
      </olist>
     </p>
     <p>The first alternative above is provided for applications such as query
processors which need access to the full range of details about an item's
<termref def="key-va">assessment</termref>, for example the type hierarchy; the second, for lighter-weight
processors for whom representing the significant parts of the type hierarchy as
information items might be a significant burden.</p>
     <p>Also, if the declaration has a <propref ref="e-value_constraint"/>, the item's
<xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">schema default</xpropref> property is set to that <propref ref="e-value_constraint"/>'s string.</p>
     <p>Note that if an element is <termref def="key-lva">laxly assessed</termref>, the information described above under 1.2.1 or 1.3.1 above is provided with
respect to the <termref def="ur-type-itself">ur-type definition</termref>.</p>
    </constraintnote>
    <constraintnote id="cvc-assess-elt" type="cvc">
     <head>Schema-Validity Assessment (Element)</head>
     <p>The schema-validity assessment of an element information item depends
on its <termref def="key-vn">validation</termref> and the <termref def="key-va">assessment</termref> of its element information item
children and associated attribute information items, if any.</p>
  <p>During <termref def="key-vn">validation</termref>, associations
between element and attribute information items among the &i-children;
and &i-attributes; on the one hand, and element and attribute
declarations on the other, are established as a side-effect.  <termdef id="key-dd" term="context-dependent declaration">We call such
declarations <term>context-dependent declarations</term>.</termdef></p>
  <p>So an element information item's schema-validity has been assessed if
      <olist>
       <item>
        <p>
      <olist>
       <item>
        <p>A non-<termref def="key-null">absent</termref> element declaration is known for it, either by processor
stipulation (see <specref ref="validation_outcome"/>) or because its <termref def="key-dd">context-dependent declaration</termref> has been established or 
because its <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> resolve to an element declaration as defined by <specref ref="cvc-resolve-instance"/>;</p>
       </item>
       <item>
        <p>Its <termref def="key-vn">validity</termref> with respect to that
declaration has been evaluated as per <specref ref="cvc-elt"/></p>
       </item>
       <item>
        <p>If that evaluation involved the evaluation of <specref ref="cvc-type"/>, clause 1.1 thereof was satisfied.</p>
       </item>
      </olist>
      or
      <olist>
       <item>
        <p>A non-<termref def="key-null">absent</termref> type definition is known for it, either by processor stipulation
(see <specref ref="validation_outcome"/>) or because 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>http://www.w3.org/2000/10/XMLSchema-instance</code> and whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> is <code>type</code>, and
      <olist>
       <item>
        <p>The &i-value; of that attribute information item is
<termref def="key-vn">valid</termref> with respect to the built-in <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#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="cvc-resolve-instance"/> -- <termdef id="key-ltd1" term="item type definition">call this type definition the <term>local type definition</term></termdef>;</p></item>
       <item>
        <p>If there is a processor-stipulated type definition, the <termref def="key-ltd1">local type definition</termref> must be
validly derived from that type definition given the empty set, as defined in <specref ref="cos-ct-derived-ok"/> (if it is a complex type definition), or as defined in <specref ref="cos-st-derived-ok"/> (if it is a simple type definition).</p>
       </item>
      </olist>
        </p>
       </item>
       <item>
        <p>The element information item's <termref def="key-vn">validity</termref> with respect to the <termref def="key-ltd1">local type definition</termref> (if present and validly derived)
or the processor-stipulated type definition (if no <termref def="key-ltd1">local
type definition</termref> is present) has been evaluated as per <specref ref="cvc-type"/>.</p>
       </item>
      </olist></p>
        <p><termdef id="key-sva" term="strictly assessed">If either of the above cases hold, the element information item has been <term>strictly assessed</term>.</termdef></p>
     <p>If the item cannot be <termref def="key-sva">strictly
assessed</termref>, because neither clause 1.1.1 nor 1.1.2 above are satisfied,
<termdef id="key-lva" term="laxly assessed">an element information item's
schema validity may be <term>laxly assessed</term> if its <termref def="key-dd">context-dependent declaration</termref> is not <pt>skip</pt> by <termref def="key-vn">validating</termref> with respect to the <termref def="ur-type-itself">ur-type definition</termref> as per <specref ref="cvc-type"/></termdef>.</p>
       </item>
      </olist>
      and
      <olist>
       <item>
        <p>The schema-validity of all the element information items among its
&i-children; has been assessed as per <specref ref="cvc-assess-elt"/>, and the
schema-validity of all the attribute information items among its
&i-attributes; has been assessed as per <specref ref="cvc-assess-attr"/>.</p>
       </item>
      </olist>
     </p>     
    </constraintnote>
    <constraintnote id="sic-e-outcome" type="sic">
     <head>Assessment Outcome (Element)</head>
     <p>If the schema-validity of an element information item has been assessed
as per <specref ref="cvc-assess-elt"/>, then in the &PSVI; it has properties as follows:
      <glist>
       <gitem>
        <label><xpropref>validation context</xpropref></label>
        <def><p>the nearest ancestor element information item with a <xpropref>schema
information</xpropref> property (or this element item itself if it has such a property).</p></def>
       </gitem>
       <gitem>
        <label><xpropref>validity</xpropref></label>
        <def>
         <olist>
       <item>
        <p>If it was <termref def="key-sva">strictly assessed</termref>, then if
        <olist><item><p>clause 1.1.1 of <specref ref="cvc-assess-elt"/> applied and it was
<termref def="key-vn">valid</termref> as defined by <specref ref="cvc-elt"/> or
clause 1.1.2 of <specref ref="cvc-assess-elt"/> applied and it was
<termref def="key-vn">valid</termref> as defined by <specref ref="cvc-type"/></p></item>
            <item>
          <p>neither its &i-children; nor its
&i-attributes; contains an information item (element or attribute respectively) whose <xpropref>validity</xpropref> is <pt>invalid</pt></p>
         </item>
         <item>
          <p>neither its &i-children; nor its
&i-attributes; contains an information item (element or attribute respectively) with a <termref def="key-dd">context-dependent declaration</termref> of
<pt>mustFind</pt> whose <xpropref>validity</xpropref> is <pt>unknown</pt></p>
         </item>
        </olist>
           then <pt>valid</pt>, otherwise <pt>invalid.</pt>
        </p>
       </item>
       <item>
        <p>otherwise <pt>notKnown</pt></p>
       </item>
      </olist>
        </def>
       </gitem>
       <gitem>
        <label><xpropref>validation attempted</xpropref></label>
        <def><olist>
       <item>
        <p>If it was <termref def="key-sva">strictly assessed</termref> and neither its &i-children; nor its
&i-attributes; contains an information item (element or attribute
respectively) whose <xpropref>validation attempted</xpropref> is not
<pt>full</pt>, then <pt>full</pt></p>
       </item>
              <item>
               <p>If it was not <termref def="key-sva">strictly assessed</termref> and neither its &i-children; nor its
&i-attributes; contains an information item (element or attribute
respectively) whose <xpropref>validation attempted</xpropref> is not
<pt>none</pt>, then <pt>none</pt></p>
              </item>
       <item>
        <p>otherwise <pt>partial</pt></p>
       </item>
      </olist></def>
       </gitem>
      </glist>   
      </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 &PSVI; 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">&PSVI; 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">absent</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">
    Either <pt>extension</pt> or <pt>restriction</pt>.
   </propdef>
   <propdef id="ct-final" name="final">
    A subset of {<pt>extension</pt>, <pt>restriction</pt>}.
   </propdef>
   <propdef id="ct-abstract" name="abstract">
    A boolean
   </propdef>   <propdef id="ct-attribute_declarations" name="attribute use pairs">
    A set of pairs of a boolean and an attribute declaration.
   </propdef>
  <propdef id="ct-attribute_wildcard" name="attribute wildcard">
    Optional.  A wildcard.
   </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>}.
   </propdef>
    <propdef id="ct-annotations" name="annotations">A set of annotations.</propdef>
</proplist>

  </compdef>
<p>Complex types definitions are identified by their <propref ref="ct-name"/> and <propref ref="ct-target_namespace"/>.  Except
for anonymous complex type definitions (those with no <propref ref="ct-name"/>), since
type definitions (i.e. both simple and complex type definitions taken together) must be uniquely identified within an <termref def="key-schema">XML
Schema</termref>, no complex type definition can have the same name as another
simple or complex type definition.  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"/>).  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 <termref def="key-vn">validated</termref> 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 either of
extension or restriction; the explicit values <pt>extension</pt>, and <pt>restriction</pt> prevent further
derivations by extension and restriction 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 <termref def="key-vn">validate</termref>
element content.</p>

<p><propref ref="ct-attribute_declarations"/> are a set of <termdef id="key-aup" term="attribute use pair"><term>attribute use pair</term>s:
each is a pair of a boolean
and an individual <specref ref="Attribute_Declaration"/>
to be used for <termref def="key-vn">validation</termref> of the
&i-attributes;
of element information items, where the boolean determines whether the
attribute is required or not</termdef>.  See <specref ref="cvc-complex-type"/>
and <specref ref="cvc-attribute"/> for details of attribute <termref def="key-vn">validation</termref>.</p>
<p><propref ref="ct-attribute_wildcard"/>s provide a more flexible specification for <termref def="key-vn">validation</termref> 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">absent</termref>: &i-attributes; can
include any attribute(s) from the specified namespace(s).  If <termref def="key-null">absent</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">absent</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 <termref def="key-vn">validation</termref>. </p>
<p><propref ref="content_type"/> determines the <termref def="key-vn">validation</termref> of &i-children; of element information items.  Informally:
<ulist>
<item>
<p>A <propref ref="content_type"/> with the distinguished value <pt>empty</pt> <termref def="key-vn">validates</termref> 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"/> <termref def="key-vn">validates</termref>
elements with character-only &i-children;.</p>
</item>
<item>
<p>An <pt>element-only</pt> <propref ref="content_type"/> <termref def="key-vn">validates</termref> 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"/> <termref def="key-vn">validates</termref> 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
<termref def="key-vn">validating</termref> element items with an <specref ref="xsi_type"/> attribute that
identifies an <pt>extension</pt> or <pt>restriction</pt>, or element items in
a substitution group whose type definition is similarly derived:
If <propref ref="ct-exact"/> is empty,
then all such substitutions are allowed, otherwise, the derivation method(s) it
names are disallowed.
</p>
<p>See <specref ref="cvc-complex-type"/>
for a formal specification of element content <termref def="key-vn">validation</termref>.</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 Locally Valid (Complex Type)</head>
     <p>An element information item is locally <termref def="key-vn">valid</termref> 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 &i-value; of the element information item is <termref def="key-vn">valid</termref> 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 <termref def="key-vn">valid</termref> 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-attributes; excepting those whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref> is identical to <code>http://www.w3.org/2000/10/XMLSchema-instance</code> and whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">local name</xpropref> is one of <code>type</code>, <code>null</code>, <code>schemaLocation</code> or <code>noNamespaceSchemaLocation</code>,
         either
         <olist>
          <item>
           <p>there is among the <propref ref="ct-attribute_declarations"/> an <termref def="key-aup">attribute use pair</termref> with an attribute declaration 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> (where an <termref def="key-null">absent</termref> <propref ref="a-target_namespace"/> is taken to be identical to a <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref> with no value).</p>
           <p>In this case that attribute declaration is the <termref def="key-dd">context-determined declaration</termref> for the attribute information item with respect to <specref ref="cvc-assess-attr"/> and <specref ref="sic-a-outcome"/>.</p>
          </item>
         </olist>
or
         <olist>
          <item>
           <p>there is an <propref ref="ct-attribute_wildcard"/> and
            the
attribute information item is <termref def="key-vn">valid</termref> with respect to it as defined in <specref ref="cvc-wildcard"/>
           </p>
          </item>
         </olist>
        </p>
       </item>
       <item>
        <p>The attribute declaration of each <termref def="key-aup">attribute use pair</termref> in the <propref ref="ct-attribute_declarations"/> whose
boolean is <pt>true</pt> matches one of the attribute information items in the element information item's &i-attributes; as per clause 3 above.</p>
       </item>
      </olist>
     </p>
    </constraintnote>
    <constraintnote type="sic" id="sic-attrDefault">
     <head>Attribute Default Value</head>
     <p>For each <termref def="key-aup">attribute use pair</termref> in the <propref ref="ct-attribute_declarations"/> whose
boolean is <pt>false</pt> and whose attribute declaration has a <propref ref="a-value_constraint"/> and does not match one of the attribute information items in the element information item's &i-attributes; as per clause 1.3 of <specref ref="cvc-complex-type"/> above, the &PSVI; 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 <xpropref>schema normalized value</xpropref> is the declaration's <propref ref="a-value_constraint"/> string, added to the
&i-attributes; of the element information item.  Furthermore, the item's
<xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">specified</xpropref> is set to <pt>schema</pt>.</p>
    </constraintnote>
    <constraintnote type="sic" id="sic-ct-error-code">
     <head>Validation Failure (Complex Type)</head>
     <p>If the local <termref def="key-vn">validity</termref>, as defined by <specref ref="cvc-complex-type"/>
above, of an element information item has been assessed,
in the &PSVI; the item has a
list-valued <xpropref>schema error code</xpropref>
property.  If the item is not <termref def="key-vn">valid</termref>, applications wishing to provide
information as to the reason(s) for this are encouraged to record one or more
error codes (see <specref ref="outcomes"/> therein.</p>
    </constraintnote>
<p>There is a complex type definition nearly equivalent to the <termref def="key-urType">ur-type definition</termref> present in every
schema by definition.  It has the following properties:</p>
    <schemaComp id="ur-type-itself">
     <head>Complex Type Definition of the Ur-Type</head>
     <pvlist>
      <pvpair ref="ct-name">anyType</pvpair>
      <pvpair ref="ct-target_namespace">http://www.w3.org/2000/10/XMLSchema</pvpair>
      <pvpair ref="ct-base_type_definition">Itself</pvpair>
      <pvpair ref="derivation_method"><pt>restriction</pt></pvpair>
      <pvpair ref="content_type">A pair consisting of <pt>mixed</pt> and a
<termref def="Particle_details">particle</termref> with the following properties: 
       <pvlist>
        <pvpair ref="p-min_occurs">1</pvpair>
        <pvpair ref="p-max_occurs">1</pvpair>
        <pvpair ref="term">a <termref def="Model_Group_details">model group</termref> with
the following properties:
         <pvlist>
          <pvpair ref="compositor"><pt>sequence</pt></pvpair>
          <pvpair ref="particles">
           a list containing one <termref def="Particle_details">particle</termref> with the following properties:
           <pvlist>
            <pvpair ref="p-min_occurs">0</pvpair>
            <pvpair ref="p-max_occurs">unbounded</pvpair>
            <pvpair ref="term">a <termref def="Wildcard_details">wildcard</termref> with an <pt>any</pt>
<propref ref="namespace_constraint"/></pvpair>
           </pvlist>
           </pvpair>
         </pvlist>
        </pvpair>
       </pvlist>
      </pvpair>
      <pvpair ref="ct-attribute_declarations">The empty set</pvpair>
        <pvpair ref="ct-attribute_wildcard">
        <propref ref="namespace_constraint"/> is <pt>any</pt></pvpair>
        <pvpair ref="ct-final">The empty set</pvpair>
        <pvpair ref="ct-exact">The empty set</pvpair>
        <pvpair ref="ct-abstract">false</pvpair>
     </pvlist>
    </schemaComp>
    <p>The <code>mixed</code> content specification together with the
unconstrained wildcard content model and attribute specification produce the defining property for the
<termref def="key-urType">ur-type definition</termref>, namely that <emph>every</emph> complex type
definition is (eventually) a restriction
of the <termref def="key-urType">ur-type definition</termref>: 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 <termref def="key-vn">validation</termref> 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.  Thus, attribute group definitions provide a
replacement for some uses of XML's
<xspecref href="http://www.w3.org/TR/REC-xml#dt-PE">parameter entity</xspecref> facility.
Attribute group definitions are provided primarily for reference from the <specref ref="declare"/>
(see <eltref ref="complexType"/> and <eltref ref="attributeGroup" inside="simpleContent"/>).
</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">absent</termref> or a namespace URI, as defined in <bibref ref="ref-xml-namespaces"/>.
   </propdef>
  <propdef id="ag-attribute_declarations" name="attribute use pairs">
    A set of pairs of a boolean and an attribute declaration.
   </propdef>
  <propdef id="ag-attribute_wildcard" name="attribute wildcard">
    Optional.  A wildcard.
   </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 <termref def="key-aup">attribute use pair</termref>s,
that is, a set of pairs of a boolean and an attribute declaration specifically identified as
members of the attribute group, where the boolean determines whether the
corresponding attribute is required or not.</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 <termref def="key-vn">validation</termref>.</p>
<p>See <specref ref="cvc-complex-type"/> and <specref ref="cvc-wildcard"/> for formal
details of attribute wildcard <termref def="key-vn">validation</termref>.
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
<xspecref href="http://www.w3.org/TR/REC-xml#dt-PE">parameter entity</xspecref> facility.
</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">absent</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 <emph>per se</emph> do not participate in <termref def="key-vn">validation</termref>, 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>specifies a sequential (<pt>sequence</pt>),
disjunctive (<pt>choice</pt>) or conjunctive (<pt>all</pt>) interpretation of
the <propref ref="particles"/>.  This in turn 
determines whether the element
information item &i-children; <termref def="key-vn">validated</termref> 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 <propref ref="p-min_occurs"/><code>=0</code> or
<code>1</code>, <propref ref="p-max_occurs"/><code>=1</code>) contain exactly zero or one of each element specified in <propref ref="particles"/>.  The elements can occur in any order.</p>
</item>
</ulist></p>
    <p>When two or more particles contained directly or indirectly in the <propref ref="particles"/> of a model group have identical
element declarations as their 
<propref ref="term"/>, the type definitions of those declarations must be the
same.  By 'indirectly' is meant particles within the <propref ref="particles"/>
of a group which is itself the <propref ref="term"/> of a directly contained
particle, and so on recursively.</p>
<p>See <specref ref="Annotation_details"/> for the significance of the <propref ref="amg-annotation"/> property.</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
locally <termref def="key-vn">valid</termref> 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 <termref def="key-vn">valid</termref>
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
<termref def="key-vn">valid</termref> 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 <termref def="key-vn">valid</termref> 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 <termref def="key-vn">valid</termref>
with respect to such a group whose <propref ref="compositor"/> is
<pt>choice</pt>, the empty sequence <emph>is</emph> <termref def="key-vn">valid</termref> 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 than would arise from a literal interpretation of the definition above; informally, the content is <termref def="key-vn">valid</termref> when each declared element occurs exactly once (or at most once, if <propref ref="p-min_occurs"/> is <code>0</code>), and each is <termref def="key-vn">valid</termref> with respect to its corresponding declaration.  The elements can occur in arbitrary order.</p>
    </note>
<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>unbounded</pt></propdef>
    <propdef id="term" name="term">One of a model group, a wildcard, or an  element declaration.</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 <termref def="key-vn">validated</termref> with respect to a single particle. <propref ref="p-min_occurs"/> determines the minimum number of such element &i-children; that can 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>unbounded</pt>, then there is no
upper bound on the number of such children.</p>
<constraintnote type="cvc" id="cvc-particle">
 <head>Element Sequence Locally Valid (Particle)</head>
 <p>A sequence (possibly empty) of element information items is
locally <termref def="key-vn">valid</termref>
with respect to a particle if either
  <olist>
   <item>
    <p>The length of the sequence is greater than or equal to the <propref ref="p-min_occurs"/>;</p>
   </item>
   <item>
    <p>If <propref ref="p-max_occurs"/> is a number, 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 wildcard and each element
information item in the sequence is <termref def="key-vn">valid</termref> with respect to the wildcard as defined by <specref ref="cvc-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="e-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"/> (where an <termref def="key-null">absent</termref> <propref ref="e-target_namespace"/> is taken to be identical to a <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">namespace URI</xpropref> with no value) and 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"/>.<olist>
          <item>
           <p>In this case the element declaration is the <termref def="key-dd">context-determined declaration</termref> for the element information item with respect to <specref ref="cvc-assess-elt"/> and <specref ref="sic-e-outcome"/>.</p>
          </item>
         </olist></p>
         </item>
        </olist>
        or
        <olist>
         <item>
          <p>the element declaration is global (i.e. its
<propref ref="e-scope"/> is <pt>global</pt>), <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"/> (where an <termref def="key-null">absent</termref> <propref ref="e-target_namespace"/> is taken to be identical to a <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">namespace URI</xpropref> with no value) and 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"/>. <olist>
          <item>
           <p>In this case the element declaration is the <termref def="key-dd">context-determined declaration</termref> for the element information item with respect to <specref ref="cvc-assess-elt"/> and <specref ref="sic-e-outcome"/>.</p>
          </item>
         </olist></p>
         </item>
        </olist>
        or
        <olist>
         <item>
          <p>the element declaration is global (i.e. its
<propref ref="e-scope"/> is <pt>global</pt>), its <propref ref="e-exact"/> does not contain <pt>substitution</pt>,
the <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">local
</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 declaration, as
defined in <specref ref="cvc-resolve-instance"/> -- <termdef id="key-eqd" term="head declaration">call this declaration the <term>substituting declaration</term></termdef> and the <termref def="key-eqd">substituting declaration</termref> together with the particle's element declaration's <propref ref="e-exact"/> is validly substitutable for the particle's element declaration as defined in <specref ref="cos-equiv-derived-ok-rec"/>. <olist>
          <item>
           <p>In this case the <termref def="key-eqd">substituting declaration</termref> is the <termref def="key-dd">context-determined declaration</termref> for the element information item with respect to <specref ref="cvc-assess-elt"/> and <specref ref="sic-e-outcome"/>.</p>
          </item>
         </olist></p>
         </item>
        </olist>
       </p>
      </item>
    </olist>
    </p>
   </item>
  </olist>
  or
  <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 <code>n</code> sub-sequences such that <code>n</code> is greater than or equal to <propref ref="p-min_occurs"/> and, if <propref ref="p-max_occurs"/> is a number, less than or equal to <propref ref="p-max_occurs"/> and each sub-sequence is <termref def="key-vn">valid</termref> with respect to that model group as defined in <specref ref="cvc-model-group"/>;</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>In order to exploit the full potential for extensibility offered by XML
plus namespaces, more provision is needed than DTDs allow for targeted flexibility in content
models and attribute declarations.  A wildcard provides for <termref def="key-vn">validation</termref> of
attribute and 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">absent</termref>; or a set whose
members are either namespace URIs or <termref def="key-null">absent</termref>.
   </propdef>
    <propdef name="process contents" id="process_contents">One of <pt>skip</pt>, <pt>lax</pt> or <pt>strict</pt></propdef>
    <propdef id="w-annotation" name="annotation">Optional.  An annotation</propdef>
</proplist>
 </compdef>
<p><propref ref="namespace_constraint"/> provides for <termref def="key-vn">validation</termref> of elements that:
<olist>
<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">absent</termref>) are namespace qualified;</p>
</item>
<item>
<p>(a set whose
members are either namespace URIs or <termref def="key-null">absent</termref>) have any of the
specified namespaces and/or, if <termref def="key-null">absent</termref> is included in the set, are unqualified.</p>
</item>
</olist></p>
    <p><propref ref="process_contents"/> controls the impact on <termref def="key-va">assessment</termref>
of the information items allowed by wildcards, as follows:
     <glist>
      <gitem>
       <label>strict</label>
       <def>
        <p>There must be a global declaration for the item available, or it
must have an <code>xsi:type</code>, and it
must be <termref def="key-vn">valid</termref> as appropriate.</p>
       </def>
      </gitem>
      <gitem>
       <label>skip</label>
       <def>
        <p>No constraints at all:  the item must simply be well-formed XML.</p>
       </def>
      </gitem>
      <gitem>
       <label>lax</label>
       <def>
        <p>If the item, or any items among its &i-children; if it's an element
information item, has a uniquely
determined declaration available, it must be <termref def="key-vn">valid</termref> with respect to
that definition, that is, <termref def="key-vn">validate</termref> where you can, don't worry when you can't.</p>
       </def>
      </gitem>
     </glist>
    </p>
    <constraintnote type="cvc" id="cvc-wildcard">
     <head>Item Valid (Wildcard)</head>
     <p>An element or attribute information item is locally <termref def="key-vn">valid</termref> with respect to a wildcard
constraint if
      <olist>
       <item>
        <p>its <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">namespace URI</xpropref> is <termref def="key-vn">valid</termref> with respect to the wildcard constraint, as defined in <specref ref="cvc-wildcard-namespace"/>;</p>
       </item>
      </olist>
     </p>
     <p>When this constraint applies, the item has no <termref def="key-dd">context-determined declaration</termref> with respect to <specref ref="sic-e-outcome"/>, <specref ref="cvc-assess-elt"/> and <specref ref="cvc-assess-attr"/> if <propref ref="process_contents"/> is <pt>lax</pt>, but if <propref ref="process_contents"/> is <pt>strict</pt>, its <termref def="key-dd">context-determined declaration</termref> is <pt>mustFind</pt> and if <pt>skip</pt>, its <termref def="key-dd">context-determined declaration</termref> is <pt>skip</pt>.</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">absent</termref> is <termref def="key-vn">valid</termref> with respect to a wildcard constraint (the
value of a <propref ref="namespace_constraint"/>) 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">absent</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.  An &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 expression(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 expression(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.  Each constraint declaration has a name, which exists in a
single symbol space for constraints.  The equality and inequality conditions
appealed to in checking these constraints applies to the <emph>value</emph> of
the fields selected, so that for example <code>3.0</code> and <code>3</code>
would be conflicting keys if they were both decimal, but non-conflicting if
they were both strings, or one was a string and one a decimal.</p>
    <p>Overall the augmentations to XML's <code>ID/IDREF</code> mechanism are:</p>
    <ulist>
     <item>
<p>Functioning as a part of an &constraint; is in addition to, not instead of,
having a type;</p>
     </item>
     <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>&Constraint;s 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.</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.
     </p>
 <note>
      <p>Provision for multi-field keys etc. goes beyond what is supported by <code>xsl:key</code>.</p>
     </note>
 <note>
     <p>If reference to a key or unique defined in a scoping element which may
occur more than once is envisaged (which reference may be from outside any of
the scoping elements), then the scoping elements themselves must
have keys (typically unique across the entire document), and the scoped keys must include the
key of their scoping element among their fields.</p>
    </note>

<p>A formal description of &Constraint; definition <termref def="key-vn">validation</termref> 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 locally <termref def="key-vn">valid</termref> with respect to an &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 among the descendants of the context 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, as defined in <bibref ref="ref-xsp2"/>;</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>
    <item>
     <p>No element member of the <termref def="key-ks">key-sequence</termref> of any
member of the <termref def="key-qns">qualified node
set</termref> was assessed as <termref def="key-vn">valid</termref> by reference to an element
declaration whose <propref ref="nullable"/> is <pt>true</pt>.</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 <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) and
there must be an entry in that table 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>
   </olist>
  </p>
 </constraintnote>
 <note>
  <p>Although this specification defines a &PSVI;
contribution which would enable schema-aware processors to implement clause
2.2.4 above (<specref ref="sic-elt-decl"/>), processors are not required to
provide it.  This clause can be read as if in the absence of this infoset contribution, the
value of the relevant <propref ref="nullable"/> property must be available.</p>
 </note>
 <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-4] 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 an
<xpropref>&constraint; table</xpropref> property whose value has 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 &constraint;s</termref>, in the &PSVI; that element information item has an
<xpropref>&constraint; table</xpropref> property, containing one
<B>&Constraint; Binding</B>
information item for each <termref def="key-ec">eligible &constraint;</termref>, with
properties as follows
   <glist>
    <gitem>
     <label><xpropref>definition</xpropref></label>
     <def>
      <p>the <termref def="key-ec">eligible &constraint;</termref></p>
     </def>
    </gitem>
    <gitem>
     <label><xpropref>node table</xpropref></label>
     <def>
<p>a <termref def="key-nt">node table</termref> with one entry for every
<termref def="key-ks">key-sequence</termref> (call it <B>k</B>) and node (call it <B>n</B>) such that
   <olist>
    <item>
     <p>
   <olist>
    <item>
     <p>There is a entry in one of the <termref def="key-nt">node
tables</termref> associated with the <xpropref>definition</xpropref> in an
<B>&Constraint; Binding</B>
information item 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>k</B> and whose node is <B>n</B>;</p>
    </item>
   </olist>
  or
   <olist>
    <item>
     <p><B>n</B> appears with
<termref def="key-ks">key-sequence</termref> <B>k</B> in the <termref def="key-qns">qualified node
set</termref> for the <xpropref>definition</xpropref>.</p>
    </item>
   </olist>
  </p>
    </item>
   </olist>
 provided no two entries have the same <termref def="key-ks">key-sequence</termref> but distinct nodes.  Potential conflicts are resolved by not including any conflicting entries which would have owed their inclusion to clause 1.1 above.  Note that if all the conflicting entries arose under clause 1.1 above, this means no entry at all will appear for the offending <termref def="key-ks">key-sequence</termref>.</p>
     </def>
    </gitem>
   </glist>
  </p>
  <note>
   <p>The complexity of the above arises from the fact that
<pt>keyref</pt> &constraint;s may be defined on domains distinct from the
embedded domain of the &constraint; they reference, or the domains may be the
same but self-embedding at some depth.  In either case the <termref def="key-nt">node
table</termref> for the referenced &constraint; needs to propagate upwards, with
conflict resolution.</p>
   <p>The <B>&Constraint; Binding</B>
information item, unlike others in this
specification, is essentially an internal bookkeeping mechanism.  It is introduced to
support the definition of <specref ref="cvc-identity-constraint"/> above. 
Accordingly, conformant processors may, but are <emph>not</emph> required to,
expose them via
<xpropref>&constraint; table</xpropref> properties in the &PSVI;.
In other words, the above constraints may be read as saying <termref def="key-vn">validation</termref> of
&constraint;s proceeds <emph>as if</emph> such infoset items existed. 
</p></note>
 </constraintnote> 
<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>
    <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">absent</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 <termref def="key-vn">validation</termref> as such.
They are referenced in the course of <termref def="key-vn">validating</termref> strings as members of
the <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#NOTATION">NOTATION</xtermref> simple type, in
which case the following constraint applies.</p>
    <constraintnote id="sic-notation-used" type="sic">
     <head>Validated with Notation</head>
     <p>Whenever an attribute information item is <termref def="key-vn">valid</termref> with respect to a <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#NOTATION">NOTATION</xtermref>, in the &PSVI; its parent element information item has either 
      <olist>
       <item>
        <p>a <xpropref>notation</xpropref> property whose value is an
<termref def="key-iso">item isomorphic to the notation declaration</termref> whose <propref ref="n-name"/> and <propref ref="n-target_namespace"/> match 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 attribute item's &i-value;</p>
       </item>
      </olist>
      or
      <olist>
      <item>
       <p>a pair of properties, <xpropref>notation system</xpropref> and
<xpropref>notation public</xpropref>, containing the values of the <propref ref="system_identifier"/> and <propref ref="public_identifier"/>, respectively, of that notation declaration.</p>
      </item></olist>
      </p>
    </constraintnote>
     <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>
    <p>The annotation schema component has the following
properties:</p>
<compdef name="Annotation" ref="Annotation">
   <proplist>
  <propdef id="application_information" name="application information">
    A sequence of element information items.
   </propdef>
  <propdef id="user_information" name="user information">
    A sequence of element information items.
   </propdef>
</proplist>
  </compdef>
    <p><propref ref="user_information"/> is intended for human consumption,
<propref ref="application_information"/> for automatic processing.  In both
cases, provision is made for an optional URI reference to supplement the local
information, as the value of the <code>source</code> attribute of the
respective element information items.  <termref def="key-vn">Validation</termref> does <emph>not</emph> involve dereferencing these URIs, when present.  In the case of <propref ref="user_information"/>, indication should be given as to the identity of the (human) language used in the contents, using the <code>xml:lang</code> attribute.</p>
    <p>Annotations do not participate in <termref def="key-vn">validation</termref> as such.  Provided
an annotation itself satisfies all relevant <termref def="gloss-cos">Constraints on Schemas</termref> it <emph>cannot</emph> affect the <termref def="key-vn">validation</termref> of element information items.</p>
      <p>
See <specref ref="declare-annotation"/> for the XML representation of
annotations and <specref ref="coss-annotation"/> for constraints
on annotation components as such.</p>
   </div2>
<div2 id="Simple_Type_Definition_details">
    <head>(non-normative) Simple Type Definition Details</head>
 <note>
  <p>This section reproduces a version of material from <bibref ref="ref-xsp2"/>, for local cross-reference purposes.</p>
 </note>
    <p>Simple type definitions provide for constraining character information item &i-children; of element and attribute
information items.
The simple type definition schema component has the following properties:
</p>
 <compdef name="Simple Type Definition" ref="Simple_Type_Definition">
  <proplist>
   <propdef id="st-name" name="name">Optional.  An NCName as defined by
<bibref ref="ref-xml-namespaces"/>.</propdef>
   <propdef id="st-target_namespace" name="target namespace">Either
<termref def="key-null">absent</termref> or a namespace URI, as defined in
<bibref ref="ref-xml-namespaces"/>.</propdef>
   <propdef id="st-base_type_definition" name="base type definition">A simple type definition, which may be the
<termref def="simple-ur-type-itself">simple ur-type definition</termref>.</propdef>
   <propdef id="facets" name="facets">A set of constraining
facets.</propdef>
   <propdef id="variety" name="variety">One of {<pt>atomic</pt>, <pt>list</pt>,
<pt>union</pt>}.  Depending on the value of <propref ref="variety"/>, further properties are
defined as follows:
    <glist>
     <gitem>
      <label>atomic</label>
      <def>
       <proplist>
        <propdef id="st-primitive_type_definition" name="primitive type definition">A
built-in primitive simple type definition (or the
<termref def="simple-ur-type-itself">simple ur-type definition</termref>).</propdef>
       </proplist>
      </def>
     </gitem>
     <gitem>
      <label>list</label>
      <def>
       <proplist>
        <propdef id="st-item_type_definition" name="item type definition">A
simple type definition.</propdef>
       </proplist>
      </def>
     </gitem>
     <gitem>
      <label>union</label>
      <def>
       <proplist>
        <propdef id="st-member_type_definitions" name="member type definitions">A non-empty sequence of
simple type definitions.</propdef>
       </proplist>
      </def>
     </gitem>
    </glist>
   </propdef>    
   <propdef id="st-annotation" name="annotation">Optional.  An
annotation</propdef>
  </proplist>
  </compdef>

   
<p>Simple types are identified by their <propref ref="st-name"/> and <propref ref="st-target_namespace"/>.  Except
for anonymous simple types (those with no <propref ref="st-name"/>), since
type definitions (i.e. both simple and complex type definitions taken together) must be uniquely identified within an <termref def="key-schema">XML
Schema</termref>, no simple type definition can have the same name as another
simple or complex type definition.  Simple type <propref ref="st-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="st-name"/> of a simple 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 or attribute information items <termref def="key-vn">validated</termref> by that definition. The connection between a
  name and a type definition is described in <specref ref="Element_Declaration_details"/> and <specref ref="Attribute_Declaration_details"/>. </p>
</note>
<p><propref ref="variety"/> determines whether the simple type corresponds to
an <pt>atomic</pt>, <pt>list</pt> or <pt>union</pt> type as defined by &XSP2;.</p>   
<p>As described in <specref ref="Type_Derivation"/>, every simple type definition is
a <termref def="key-typeRestriction">restriction</termref> of some other simple
type (the <propref ref="st-base_type_definition"/>), which is the simple
<termref def="key-urType">ur-type definition</termref> if and only if the type
definition in question is one of the built-in primitive datatypes, or a list or
union type definition. Each
<emph>atomic</emph> type is ultimately a restriction of exactly one such built-in simple <propref ref="st-primitive_type_definition"/>.</p>
<p><propref ref="facets"/> for each simple type definition are selected from those defined in
&XSP2;.  For <pt>atomic</pt> definitions, these are restricted to those appropriate for
the corresponding <propref ref="st-primitive_type_definition"/>.  Therefore, the value
space and lexical space (i.e. the content <termref def="key-vn">validated</termref> by) any atomic simple type is determined by the
pair (<propref ref="st-primitive_type_definition"/>, <propref ref="facets"/>). </p>
<p>As specified in &XSP2;, <pt>list</pt> simple type definitions <termref def="key-vn">validate</termref> space separated tokens, each of
which conforms to a specified simple type definition, the <propref ref="st-item_type_definition"/>.  The item type specified
must not itself be a <pt>list</pt> type, and must be one of the types identified in &XSP2; as a
suitable item type for a list simple type.  In this case the <propref ref="facets"/>
apply to the list itself, and are restricted to those appropriate for lists.</p>
<p>A <pt>union</pt> simple type definition <termref def="key-vn">validates</termref> strings which satisfy at
least one of its <propref ref="st-member_type_definitions"/>.  As in the case of
<pt>list</pt>, the <propref ref="facets"/>
apply to the union itself, and are restricted to those appropriate for unions.</p>
 <p>Simple type definitions for all the built-in primitive datatypes, namely <pt>string</pt>, <pt>boolean</pt>, <pt>float</pt>,
<pt>double</pt>, <pt>decimal</pt>, <pt>timeInstant</pt>, <pt>timeDuration</pt>,
<pt>recurringInstant</pt>, <pt>binary</pt>, <pt>uriReference</pt> (see the <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#built-in-primitive-datatypes">Primitive
Datatypes</xtermref> section of &XSP2;), as well as for the
simple and complex <termref def="key-urType">ur-type definitions</termref> (as previously described), are present by definition in every schema.  All
are in the XML Schema <propref ref="st-target_namespace"/> (namespace
URI <code>http://www.w3.org/2000/10/XMLSchema</code>), have an <pt>atomic</pt> <propref ref="variety"/> with an empty
<propref ref="facets"/> and the simple <termref def="key-urType">ur-type definition</termref> as
their <termref def="st-base_type_definition">base type definition</termref> and themselves as <propref ref="st-primitive_type_definition"/>.</p>
<p>Similarly, simple type definitions for all the built-in derived
datatypes (see the <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#built-in-derived">Derived
Datatypes</xtermref> section of &XSP2;) are present by definition in every schema, with
properties as specified in &XSP2; and as represented in XML in
<specref ref="normative-schemaSchema"/>.</p>
 <p>As discussed in
<specref ref="Type_Derivation"/>, the <termref def="key-urType">ur-type
definition</termref> functions as a simple type when used as the <termref def="st-base_type_definition">base type definition</termref> for the built-in primitive datatypes and for list and union type definitions.  It is considered to have an unconstrained lexical space, and a value space consisting of the union of the value spaces of all the built-in primitive datatypes and the set of all lists of all members of the value spaces of all the built-in primitive datatypes.</p>
 <p>The simple <termref def="key-urType">ur-type
definition</termref> must <emph>not</emph> be named as the <termref def="st-base_type_definition">base type definition</termref> of any user-defined simple types:  as it has no constraining facets, this would be incoherent.</p>
 <constraintnote type="cvc" id="cvc-simple-type">
 <head>String Valid</head>
 <p>A string is locally <termref def="key-vn">valid</termref> with respect to a simple type definition if
  it is schema-valid with respect to that definition as defined by
<xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes.html#cvc-datatype-valid">Datatype Valid</xtermref> in <bibref ref="ref-xsp2"/>.
 </p>
</constraintnote>
 <p>There is a simple type definition nearly equivalent to the <termref def="key-urType">ur-type definition</termref> present in every
schema by definition.  It has the following properties:</p>
 <schemaComp id="simple-ur-type-itself">
     <head>Simple Type Definition of the Ur-Type</head>
     <pvlist>
      <pvpair ref="st-name">anySimpleType</pvpair>
      <pvpair ref="ct-target_namespace">http://www.w3.org/2000/10/XMLSchema</pvpair>
      <pvpair ref="ct-base_type_definition"><termref def="ur-type-itself">the
ur-type definition</termref></pvpair>
      <pvpair ref="variety"><termref def="key-null">absent</termref></pvpair>
     </pvlist>
    </schemaComp>
     <p>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>
   </div2>
  </div1>
  <div1 id="declare">
   <head>XML Representation of Schemas and Schema Components</head>
    <p>The principal purpose of &XSP1; is to define a set of
      schema components that constrain the contents of instances and augment the
      information sets thereof.  Although no external representation
of schemas is required for this purpose, such representations will
obviously be widely used. To provide for this in an appropriate and
interoperable way, we specify a normative XML representation for schemas which
makes provision for every kind of schema
component.  <termdef id="key-schemaDoc" term="schema document">A document in
this form (i.e. a <eltref ref="schema"/> element information item) is a <term>schema document</term></termdef>.  For the schema document as a whole, and
its constituents, the sections below define correspondences between element
information items (with declarations in
<specref ref="normative-schemaSchema"/> and <specref ref="nonnormative-schemaDTD"/>) and
schema components.  All the element information items in the XML representation
of a schema are in the XML Schema namespace, that is their <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">namespace URI</xpropref> is <code>http://www.w3.org/2000/10/XMLSchema</code>.  Although a common way of creating schema documents will be using an XML parser, this is not required:  any mechanism which constructs conformant infosets as defined in <bibref ref="ref-xmlinfo"/> is a possible starting point.</p>
  <p>When we say below that a numeric-valued property of a schema component
corresponds to the &i-value; of some attribute information item, the number in
question is understood to be the base 10 interpretation of that &i-value;.</p>
   <p>Two aspects of the type definitions for the elements presented in the
following sections are constant across them all:
    <olist>
     <item>
      <p>All of them allow attributes qualified with namespace URIs other than
the XML Schema namespace itself: these correspond to nothing in corresponding
schema component;</p>
     </item>
     <item>
      <p>All of them allow an <eltref ref="annotation"/> as their first child, for human-readable documentation and/or machine-targetted information.</p>
     </item>
    </olist>
   </p>
   <div2 id="declare-schema">
      <head>XML Representations of Schemas</head>
     <p>A schema is represented in XML by one or more <termref def="key-schemaDoc">schema documents</termref>.  A <termref def="key-schemaDoc">schema document</termref> contains representations for a collection of schema components, e.g. type definitions and element declarations, which have a common <B>{target namespace}</B>.  A <termref def="key-schemaDoc">schema document</termref> which has one or more <eltref ref="import"/> element information items corresponds to a schema with components with more than one <B>{target namespace}</B>, see <specref ref="src-import"/>.</p>
     <reprdef>
      <reprelt eltname="schema"/>
      <reprcomp abstract="Schema" ref="key-schema">
       <propmap name="type_definitions">The simple and complex type definitions
corresponding to all the <eltref ref="simpleType"/> and <eltref ref="complexType"/> element information items in the
&i-children;, if any, plus any included or imported definitions, see <specref ref="compound-schema"/> and <specref ref="composition-schemaImport"/>.</propmap>
       <propmap name="attribute_declarations">The (global) attribute declarations
corresponding to all the <eltref ref="attribute"/> element information items in the
&i-children;, if any, plus any included or imported declarations, see <specref ref="compound-schema"/> and <specref ref="composition-schemaImport"/>.</propmap>
       <propmap name="element_declarations">The (global) element declarations
corresponding to all the <eltref ref="element"/> element information items in the
&i-children;, if any, plus any included or imported declarations, see <specref ref="compound-schema"/> and <specref ref="composition-schemaImport"/>.</propmap>
       <propmap name="attribute_group_definitions">The attribute group definitions
corresponding to all the <eltref ref="attributeGroup"/> element information items in the
&i-children;, if any, plus any included or imported definitions, see <specref ref="compound-schema"/> and <specref ref="composition-schemaImport"/>.</propmap>
       <propmap name="model_group_definitions">The model group definitions
corresponding to all the <eltref ref="group"/> element information items in the
&i-children;, if any, plus any included or imported definitions, see <specref ref="compound-schema"/> and <specref ref="composition-schemaImport"/>.</propmap>
       <propmap name="notation_declarations">The notation declarations
corresponding to all the <eltref ref="notation"/> element information items in the
&i-children;, if any, plus any included or imported declarations, see <specref ref="compound-schema"/> and <specref ref="composition-schemaImport"/>.</propmap>
       <propmap name="annotations">The annotations
corresponding to all the <eltref ref="annotation"/> element information items in the
&i-children;, if any.</propmap>
      </reprcomp>
     </reprdef>
     <p>Note that none of the attribute information items displayed above
correspond directly to properties of schemas.  The <code>blockDefault</code>,
<code>finalDefault</code>, <code>attributeFormDefault</code>, <code>elementFormDefault</code>and <code>targetNamespace</code> attributes are appealed to in the sub-sections below, as they provide
global information applicable to many representation/component correspondences.  The
other attributes (<code>id</code> and <code>version</code>) are for user
convenience, and this specification defines no semantics for them.</p>
 <ednote role="pf">
  <edtext>A number of the attributes (listed above) on the &lt;schema> element
provide defaults for attributes on subordinate elements.  This allows setting
values for attributes we judge likely to have the same value across a whole
schema document in only one place.  It does constitute a kind of minimisation,
and does not provide any new semantics.  The Working Group solicits feedback
both on whether this aspect of the design is a good thing or not, and on the
particular values chosen as the defaults for these default-setting attributes
themselves.</edtext>
 </ednote>
<p>The definition of the schema abstract data model in <specref ref="concepts-data-model"/> makes clear that most components have a <B>{target namespace}</B>.  Most components corresponding to representations within a given <eltref ref="schema"/> element information item will have a <B>{target namespace}</B> which corresponds to the <code>targetNamespace</code> attribute. </p>
     <p>Since the empty string is a legal (relative) URI reference, supplying
an empty string for <code>targetNamespace</code> is <emph>not</emph> the same
as not specifying it at all.  The appropriate form of schema document
corresponding to a <termref def="key-schema">schema</termref> whose components have no
<propref ref="e-target_namespace"/> is one which has no
<code>targetNamespace</code> attribute specified at all.</p>
     <note><p>The XML namespaces Recommendation discusses only instance document syntax for
elements and attributes; it therefore provides no direct framework for managing
the names of type definitions, attribute group definitions, and so on. Nevertheless, we apply the target namespace facility uniformly to all
schema components, i.e. not only declarations but also definitions have a <B>{target namespace}</B>.</p>
</note>



      <note role="example">
        <eg xml:space="preserve">&lt;xs:schema
    xmlns:xs="http://www.w3.org/2000/10/XMLSchema"
    targetNamespace="http://purl.org/metadata/dublin_core"
    version="M.n"&gt;

  ...

&lt;/xs:schema&gt;
</eg>
        <p>A modest beginning to a schema.</p>
    </note>
     <p>Although the schema above might be a complete XML document, <eltref ref="schema"/>
need not be the document element, but can appear within other documents.
Indeed there is no requirement that a schema correspond to a (text) document
at all:  it could correspond to an element information item constructed 'by
hand', for instance via a DOM-conformant API.</p>
    <p>Aside from <eltref ref="include"/> and <eltref ref="import"/>, which do not correspond directly to any schema component at all, each of the element information
items which may appear in the content of <eltref ref="schema"/> corresponds to
a schema component, and all except <eltref ref="annotation"/> are named.  The
sub-sections of <specref ref="declare-typesElementsAttributes"/>
present each such item in turn, setting out the
components to which it may correspond.</p>
</div2>
<div2 id="refSchemaConstructs">
  <head>References to Schema Components</head>
  <p>Reference to
   schema components from a schema document is managed in a uniform way,
whether the component corresponds to an element information item from the same schema document or is imported
(<specref ref="composition-schemaImport"/>) from an external schema (which may,
but need not, correspond to an actual schema document). The form
of all such references is a
    <termref def="gloss-QName">QName</termref>.</p>
 <p><termdef id="gloss-QName" term="QName">A <term>QName</term> is a name
with an optional namespace qualification, as defined in <bibref ref="ref-xml-namespaces"/>.  When used in connection with the XML
representation of schema components in this specification, this refers to the
simple type <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#QName">QName</xtermref> as defined in <bibref ref="ref-xsp2"/>.</termdef></p>
 <p><termdef id="gloss-NCName" term="NCName">An <term>NCName</term> is a name
with no colon, as defined in <bibref ref="ref-xml-namespaces"/>.  When used in connection with the XML
representation of schema components in this specification, this refers to the
simple type <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#NCName">NCName</xtermref> as defined in <bibref ref="ref-xsp2"/>.</termdef></p>
 <p>In each of the XML
representation expositions in the following sections, an attribute is shown as
having type <code>QName</code> if and only if it is
interpreted as referencing a schema component.</p>

  <note role="example">
    <eg xml:space="preserve"><![CDATA[<xs:schema xmlns:xs="]]>http://www.w3.org/2000/10/XMLSchema<![CDATA["
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns="http://www.example.com"
            targetNamespace="http://www.example.com">
  . . .

  <xs:element name="elem1" type="Address"/>

  <xs:element name="elem2" type="xhtml:blockquote"/>

  <xs:attribute name="attr1"
                type="xsl:quantity"/>
  . . .
</xs:schema>
]]>
</eg>
    <p>The first of these is most probably a local reference, i.e. a reference
to a type
definition corresponding to a <eltref ref="complexType"/> element information item
located elsewhere in the schema document, the other two refer to type
definitions from schemas for other namespaces and assume that their namespaces
have been declared for import.  See <specref ref="composition-schemaImport"/> for a discussion of importing.</p>
</note>
 <constraintnote type="src" id="src-qname">
  <head>QName Interpretation</head>
  <p>Where the type of an attribute information item in a document involved in
<termref def="key-vn">validation</termref> is
identified as
<termref def="gloss-QName">QName</termref>, its &i-value; is uniformly
interpreted as consisting of a <termdef id="q-local" term="local name"><term>local name</term> consisting of the character information items after the colon, if any, otherwise all the character information items, in the &i-value;</termdef>, and of a <termdef id="q-uri" term="namespace URI"><term>namespace URI</term>, derived from its &i-value; and the containing element information item's <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">in-scope namespaces</xpropref> as follows:</termdef>
  <olist>
   <item><p>If the &i-value; contains a colon, then a string composed of the character information items among the <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.namespace-decl">children</xpropref> of the member of the <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">in-scope namespaces</xpropref> whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.namespace-decl">prefix</xpropref> matches the character information items before the colon.  If no such member is present, the <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#QName">QName</xtermref> is uninterpretable and the <specref ref="src-element"/> of element information item containing it is not satisfied;</p></item>
   <item><p>otherwise (i.e. the &i-value; contains no colon)
         <olist>
          <item><p>if there is a member of the <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">in-scope namespaces</xpropref> whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.namespace-decl">prefix</xpropref> is <termref def="key-null">absent</termref>, then a string composed of the character information items among its <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.namespace-decl">children</xpropref>;</p></item>
          <item><p>otherwise <termref def="key-null">absent</termref>.</p></item>
         </olist>
</p></item>
  </olist>
 </p>
  <p>In the absence of the <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">in-scope namespaces</xpropref> property in the infoset for the schema document in question, processors must reconstruct equivalent information as necessary, using the <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.element">declared namespaces</xpropref> of the containing element information item and its ancestors.</p>
 </constraintnote>
 <p>Whenever the word <quote>resolve</quote> in any form is used in this
chapter in connection with a <termref def="gloss-QName">QName</termref> in a
schema document, the
following definition should be understood as obtaining:</p>
 <constraintnote type="src" id="src-resolve">
  <head>QName resolution (Schema Document)</head>
  <p>A string known to be a <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#QName">QName</xtermref>
resolves to a schema component of a specified kind if:
   <olist>
    <item>
     <p>that component is a member of the value of the appropriate
property of the schema which corresponds to the schema
document within which the <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#QName">QName</xtermref>
appears, that is
      <olist>
    <item>
     <p> the <propref ref="type_definitions"/> if the kind specified is simple or complex type definition;</p>
    </item>
       <item>
     <p>the <propref ref="attribute_declarations"/> if the kind specified is attribute declaration;</p> 
    </item>
    <item>
     <p>the <propref ref="element_declarations"/> if the kind specified is element declaration;</p> 
    </item>
    <item>
     <p>the <propref ref="attribute_group_definitions"/> if the kind specified
is attribute group;</p> 
    </item>
    <item>
     <p>the <propref ref="model_group_definitions"/> if the kind specified is
model group;</p>
    </item>
    <item>
     <p>the <propref ref="notation_declarations"/> if the kind specified is notation declaration;</p> 
    </item>
   </olist>
     </p>
    </item>
    <item>
     <p>its <B>{local name}</B> matches the <termref def="q-local">local
name</termref> of the string;</p>
    </item>
    <item>
     <p>its <B>{target namespace}</B> is identical to the <termref def="q-uri">namespace URI</termref> of the string;</p>
    </item>
    <item>
     <p>its <termref def="q-uri">namespace URI</termref> is either the target
namespace of the schema document containing the <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#QName">QName</xtermref> or that schema document contains an <eltref ref="import"/> element information item the &i-value; of whose <code>namespace</code> &i-attribute; is identical to that <termref def="q-uri">namespace URI</termref>.</p>
    </item>
   </olist>
  </p>
 </constraintnote>
 <div3>
  <head>References to Schema Components from Elsewhere</head>
    <p>The names of schema components such as type definitions and element
declarations are not of type <code>ID</code>:  they are not
unique within a schema, just within a symbol space.  This means that simple
fragment identifiers will not always work to reference schema components from outside
the context of schema documents.</p>
    <p>There is currently no provision in the definition of the interpretation
of fragment identifiers for the <code>text/xml</code> MIME type, which is the
MIME type for schemas, for referencing
schema components as such.  However, we observe that
<bibref ref="ref-xpointer"/> provides a mechanism which maps well onto our
notion of symbol spaces as it is reflected in the XML representation of schema components.  A fragment identifier of the form
<code>#xpointer(xs:schema/xs:element[@name="person"])</code> will uniquely identify
the representation of a global element declaration with name <code>person</code>, and similar fragment
identifiers can obviously be constructed for the other global symbol spaces.</p>
  <p>Short-form fragment identifiers may also be used in some cases, that is
when a DTD or XML Schema is available for the schema in question, and the
provision of an <code>id</code> attribute for the representations of all primary and secondary schema
components, which <emph>is</emph> of type
<code>ID</code>, has been exploited.</p>
  <p>It is a matter for applications to specify whether they interpret
document-level references of either of the above varieties as being to the relevant element information item (i.e. without
special recognition of the relation of schema documents to schema components) or as being to the
corresponding schema component.</p>
 </div3>
</div2>
<div2 id="declare-typesElementsAttributes">
<head>XML Representation of Schema Components</head>

<p>For each kind of schema component there is a corresponding normative XML representation.
The sections below describe the correspondences between the properties of each kind of
schema component on the one hand and the properties of information items in
that XML representation on the other, together
with constraints on that representation above and beyond those implicit in the
<specref ref="normative-schemaSchema"/> and <specref ref="nonnormative-schemaDTD"/>.</p>
 <p>The language used is as if the correspondences were mappings from XML representation to
schema component, but the mapping in the other direction, and therefore the
correspondence in the abstract, can always be
constructed therefrom.</p>
<div3 id="declare-attribute">
<head>XML Representation of Attribute Declaration Schema Components</head>
<p>The XML representation for an attribute declaration schema component is an
<eltref ref="attribute"/> element information item.  It specifies a simple type
definition for an attribute either by reference or explicitly, and may provide default information.  The correspondences between the
properties of the information item and
properties of the component are as follows:</p>
<reprdef>
 <reprelt eltname="attribute" type="attribute"/>
 <p>If the <eltref ref="attribute"/> element information item has <eltref ref="schema"/> as its parent, the corresponding schema component is as follows:</p>
  <reprcomp ref="Attribute_Declaration_details" abstract="Attribute Declaration">
   <propmap name="a-name">The &i-value; of the <code>name</code> &i-attribute;</propmap>
  <propmap name="a-target_namespace">The &i-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <eltref ref="schema"/>
element information item, or <termref def="key-null">absent</termref> if there is none.</propmap>
 <propmap name="a-simple_type_definition">The simple type definition
corresponding to the <eltref ref="simpleType"/> element information item in the
&i-children;, if present, otherwise the simple type definition <termref def="src-resolve">resolved</termref> to by
the &i-value; of the <code>type</code> &i-attribute;, if present, otherwise the
<termref def="simple-ur-type-itself">simple ur-type definition</termref>.</propmap>
   <propmap name="a-scope"><pt>global</pt></propmap>
 <propmap name="a-value_constraint">If there is no <code>value</code>
&i-attribute;, then <termref def="key-null">absent</termref>, otherwise a pair consisting of the &i-value; (with respect to the
<propref ref="a-simple_type_definition"/>) of that &i-attribute; and
<pt>fixed</pt>, if the &i-value; of the <code>use</code> &i-attribute; is
<code>fixed</code>, otherwise <pt>default</pt>.</propmap>
 <propmap name="a-annotation">The annotation corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, otherwise <termref def="key-null">absent</termref>.</propmap>
 </reprcomp>
 <p>otherwise if the <eltref ref="attribute"/> element information item has
<eltref ref="complexType"/> or <eltref ref="attributeGroup"/> as an ancestor
and the <code>ref</code> &i-attribute; is absent, it corresponds to an
<termref def="key-aup">attribute use pair</termref> of a boolean and an attribute declaration (unless <code>use='prohibited'</code>, in which case the item
corresponds to nothing at all).</p>
 <p>The boolean is <pt>true</pt> if the <code>use</code>
&i-attribute; is present with &i-value; <code>required</code>, otherwise
<pt>false</pt>.  The attribute declaration is as follows:</p>
 <reprcomp ref="Attribute_Declaration_details" abstract="Attribute Declaration">
  <propmap name="a-name">The &i-value; of the <code>name</code> &i-attribute;</propmap>
  <propmap name="a-target_namespace">If <code>form</code> is present and its
&i-value; is <code>qualified</code>, or if <code>form</code> is absent and the
&i-value; of <code>attributeFormDefault</code> on the <eltref ref="schema"/>
ancestor is <code>qualified</code>, then the &i-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <eltref ref="schema"/>
element information item, or <termref def="key-null">absent</termref> if there
is none, otherwise <termref def="key-null">absent</termref>.</propmap>
  <propmap name="a-simple_type_definition">The simple type definition
corresponding to the <eltref ref="simpleType"/> element information item in the
&i-children;, if present, otherwise the simple type definition <termref def="src-resolve">resolved</termref> to by
the &i-value; of the <code>type</code> &i-attribute;, if present, otherwise the
<termref def="simple-ur-type-itself">simple ur-type definition</termref>.</propmap>
  <propmap name="a-scope">If the <eltref ref="attribute"/> element information item
has <eltref ref="complexType"/> as an ancestor, the complex definition
corresponding to that item, otherwise (the <eltref ref="attribute"/> element
information item is within a top-level <eltref ref="attributeGroup"/> definition), <termref def="key-null">absent</termref>.</propmap>
  <propmap name="a-value_constraint">If there is no <code>value</code>
&i-attribute;, then <termref def="key-null">absent</termref>, otherwise a pair consisting of the &i-value; (with respect to the
<propref ref="a-simple_type_definition"/>) of that &i-attribute; and
<pt>default</pt>, if the &i-value; of the <code>use</code> &i-attribute; is
<code>default</code>, otherwise <pt>fixed</pt>.</propmap>
 <propmap name="a-annotation">The annotation corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, otherwise <termref def="key-null">absent</termref>.</propmap>
 </reprcomp>
 <p>otherwise (the <eltref ref="attribute"/> element information item has
<eltref ref="complexType"/> or <eltref ref="attributeGroup"/> as an ancestor and the
<code>ref</code> &i-attribute; is present), it corresponds to an <termref def="key-aup">attribute use pair</termref> of a boolean and an attribute declaration (unless <code>use='prohibited'</code>, in which case the item
corresponds to nothing at all).</p>
 <p>The boolean is <pt>true</pt> if the <code>use</code>
&i-attribute; is present with &i-value; <code>required</code>, otherwise
<pt>false</pt>.  The attribute declaration is the (global) attribute declaration <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>ref</code> &i-attribute;.</p>
 </reprdef>
 <p>Attribute declarations can appear at the top level of a schema document, or within complex
type definitions, either as complete (local) declarations, or by reference to top-level
declarations, or within attribute group definitions.  For complete declarations, top-level or local, the <code>type</code> attribute is used when the declaration can use a
built-in or pre-declared simple type definition.  Otherwise an
anonymous <eltref ref="simpleType"/> is provided inline.</p>
 <p>The default when no simple type definition is referenced or
provided is the simple <termref def="key-urType">ur-type definition</termref>, which imposes no constraints at all.</p>
 <p>Attribute items <termref def="key-vn">validated</termref> by a global declaration must be qualified with a
namespace URI.  Control over whether attribute items <termref def="key-vn">validated</termref> by a local declaration must be namespace-qualified or not
is provided by the <code>form</code> &i-attribute;, whose default is provided
by the <code>attributeFormDefault</code> &i-attribute; on the enclosing <eltref ref="schema"/>, via its determination of <propref ref="a-target_namespace"/>.</p>
 <p>The names for top-level attribute declarations are in their own
<termref def="key-symbolSpace">symbol space</termref>.  The names of locally-scoped
attribute declarations with no <propref ref="e-target_namespace"/> reside in symbol spaces local to the type definition which contains
them.</p>
 <note role="example">
<eg xml:space="preserve"><![CDATA[<xs:attribute name="myAttribute"/>

<xs:attribute name="yetAnotherAttribute" type="xs:integer" use="required"/>

<xs:attribute name="anotherAttribute" use="default" value="42">
 <xs:simpleType>
  <xs:restriction base="xs:integer">
   <xs:minExclusive value="0"/>
  </xs:restriction>
 </xs:simpleType>
</xs:attribute>

<xs:attribute name="stillAnotherAttribute" type="xs:string" use="fixed" value="Hello world!"/>]]>
</eg>
<p>Four attributes are declared: one with no explicit
constraints at all; two more each declared by reference to the
built-in simple datatype <code>integer</code>, one required to
be present in instances and one with a default and a subrange qualification; and a fourth with a fixed value.</p>
</note>
 <constraintnote id="src-attribute" type="src">
  <head>Attribute Declaration Representation OK</head>
  <p>In addition to the conditions imposed on <eltref ref="attribute"/> element
information items by the DTD and schema for schemas, the following must also hold:
   <olist>
    <item>
     <p>If the item's parent is <eltref ref="schema"/>, then
      <olist>
       <item>
     <p>If <code>value</code> is present, <code>use</code> must be one of
<pt>default</pt> or <pt>fixed</pt>;</p>
    </item>       
       <item>
        <p>If <code>value</code> is absent, <code>use</code> must be absent</p>
       </item>
      </olist>
     </p>
    </item>
    <item>
     <p>If the item's parent is not <eltref ref="schema"/>, then
      <olist>
       <item>
     <p>One of <code>ref</code> or <code>name</code> must be present, but not both;</p>
    </item>       
       <item>
        <p>If <code>ref</code> is present, then all of
<eltref ref="simpleType"/>, <code>form</code>, <code>type</code> and <code>value</code> must be absent;</p>
       </item>
    <item>
     <p>If <code>value</code> is present, <code>use</code> must be one of
<pt>default</pt> or <pt>fixed</pt>;</p>
    </item>
      </olist>
     </p>
    </item>
    <item>
     <p><code>type</code> and <eltref ref="simpleType"/> must not both be present;</p>
    </item>
    <item>
     <p>The corresponding attribute declaration must satisfy the conditions set
out in <specref ref="coss-attribute"/>.</p>
    </item>
   </olist>
  </p>
 </constraintnote>

</div3>
 <div3 id="declare-element">
<head>XML Representation of Element Declaration Schema Components</head>
<p>The XML representation for an element declaration schema component is an
<eltref ref="element"/> element information item.  It specifies a type
definition for an element either by reference or explicitly, and may provide
occurrence and default information.  The correspondences between the
properties of the information item and
properties of the component(s) it corresponds to are as follows:</p>
<reprdef>
 <reprelt eltname="element" type="element"/>
 <p>If the <eltref ref="element"/> element information item has <eltref ref="schema"/> as its parent, the corresponding schema component is as follows:</p>
 <reprcomp abstract="Element Declaration" ref="Element_Declaration_details">  
<propmap name="e-name">The &i-value; of the <code>name</code> &i-attribute;</propmap>
  <propmap name="e-target_namespace">The &i-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <eltref ref="schema"/>
element information item, or <termref def="key-null">absent</termref> if there is none.</propmap>
 <propmap name="e-scope"><pt>global</pt></propmap>
  <propmap name="type_definition">The type definition
corresponding to the <eltref ref="simpleType"/> or <eltref ref="complexType"/> element information item in the
&i-children;, if either is present, otherwise the type definition <termref def="src-resolve">resolved</termref> to by
the &i-value; of the <code>type</code> &i-attribute;, otherwise the <propref ref="type_definition"/> of the element declaration <termref def="src-resolve">resolved</termref> to by the &i-value; of the <code>substitutionGroup</code> &i-attribute;, if present, otherwise the
<termref def="ur-type-itself">ur-type definition</termref>.</propmap>
  <propmap name="nullable">The &i-value; of the <code>nullable</code>
&i-attribute;, if present, otherwise false.</propmap>
  <propmap name="e-value_constraint">If there is a <code>default</code> or a <code>fixed</code>
&i-attribute;, then a pair consisting of the &i-value; (with respect to the
<propref ref="type_definition"/>, if it is a simple type definition, or the
<propref ref="type_definition"/>'s <propref ref="content_type"/>, if that is a
simple type definition, or else with respect to the <termref def="simple-ur-type-itself">simple ur type</termref>) of that &i-attribute; and
either <pt>default</pt> or <pt>fixed</pt>, as appropriate, otherwise <termref def="key-null">absent</termref>.</propmap>
  <propmap name="&constraint;_definitions">A set consisting of the
&constraint;-definitions corresponding to all the <eltref ref="key"/>, <eltref ref="unique"/> and <eltref ref="keyref"/> element information items in the
&i-children;, if any, otherwise the empty set</propmap>
  <propmap name="class_exemplar">the element declaration <termref def="src-resolve">resolved</termref> to by the
&i-value; of the
<code>substitutionGroup</code> &i-attribute;, if present, otherwise <termref def="key-null">absent</termref></propmap>
  <propmap name="e-exact">A set corresponding to the normalized &i-value; of the
<code>block</code> &i-attribute;, if present, otherwise on the &i-value; of the
<code>blockDefault</code> &i-attribute; of the ancestor <eltref ref="schema"/> element
information item, if present, otherwise on the empty string, as follows:
   <glist>
    <gitem>
     <label>the empty string</label>
     <def>
<p>the empty set;</p>
     </def>
    </gitem>
    <gitem>
     <label>
      <code>#all</code>
     </label>
     <def>
      <p><code>{</code><pt>substitution</pt>, <pt>extension</pt>,
<pt>restriction</pt><code>}</code>;</p>
     </def>
    </gitem>
    <gitem>
     <label><emph>otherwise</emph></label>
     <def>
      <p>a set with members drawn from the set above, each being present or
absent depending on whether the string contains an equivalently named
space-delimited substring.</p>
     </def>
    </gitem>
   </glist>
  </propmap>
  <propmap name="e-final">As for <propref ref="e-exact"/> above, but using the
<code>final</code> &i-attribute; in place of the <code>block</code>
&i-attribute; and with the
relevant set being <code>{</code><pt>extension</pt>, <pt>restriction</pt><code>}</code></propmap>
  <propmap name="e-abstract">The &i-value; of the <code>abstract</code>
&i-attribute;, if present, otherwise false</propmap>
  <propmap name="e-annotation">The annotation corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, otherwise <termref def="key-null">absent</termref></propmap>
</reprcomp>
 <p>otherwise if the <eltref ref="element"/> element information item has
<eltref ref="complexType"/> or <eltref ref="group"/> as an ancestor and the
<code>ref</code> &i-attribute; is absent, the corresponding schema components
are as follows (unless <code>minOccurs=maxOccurs=0</code>, in which case the item
corresponds to no component at all):</p>
 <reprcomp abstract="Particle" ref="Particle_details">
  <propmap name="p-min_occurs">The numeric &i-value; of the <code>minOccurs</code>
&i-attribute;, if present, otherwise <code>1</code></propmap>
  <propmap name="p-max_occurs"><pt>unbounded</pt>, if the <code>maxOccurs</code>
&i-attribute; equals <pt>unbounded</pt>, otherwise the numeric &i-value; of the <code>maxOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap name="term">A (local) element declaration as given below</propmap>
  
</reprcomp>
 <p> 
An element declaration as in the first case above, with the exception of its <propref ref="e-target_namespace"/> and <propref ref="e-scope"/> properties, which are as below</p>
 <reprcomp abstract="Element Declaration" ref="Element_Declaration_details">
  <propmap name="e-target_namespace">If <code>form</code> is present and its
&i-value; is <code>qualified</code>, or if <code>form</code> is absent and the
&i-value; of <code>elementFormDefault</code> on the <eltref ref="schema"/>
ancestor is <code>qualified</code>, then the &i-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <eltref ref="schema"/>
element information item, or <termref def="key-null">absent</termref> if there
is none, otherwise <termref def="key-null">absent</termref>.</propmap>
 <propmap name="e-scope">If the <eltref ref="element"/> element information item
has <eltref ref="complexType"/> as an ancestor, the complex definition
corresponding to that item, otherwise (the <eltref ref="element"/> element
information item is within a top-level <eltref ref="group"/> definition), <termref def="key-null">absent</termref>.</propmap>
 </reprcomp>
 <p>otherwise (the <eltref ref="element"/> element information item has
<eltref ref="complexType"/> or <eltref ref="group"/> as an ancestor and the
<code>ref</code> &i-attribute; is present), the corresponding schema component is as
follows (unless <code>minOccurs=maxOccurs=0</code>, in which case the item
corresponds to no component at all):</p>
 <reprcomp abstract="Particle" ref="Particle_details">
  <propmap name="p-min_occurs">The numeric &i-value; of the <code>minOccurs</code>
&i-attribute;, if present, otherwise <code>1</code></propmap>
  <propmap name="p-max_occurs"><pt>unbounded</pt>, if the <code>maxOccurs</code>
&i-attribute; equals <pt>unbounded</pt>, otherwise the numeric &i-value; of the <code>maxOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap name="term">The (global) element declaration <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>ref</code> &i-attribute;</propmap>
</reprcomp>
</reprdef>


<p><eltref ref="element"/> corresponds to an element declaration, and allows
the type definition of that declaration to be specified either by reference or
by explicit inclusion.</p>
  <p><eltref ref="element"/>s within <eltref ref="schema"/> produce
<pt>global</pt> element declarations; <eltref ref="element"/>s within <eltref ref="group"/> or <eltref ref="complexType"/> produce either particles which contain <pt>global</pt> element declarations (if there's a <code>ref</code> attribute) or local declarations (otherwise).  For complete declarations, top-level or local, the <code>type</code> attribute is used when the declaration can use a
built-in or pre-declared type definition.  Otherwise an
anonymous <eltref ref="simpleType"/> or <eltref ref="complexType"/> is provided inline.</p>
 <p>Element items <termref def="key-vn">validated</termref> by a global declaration must be qualified with a
namespace URI.  Control over whether element items <termref def="key-vn">validated</termref> by a local declaration must be namespace-qualified or not
is provided by the <code>form</code> &i-attribute;, whose default is provided
by the <code>elementFormDefault</code> &i-attribute; on the enclosing <eltref ref="schema"/>, via its determination of <propref ref="e-target_namespace"/>.</p>
  <ednote role="pf">
   <edtext>The provision of local element declarations is in part intended to
simplify mapping between programming language and database structures where
locally scoped name-type bindings are commonplace.  It is a departure from XML
1.0 DTDs, in which the name-type binding for elements (but not for attributes)
is constant across a document.  The Working Group solicits feedback
both on whether this aspect of the design is a good thing or not, and in
particular on whether it does in fact simplify mappings as intended.</edtext>
  </ednote>
<p>As noted above the names for top-level element declarations are in a separate
<termref def="key-symbolSpace">symbol space</termref> from the symbol spaces for
the names of type definitions, so there can (but need
not be) a simple or complex type definition type with the same name as a
top-level element.  As with attribute names, the names of locally-scoped
element declarations with no <propref ref="e-target_namespace"/> reside in symbol spaces local to the type definition which contains
them.</p>

  <p>Note that the above allows for two levels of defaulting for unspecified
type definitions.  An <eltref ref="element"/> with no referenced or included type definition will
correspond to an element declaration which has the same type definition as the
head of its substitution group if it identifies one, otherwise the <termref def="key-urType">ur-type definition</termref>.  This has the important consequence that the minimum valid element declaration, that is, one with only a <code>name</code> attribute and no contents, is also the most general, validating any combination of text and element content and allowing any attributes.</p>

 <p>See below at <specref ref="declare-key"/> for <eltref ref="key"/>, <eltref ref="unique"/> and <eltref ref="keyref"/>.</p>


<note role="example">
<eg xml:space="preserve">&amp;xs:element name="unconstrained"/&gt;

&lt;xs:element name="myelement" type="mySimpleType"/&gt;

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

&lt;xs:element name="et1"&gt;
 &lt;xs:complexType&gt;
  &lt;xs:sequence>
   &lt;xs:element ref="et0"/>
   . . .
  &lt;/xs:sequence>
  &lt;xs:attribute ...&gt;. . .&lt;/xs:attribute&gt;
 &lt;/xs:complexType&gt;
&lt;/xs:element&gt;

&lt;xs:element name="et2"&gt;
 &lt;xs:complexType&gt;
  &lt;xs:attribute ...&gt;. . .&lt;/xs:attribute&gt;
 &lt;/xs:complexType&gt;
&lt;/xs:element&gt;
</eg>
<p>The first example above declares an element whose type, by default, is the
<termref def="key-urType">ur-type definition</termref>.  The next two examples declare elements by reference to a simple and a
complex type definition respectively.  The last two use embedded anonymous complex
type definitions, the first of which in
turn refers to one of the top-level element declarations in its content model.</p>
<eg xml:space="preserve">&lt;xs:element name="contextOne"&gt;
 &lt;xs:complexType&gt;
  &lt;xs:sequence>
   &lt;xs:element name="myLocalelement" type="myFirstType"/&gt;
   &lt;xs:element ref="globalelement"/&gt;
  &lt;/xs:sequence>
 &lt;/xs:complexType&gt;
&lt;/xs:element&gt;

&lt;xs:element name="contextTwo"&gt;
 &lt;xs:complexType&gt;
  &lt;xs:sequence>
   &lt;xs:element name="myLocalelement" type="mySecondType"/&gt;
   &lt;xs:element ref="globalelement"/&gt;
  &lt;/xs:sequence>
 &lt;/xs:complexType&gt;
&lt;/xs:element&gt;
</eg>
<p>Instances of <code>myLocalelement</code> within
<code>contextOne</code> will be constrained by <code>myFirstType</code>,
while those within <code>contextTwo</code> will be constrained by
<code>mySecondType</code>. </p>

</note>
<note>
<p>The possibility that differing attribute declarations and/or content models
would apply to elements with the same name in different contexts is an
extension beyond the expressive power of a DTD in XML 1.0.</p>
</note>
  <note role="example">
   <eg xml:space="preserve"><![CDATA[ <xs:complexType name="facet">
  <xs:complexContent>
   <xs:extension base="xs:annotated">
    <xs:attribute name="value" use="required"/>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>

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

 <xs:element name="encoding" substitutionGroup="xs:facet">
  <xs:complexType>
   <xs:complexContent>
    <xs:restriction base="xs:facet">
     <xs:attribute name="value" type="xs:encodings"/>
    </xs:restriction>
   </xs:complexContent>
  </xs:complexType>
 </xs:element>

 <xs:element name="period" substitutionGroup="xs:facet">
  <xs:complexType>
   <xs:complexContent>
    <xs:restriction base="xs:facet">
     <xs:attribute name="value" type="xs:timeDuration"/>
    </xs:restriction>
   </xs:complexContent>
  </xs:complexType>
 </xs:element>

 <xs:complexType name="datatype">
  <xs:sequence>
   <xs:element ref="facet" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
  <xs:attribute name="name" type="xs:NCName" use="optional"/>
  . . .
 </xs:complexType>
]]></eg>
   <p>An example from the schema for datatypes from &XSP2;.  The
<code>facet</code> type is defined
and the <code>facet</code> element is declared to use it. The <code>facet</code> element is abstract -- it's
<emph>only</emph> defined to stand as the head for a substitution group.  Two further
elements are declared, each a member of the <code>facet</code> substitution group.  Finally a type is defined which refers to <code>facet</code>, thereby
allowing <emph>either</emph> <code>period</code> or <code>encoding</code> (or
any other member of the group).</p>
  </note>


 <constraintnote id="src-element" type="src">
  <head>Element Declaration Representation OK</head>
  <p>In addition to the conditions imposed on <eltref ref="element"/> element
information items by the schema for schemas, the following must also hold:
   <olist>
    <item>
     <p><code>default</code> and <code>fixed</code> must not both be present;</p>
    </item>
    <item>
     <p><code>minOccurs</code> must be <code>0</code> if <code>default</code>
is present;</p>
    </item>
    <item>
     <p>If the item's parent is not <eltref ref="schema"/>, then
      <olist>
       <item>
     <p>One of <code>ref</code> or <code>name</code> must be present, but not both;</p>
    </item>
       <item>
        <p>If <code>ref</code> is present, then all of <eltref ref="complexType"/>,
<eltref ref="simpleType"/>, <eltref ref="key"/>, <eltref ref="keyref"/>,
<eltref ref="unique"/>, <code>nullable</code>, <code>default</code>,
<code>fixed</code>, <code>block</code> and <code>type</code> must be absent,
i.e. only <code>minOccurs</code>, <code>maxOccurs</code>, <code>id</code> are
allowed in addition to <code>ref</code>, along with <eltref ref="annotation"/>;</p>
       </item>
      </olist>
     </p>
    </item>
    <item>
     <p><code>type</code> and either <eltref ref="simpleType"/> or <eltref ref="complexType"/> are mutually exclusive;</p>
    </item>
    <item>
     <p>The corresponding particle and/or element declarations must satisfy the conditions set
out in <specref ref="coss-element"/> and <specref ref="coss-particle"/>.</p>
    </item>
   </olist>
  </p>
 </constraintnote>
</div3>

<div3 id="declare-type">
<head>XML Representation of Complex Type Definition Schema Components</head>
<p>The XML representation for a complex type definition schema component is a
<eltref ref="complexType"/> element information item.  It provides <termref def="key-vn">validation</termref>
information for the &i-attributes; and &i-children; of an element information
item in the form of attribute declarations and a content type.</p>
 <p>The XML representation for complex type definitions with
a simple type definition <propref ref="content_type"/> is significantly different
from that of those with other <propref ref="content_type"/>s, and this
is reflected in the presentation below, which displays first the elements
involved in the first case, then those for the second.  The property mapping is shown once for each case.</p>
<reprdef>
 <reprelt eltname="complexType" type="complexType"/>
 <p>Whichever alternative for the content of <eltref ref="complexType"/> is
chosen, the following property mappings obtain:</p>
 <reprcomp abstract="Complex Type Definition" ref="Complex_Type_Definition_details">
  <propmap name="ct-name">The &i-value; of the <code>name</code> &i-attribute; if present, otherwise <termref def="key-null">absent</termref></propmap>
  <propmap name="ct-target_namespace">The &i-value; of the
<code>targetNamespace</code> &i-attribute; of the <eltref ref="schema"/> ancestor
element information item if present, otherwise <termref def="key-null">absent</termref></propmap>
<propmap name="ct-abstract">The &i-value; of the <code>abstract</code>
&i-attribute;, if present, otherwise false</propmap>
<propmap name="ct-exact">A set corresponding to the &i-value; of the
<code>block</code> &i-attribute;, if present, otherwise on the &i-value; of the
<code>blockDefault</code> &i-attribute; of the ancestor <eltref ref="schema"/> element
information item, if present, otherwise on the empty string, as follows:
   <glist>
    <gitem>
     <label>the empty string</label>
     <def>
<p>the empty set;</p>
     </def>
    </gitem>
    <gitem>
     <label>
      <code>#all</code>
     </label>
     <def>
      <p><code>{</code><pt>extension</pt>, <pt>restriction</pt><code>}</code>;</p>
     </def>
    </gitem>
    <gitem>
     <label><emph>otherwise</emph></label>
     <def>
      <p>a set with members drawn from the set above, each being present or
absent depending on whether the string contains an equivalently named
space-delimited substring.</p>
      <note>
       <p>Although the <code>blockDefault</code> &i-attribute; of <eltref ref="schema"/> may include the value <pt>substitution</pt>, this value is ignored in the determination of <propref ref="ct-exact"/> for type definitions (it <emph>is</emph> used in the determination of <propref ref="e-exact"/> for element declarations)</p>
      </note>
     </def>
    </gitem>
   </glist></propmap>
<propmap name="ct-final">As for <propref ref="ct-exact"/> above, using the
<code>final</code> &i-attribute; in place of the <code>block</code> &i-attribute;</propmap>
  <propmap name="ct-annotations">The annotations corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, in the <eltref ref="simpleContent"/> and
<eltref ref="complexContent"/> &i-children;, if present, and in their <code>restriction</code> and <code>extension</code> &i-children;, if present, otherwise <termref def="key-null">absent</termref></propmap>
</reprcomp>
 <p>When the <eltref ref="simpleContent"/> alternative is chosen, the following
elements are relevant, and the remaining property mappings are as below.  Note that either
<eltref ref="restriction" inside="simpleContent"/> or <eltref ref="extension" inside="simpleContent"/> must be chosen as the
content of <eltref ref="simpleContent"/>.</p>
 <reprelt eltname="simpleContent"/>
 <reprelt eltname="restriction" type="simpleRestrictionType" local="simpleContent"/>
 <reprelt eltname="extension" type="simpleExtensionType" local="simpleContent"/> 
 <reprelt eltname="attributeGroup" type="attributeGroupRef" local="simpleContent"/>
 <reprelt eltname="anyAttribute"/>
 <reprcomp abstract="Complex Type Definition with simple content" ref="Complex_Type_Definition_details">
<propmap name="ct-base_type_definition">The type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>base</code> &i-attribute;</propmap>
  <propmap name="derivation_method">If the <eltref ref="restriction" inside="simpleContent"/> alternative
is chosen, then <pt>restriction</pt>, otherwise (the <eltref ref="extension" inside="simpleContent"/> alternative
is chosen) <pt>extension</pt></propmap>
<propmap name="ct-attribute_declarations">The union of the sets of <termref def="key-aup">attribute use pair</termref>s as follows 
 <olist>
  <item>
   <p>the set of pairs corresponding to the <eltref ref="attribute"/> &i-children;, if any</p>
  </item>
  <item>
   <p>the <propref ref="ag-attribute_declarations"/> of the
attribute groups <termref def="src-resolve">resolved</termref> to by the &i-value;s of the <code>ref</code>
&i-attribute; of the <eltref ref="attributeGroup" inside="simpleContent"/> &i-children;, if any</p>
  </item>
  <item>
   <p>if the type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>base</code> &i-attribute; is a complex type definition, the
<propref ref="ct-attribute_declarations"/> of that type definition, unless
the <eltref ref="restriction" inside="simpleContent"/> alternative is chosen, in which case those members of
the that type definition's <propref ref="ct-attribute_declarations"/> whose
attribute declaration's
<propref ref="a-name"/> and <propref ref="a-target_namespace"/> are the same as
the declaration of an <termref def="key-aup">attribute use pair</termref> which would be in the set per clause 1 or 2 above
are not included.</p>
  </item>
 </olist>
</propmap>
<propmap name="ct-attribute_wildcard">
 <olist>
  <item>
   <p>If there are no <eltref ref="attributeGroup" inside="simpleContent"/> &i-children; corresponding
to attribute groups with non-<termref def="key-null">absent</termref> <propref ref="ag-attribute_wildcard"/>s, then 
    <olist>
     <item>
      <p>if there is an <eltref ref="anyAttribute"/> present, a wildcard based
on the &i-value;s of the <code>namespace</code> and
<code>processContents</code> &i-attributes; and the <eltref ref="annotation"/> &i-children;, exactly as for the wildcard
corresponding to an <eltref ref="any"/> element as set out in <specref ref="declare-openness"/>,</p>
     </item>
     <item><p>otherwise if the type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>base</code> &i-attribute; is a complex type definition
with an <propref ref="ct-attribute_wildcard"/> and the <eltref ref="extension" inside="simpleContent"/> alternative is chosen, then that <propref ref="ct-attribute_wildcard"/>,</p></item>
     <item>
      <p>otherwise <termref def="key-null">absent</termref>.</p>
     </item>
    </olist>
   </p>
  </item>
  <item>
   <p>Otherwise a wildcard whose <propref ref="process_contents"/> and <propref ref="w-annotation"/> are those of a wildcard as defined in 1.1 above, and whose <propref ref="namespace_constraint"/> is the intensional intersection of the <propref ref="namespace_constraint"/> of a wildcard as defined in 1.1 above
and all the non-<termref def="key-null">absent</termref> <propref ref="ag-attribute_wildcard"/>s of the attribute groups corresponding to the <eltref ref="attributeGroup" inside="simpleContent"/> &i-children;, as defined in <specref ref="cos-aw-intersect"/>.</p>
  </item>
 </olist> 
</propmap>
<propmap name="content_type">
 <olist>
  <item><p>if the type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>base</code> &i-attribute; is a complex type definition
(whose own <propref ref="content_type"/> must be a
simple type definition, see below) and the <eltref ref="restriction" inside="simpleContent"/> alternative is chosen, then starting from either
         <olist>
          <item>
           <p>the simple type definition corresponding to the <eltref ref="simpleType"/> among
the &i-children; of <eltref ref="restriction" inside="simpleContent"/> if there
is one;</p>
          </item>
          <item>
           <p>otherwise (<eltref ref="restriction" inside="simpleContent"/> has no <eltref ref="simpleType"/> among its
&i-children;), the simple type definition which is the <propref ref="content_type"/> of the type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>base</code> &i-attribute;</p>
          </item>
         </olist>
a simple type definition which restricts that simple type definition with a
set of facet components corresponding to the appropriate element information
items among the <eltref ref="restriction" inside="simpleContent"/>'s
&i-children; (i.e. those which specify facets, if any), as
defined in <specref ref="st-restrict-facets"/>;</p></item>
  <item><p>otherwise if the type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>base</code> &i-attribute; is a complex type definition
(whose own <propref ref="content_type"/> must be a
simple type definition, see below) and the <eltref ref="extension" inside="simpleContent"/> alternative is chosen, then
the <propref ref="content_type"/> of that complex type definition;</p></item>
  <item>
   <p>otherwise (the type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>base</code> &i-attribute; is a simple type definition and
the <eltref ref="extension" inside="simpleContent"/> alternative is chosen), then
that simple type definition;</p>
  </item>
 </olist>
</propmap>
</reprcomp>
 <p>When the <eltref ref="complexContent"/> alternative is chosen, the following
elements are relevant (as are the <eltref ref="attributeGroup" inside="simpleContent"/> and <eltref ref="anyAttribute"/> elements, not repeated here), and the additional property mappings are as below.  Note that either
<eltref ref="restriction" inside="complexContent"/> or <eltref ref="extension" inside="complexContent"/> must be chosen as the
content of <eltref ref="complexContent"/>, but their content models are
different in this case from the case above when they occur as children of
<eltref ref="simpleContent"/>.</p>
 <p>The property mappings below are <emph>also</emph> used in the case where
the third alternative (neither <eltref ref="simpleContent"/> nor <eltref ref="complexContent"/>) is chosen.  This case is understood as shorthand for complex content restricting the <termref def="key-urType">ur-type definition</termref>, and the details of the mappings should be modified as necessary.</p>
 <reprelt eltname="complexContent"/>
 <reprelt eltname="restriction" type="complexRestrictionType" local="complexContent"/>
 <reprelt eltname="extension" type="extensionType" local="complexContent"/>
 <reprcomp abstract="Complex Type Definition with complex content" ref="Complex_Type_Definition_details">
<propmap name="ct-base_type_definition">The type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>base</code> &i-attribute;</propmap>
  <propmap name="derivation_method">If the <eltref ref="restriction" inside="complexContent"/> alternative
is chosen, then <pt>restriction</pt>, otherwise (the <eltref ref="extension" inside="complexContent"/> alternative
is chosen) <pt>extension</pt></propmap>
<propmap name="ct-attribute_declarations">The union of the sets of <termref def="key-aup">attribute use pair</termref>s as follows: 
 <olist>
  <item>
   <p>the set of pairs corresponding to the <eltref ref="attribute"/> &i-children;, if any</p>
  </item>
  <item>
   <p>the <propref ref="ag-attribute_declarations"/> of the
attribute groups <termref def="src-resolve">resolved</termref> to by the &i-value;s of the <code>ref</code>
&i-attribute; of the <eltref ref="attributeGroup" inside="simpleContent"/> &i-children;, if any</p>
  </item>
  <item>
   <p>the
<propref ref="ct-attribute_declarations"/> of the type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>base</code> &i-attribute;, unless
the <eltref ref="restriction" inside="complexContent"/> alternative
is chosen, in which case those members of
that type definition's <propref ref="ct-attribute_declarations"/> whose
attribute declaration's
<propref ref="a-name"/> and <propref ref="a-target_namespace"/> are the same as
a declaration which would be in a pair in the set per clause 1 or 2 above
are not included.</p>
  </item>
 </olist>
</propmap>
<propmap name="ct-attribute_wildcard">As above for the <eltref ref="simpleContent"/> alternative</propmap>
<propmap name="content_type">
 <olist>
  <item><p>If the <eltref ref="restriction" inside="complexContent"/> alternative is chosen, then</p>
   <olist>
  <item><p>If either 
<olist>
 <item>
  <p>there is no <eltref ref="group"/>, <eltref ref="all"/>, <eltref ref="choice"/> or <eltref ref="sequence"/> among the &i-children;</p>
 </item>
</olist>
         or
         <olist>
          <item>
           <p>there is an <eltref ref="all"/> or <eltref ref="sequence"/> among
the &i-children; with no &i-children; of its own excluding <eltref ref="annotation"/></p>
          </item>
         </olist>
         or
         <olist>
          <item>
           <p>there is a <eltref ref="choice"/> among
the &i-children; with no &i-children; of its own excluding <eltref ref="annotation"/> whose <code>minOccurs</code> &i-attribute; has the &i-value; <code>0</code></p>
          </item>
         </olist>
then <pt>empty</pt>;</p></item>
  <item>
   <p>otherwise a pair consisting of 
    <ulist>
     <item>
      <p>if the <code>mixed</code> &i-attribute; is present on <eltref ref="complexContent"/>, then <pt>mixed</pt> if its &i-value; is <code>true</code>, otherwise <pt>elementOnly</pt>;</p>
      <p>otherwise if the <code>mixed</code> &i-attribute; is present on
<eltref ref="complexType"/> and its &i-value; is <code>true</code>, then <pt>mixed</pt>;</p>
      <p>otherwise <pt>elementOnly</pt>.</p>
     </item>
     <item>
      <p>the particle corresponding to
the <eltref ref="all"/>, <eltref ref="choice"/>, <eltref ref="group"/> or
<eltref ref="sequence"/> among the &i-children;</p>
     </item>
    </ulist>
   </p>
  </item>
   </olist>
  </item>
  <item><p>otherwise (the <eltref ref="extension" inside="complexContent"/> alternative is chosen),
<termdef id="key-exg" term="explicit content">let the <term>explicit
content</term> be <pt>empty</pt> if any of the sub-clauses of clause 1.1 above
applies, otherwise the particle corresponding to
the <eltref ref="all"/>, <eltref ref="choice"/>, <eltref ref="group"/> or
<eltref ref="sequence"/> among the &i-children;.</termdef>
    <olist>
        <item>
         <p>if the <termref def="key-exg">explicit
content</termref> is <pt>empty</pt>, then the
<propref ref="content_type"/> of the type definition <termref def="src-resolve">resolved</termref> to
by the &i-value; of the <code>base</code> &i-attribute; </p>
        </item>
       </olist>
       otherwise
       <olist>
        <item>
         <p>if the type definition <termref def="src-resolve">resolved</termref> to
by the &i-value; of the <code>base</code> &i-attribute; has a <propref ref="content_type"/> of <pt>empty</pt>, then a pair of <pt>mixed</pt> or <pt>elementOnly</pt> (determined as per clause 1.2 above) and the <termref def="key-exg">explicit content</termref> itself</p>
        </item>
       </olist>
       otherwise
       <olist>
        <item>
         <p>a pair of <pt>mixed</pt> or <pt>elementOnly</pt> (determined as per
clause 1.2 above) and a particle whose properties are as follows:
       <glist>
        <gitem>
         <label><propref ref="p-min_occurs"/></label>
         <def>
          <p><code>1</code></p>
         </def>
        </gitem>
        <gitem>
         <label><propref ref="p-max_occurs"/></label>
         <def>
          <p><code>1</code></p>
         </def>
        </gitem>
        <gitem>
         <label><propref ref="term"/></label>
         <def>
          <p>A model group whose <propref ref="compositor"/> is
<pt>sequence</pt> and whose <propref ref="particles"/> are the particle of
the <propref ref="content_type"/> of the type definition <termref def="src-resolve">resolved</termref> to
by the &i-value; of the <code>base</code> &i-attribute; followed by the
<termref def="key-exg">explicit content</termref>.</p>
         </def>
        </gitem>
       </glist></p>
        </item>
       </olist></p></item>
 </olist>
</propmap>
</reprcomp>
</reprdef>
<constraintnote id="src-ct" type="src">
  <head>Complex Type Definition Representation OK</head>
  <p>In addition to the conditions imposed on <eltref ref="complexType"/> element
information items by the schema for schemas, the following must also hold:
   <olist>
    <item>
     <p>If the <eltref ref="complexContent"/> alternative is chosen, the type definition <termref def="src-resolve">resolved</termref> to
by the &i-value; of the <code>base</code> &i-attribute; must be a complex type definition;</p>
    </item>
    <item>
     <p>If the <eltref ref="simpleContent"/> alternative is chosen, the type definition <termref def="src-resolve">resolved</termref> to
by the &i-value; of the <code>base</code> &i-attribute; must be either a complex type
definition whose <propref ref="ct-base_type_definition"/> is a simple type definition or, only if the
<eltref ref="extension" inside="simpleContent"/> alternative is also chosen, a simple type definition;</p>
    </item>
    <item>
     <p>The corresponding complex type definition component must satisfy the conditions set
out in <specref ref="coss-ct"/>;</p>
    </item>
    <item>
     <p>If clause 2 in the correspondence specification above for <propref ref="ct-attribute_wildcard"/> obtains, the intensional intersection must be expressible, as defined in <specref ref="cos-aw-intersect"/>.</p>
    </item>
   </olist>
  </p>
 </constraintnote>
 <note>
  <p>Aside from the simple coherence requirements enforced above, constraining
type definitions identified as restrictions to actually <emph>be</emph>
restrictions, that is, to <termref def="key-vn">validate</termref> a
subset of the items which are
<termref def="key-vn">validated</termref> by their base type definition, is enforced in <specref ref="coss-ct"/>.</p>
 </note>
<p>Careful consideration of the above concrete syntax reveals that
a type definition need consist of no more than a name, i.e. that
 <code>&lt;complexType name="anyThing"/></code> is allowed.  The result is
however not of much use, as it will have <code>empty</code> <propref ref="content_type"/> and no allowed attributes.</p>
 <note role="example">
    <eg xml:space="preserve"><![CDATA[<xs:complexType name="length1">
 <xs:simpleContent>
  <xs:extension base="xs:non-negative-integer">
   <xs:attribute name="unit" type="xs:NMTOKEN"/>
  </xs:extension>
 </xs:simpleContent>
</xs:complexType>

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

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

<xs:complexType name="length2">
 <xs:complexContent>
  <xs:restriction base="xs:anyType">
   <xs:sequence>
    <xs:element name="size" type="xs:non-positive-integer"/>
    <xs:element name="unit" type="xs:NMTOKEN"/>
   </xs:sequence>
  </xs:restriction>
 </xs:complexContent>
</xs:complexType>

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

  <depth>
   <size>2.54</size><unit>cm</unit>
  </depth>

<xs:complexType name="length3">
 <xs:sequence>
  <xs:element name="size" type="xs:non-positive-integer"/>
  <xs:element name="unit" type="xs:NMTOKEN"/>
 </xs:sequence>
</xs:complexType>
]]>
</eg>
  <p>
    Three approaches to defining a type for length:  one with
character data content constrained by reference to
    a built-in datatype, and one attribute, the other two using two
elements.  <code>length3</code> is the abbreviated alternative to
<code>length2</code>:  they correspond to identical type definition components.
</p>
</note>
 
<note role="example">
   <eg xml:space="preserve"><![CDATA[<xs:complexType name="personName">
 <xs:sequence>
  <xs:element name="title" minOccurs="0"/>
  <xs:element name="forename" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="surname"/>
 </xs:sequence>
</xs:complexType>

<xs:complexType name="extendedName">
 <xs:complexContent>
  <xs:extension base="personName">
   <xs:sequence>
    <xs:element name="generation" minOccurs="0"/>
   </xs:sequence>
  </xs:extension>
 </xs:complexContent>
</xs:complexType>

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

  <addressee>
   <forename>Albert</forename>
   <forename>Arnold</forename>
   <surname>Gore</surname>
   <generation>Jr</generation>
  </addressee>]]></eg>
   <p>A type definition for personal names, and a definition derived by
extension which adds a single element; an element declaration referencing the
derived definition, and a <termref def="key-vn">valid</termref> instance thereof.</p>
  </note> 
<note role="example">
   <eg xml:space="preserve"><![CDATA[<xs:complexType name="simpleName">
 <xs:complexContent>
  <xs:restriction base="personName">
   <xs:sequence>
    <xs:element name="title" maxOccurs="0"/>
    <xs:element name="forename" minOccurs="1" maxOccurs="1"/>
    <xs:element name="surname"/>
   </xs:sequence>
  </xs:restriction>
 </xs:complexContent>
</xs:complexType>

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

   <who>
    <forename>Bill</forename>
    <surname>Clinton</surname>
   </who>]]></eg>
   <p>A simplified type definition
derived from the base type from the previous example by restriction, eliminating one optional daughter and
fixing another to occur exactly once; an element declared by reference to it,
and a <termref def="key-vn">valid</termref> instance thereof.</p>
  </note>
 <note role="example">
  <eg xml:space="preserve"><![CDATA[<xs:complexType name="paraType" mixed="true">
 <xs:choice minOccurs="0" maxOccurs="unbounded">
  <xs:element ref="emph"/>
  <xs:element ref="strong"/>
 </xs:choice>
 <xs:attribute name="version" type="xs:decimal"/>
</xs:complexType>]]></eg>
  <p>A further illustration of the abbreviated form, with the
<code>mixed</code> attribute appearing on <code>complexType</code> itself.</p>
 </note>
 <ednote role="pf">
  <edtext>The Working Group solicits feedback on whether the fixed order of
content model, then attribute declarations within <eltref ref="restriction" inside="complexContent"/> and <eltref ref="extension" inside="complexContent"/> is acceptable.</edtext>
 </ednote>
</div3>
 <div3 id="declare-attributeGroup">
<head>XML Representation of Attribute Group Definition Schema Components</head>
<p>The XML representation for an attribute group definition schema component is an
<eltref ref="attributeGroup"/> element information item.  It provides for
naming a group of attribute declarations and an attribute wildcard for use by reference in the XML representation of
complex type definitions and other attribute group definitions.  The correspondences between the
properties of the information item and
properties of the component it corresponds to are as follows:</p>

 <reprdef>
 <reprelt eltname="attributeGroup" type="attributeGroup"/>
  <p>When an <eltref ref="attributeGroup"/> appears as a daughter of
<eltref ref="schema"/> or <eltref ref="redefine"/>, it corresponds to an attribute group definition as
below.  When it appears as a daughter of <eltref ref="complexType"/> or <eltref ref="attributeGroup"/>, it does not correspond to any component as such.</p>
 <reprcomp abstract="Attribute Group Definition" ref="Attribute_Group_Definition_details">
  <propmap name="ag-name">The &i-value; of the <code>name</code> &i-attribute;</propmap>
  <propmap name="ag-target_namespace">The &i-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <code>schema</code>
element information item.</propmap>
  <propmap name="ag-attribute_declarations">The union of the set of <termref def="key-aup">attribute use pair</termref>s corresponding to the <eltref ref="attribute"/> &i-children;, if any, with the <propref ref="ag-attribute_declarations"/> of the
attribute groups <termref def="src-resolve">resolved</termref> to by the &i-value;s of the <code>ref</code>
&i-attribute; of the <eltref ref="attributeGroup" inside="simpleContent"/> &i-children;, if any.</propmap>
<propmap name="ag-attribute_wildcard">As for <propref ref="ct-attribute_wildcard"/> as described in <specref ref="declare-type"/>, except that clause 1.2 is irrelevant and cannot obtain</propmap>
<propmap name="ag-annotation">The annotation corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, otherwise <termref def="key-null">absent</termref></propmap>
</reprcomp></reprdef>
<note role="example">
<eg xml:space="preserve">&lt;xs:attributeGroup name="myAttrGroup"&gt;
    &lt;xs:attribute . . ./&gt;
    . . .
&lt;/xs:attributeGroup&gt;

&lt;xs:complexType name="myelement"&gt;
    . . .
    &lt;xs:attributeGroup ref="myAttrGroup"/&gt;
&lt;/xs:complexType&gt;
</eg>
<p>Define and refer to an attribute group. The effect is as if the attribute
declarations in the group were present in the type definition.</p>
</note>


 <p>The example above illustrates a pattern which
recurs in the XML representation of schemas:  The same element, in this case <code>attributeGroup</code>, serves both to
define and to incorporate by reference.  In the first case the
<code>name</code> attribute is required, in the second the <code>ref</code>
attribute is required, and the element must be empty.  These two are mutually exclusive, and also conditioned
by context:  the defining form, with a <code>name</code>, must occur at the top
level of a schema, whereas the referring form, with a <code>ref</code>, must
occur within a complex type definition or an attribute group definition.</p>
 
<constraintnote id="src-attribute_group" type="src">
  <head>Attribute Group Definition Representation OK</head>
  <p>In addition to the conditions imposed on <eltref ref="attributeGroup"/> element
information items by the schema for schemas, the following must also hold:
   <olist>
    <item>
     <p>The corresponding attribute group definition, if any, must satisfy the conditions set
out in <specref ref="coss-attrGroup"/>.</p>
    </item>
    <item>
     <p>If clause 2 in the correspondence specification in <specref ref="declare-type"/> for <propref ref="ct-attribute_wildcard"/>, as referenced above, obtains, the intensional intersection must be expressible, as defined in <specref ref="cos-aw-intersect"/>.</p>
    </item>
     <item>
      <p>Circular group reference is disallowed outside <eltref ref="redefine"/>.  That is, unless this element information item's parent is <eltref ref="redefine"/>, then among the
&i-children;, if any, there may not be at any depth a <eltref ref="attributeGroup" inside="simpleContent"/> with <code>ref</code> &i-attribute; which resolves to the component corresponding to this <eltref ref="attributeGroup"/>, or to any other attribute group definition component which contains this component at any depth.</p>
     </item>
   </olist>
  </p>
 </constraintnote>
</div3>
<div3 id="declare-namedModelGroup">
<head>XML Representation of Model Group Definition Schema Components</head>
 <p>The XML representation for a model group definition schema component is a
<eltref ref="group"/> element information item.  It provides for
naming a model group for use by reference in the XML representation of
complex type definitions and model groups.  The correspondences between the
properties of the information item and
properties of the component it corresponds to are as follows:</p>
<reprdef>
 <reprelt eltname="group" type="realGroup"/> 
 <p>If there is a <code>name</code> &i-attribute; (in which case the
item will have <eltref ref="schema"/> or <eltref ref="redefine"/> as parent), then the item corresponds to
a model group definition component with properties as follows:</p>
 <reprcomp abstract="Model Group Definition" ref="Model_Group_Definition_details">
<propmap name="mg-name">The &i-value; of the
<code>name</code> &i-attribute;</propmap>

  <propmap name="mg-target_namespace">The &i-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <code>schema</code>
element information item</propmap>
<propmap name="model_group">A model group which is the <propref ref="term"/> of a
particle corresponding to the <eltref ref="all"/>, <eltref ref="choice"/> or
<eltref ref="sequence"/> among the &i-children; (there must be one)</propmap>
<propmap name="mg-annotation">The annotation corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, otherwise <termref def="key-null">absent</termref></propmap>
</reprcomp>
 <p>Otherwise, the item will have a <code>ref</code> &i-attribute;,
in which case it corresponds to a particle component with properties as follows (unless <code>minOccurs=maxOccurs=0</code>, in which case the item
corresponds to no component at all):</p>
 <reprcomp abstract="Particle" ref="Particle">
  <propmap name="p-min_occurs">The &i-value; of the <code>minOccurs</code>
&i-attribute;, if present, otherwise <code>1</code></propmap>
  <propmap name="p-max_occurs"><pt>unbounded</pt>, if the <code>maxOccurs</code>
&i-attribute; equals <pt>unbounded</pt>, otherwise the numeric &i-value; of the <code>maxOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap name="term">the &i-value; of the <propref ref="model_group"/> of the
model group definition <termref def="src-resolve">resolved</termref> to by the &i-value; of the <code>ref</code> &i-attribute;</propmap>
  </reprcomp>
</reprdef>
 <p>Given the constraints on its appearance in content models, an <eltref ref="all"/> should only occur as the only item in the &i-children;:  see <specref ref="coss-modelGroup"/>.</p>
<note role="example">
<eg xml:space="preserve">&lt;xs:group name="myModelGroup"&gt;
 &lt;xs:sequence&gt;
  &lt;xs:element ref="someThing"/&gt;
 &lt;/xs:sequence&gt;
&lt;/xs:group&gt;

&lt;xs:complexType name="trivial"&gt;
 &lt;xs:sequence>
  &lt;xs:group ref="myModelGroup"/&gt;
 &lt;/xs:sequence>
 &lt;xs:attribute .../&gt;
&lt;/xs:complexType&gt;

&lt;xs:complexType name="moreSo"&gt;
 &lt;xs:choice&gt;
  &lt;xs:element ref="anotherThing"/&gt;
  &lt;xs:group ref="myModelGroup"/&gt;
 &lt;/xs:choice&gt;
 &lt;xs:attribute .../&gt;
&lt;/xs:complexType&gt;

</eg>
<p>A minimal model group is defined and used by reference, first as the whole
content model, then as one alternative in a choice. </p>
</note>
<constraintnote id="src-model_group_defn" type="src">
  <head>Model Group Definition Representation OK</head>
  <p>In addition to the conditions imposed on <eltref ref="group"/> element
information items by the schema for schemas, the following must also hold:
   <olist>
    <item>
     <p>The corresponding model group definition, if any, must satisfy the conditions set
out in <specref ref="coss-modelGroup"/>.</p>
    </item>
    <item>
      <p>Circular group reference is disallowed outside <eltref ref="redefine"/>.  That is, unless this element information item's parent is <eltref ref="redefine"/>, then within the <eltref ref="all"/>, <eltref ref="choice"/> and <eltref ref="sequence"/> among the &i-children;, if any, there may not be at any depth a <eltref ref="group"/> with <code>ref</code> &i-attribute; which resolves to the component corresponding to this <eltref ref="group"/>, or to any other group definition component which contains this component at any depth.</p>
     </item>
   </olist>
  </p>
 </constraintnote>
</div3>
 <div3 id="declare-contentModel">
<head>XML Representation of Model Group Schema Components</head>
<p>The XML representation for a model group schema component is
either an
<eltref ref="all"/>, a <eltref ref="choice"/> or a <eltref ref="sequence"/>
element information item.    The correspondences between the
properties of those information items and
properties of the component they correspond to are as follows:</p>
<reprdef>
 <reprelt eltname="all"/>
 <reprelt eltname="choice"/>
 <reprelt eltname="sequence"/>  
 <p>Each of the above items corresponds to a particle containing a model
group, with properties as follows (unless <code>minOccurs=maxOccurs=0</code>, in which case the item
corresponds to no component at all):</p>
 <reprcomp abstract="Particle" ref="Particle_details">
<propmap name="p-min_occurs">The &i-value; of the <code>minOccurs</code>
&i-attribute;, if present, otherwise <code>1</code></propmap>
  <propmap name="p-max_occurs"><pt>unbounded</pt>, if the <code>maxOccurs</code>
&i-attribute; equals <pt>unbounded</pt>, otherwise the numeric &i-value; of the <code>maxOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
<propmap name="term">A model group as given below</propmap>
</reprcomp><reprcomp abstract="Model Group" ref="Model_Group_details">
<propmap name="compositor">One of <pt>all</pt>, <pt>choice</pt>,
<pt>sequence</pt> depending on the element information item</propmap>
<propmap name="particles">a sequence of particles
corresponding to all the <eltref ref="all"/>, <eltref ref="choice"/>,
<eltref ref="sequence"/>, <eltref ref="any"/>,
<eltref ref="group"/> or <eltref ref="element"/> items among the &i-children;,
in order</propmap>
<propmap name="amg-annotation">The annotation corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, otherwise <termref def="key-null">absent</termref></propmap>
</reprcomp>
</reprdef>
  <constraintnote type="src" id="src-model_group">
   <head>Model Group Representation OK</head>
   <p>In addition to the conditions imposed on <eltref ref="all"/>, <eltref ref="choice"/> and <eltref ref="sequence"/> element
information items by the schema for schemas, the following must also hold:
    <olist>
    <item>
     <p>The corresponding particle and model group must satisfy the conditions set
out in <specref ref="coss-modelGroup"/> and <specref ref="coss-particle"/>.</p>
    </item>
   </olist>
   </p>
  </constraintnote>
</div3>
   <div3 id="declare-openness">
    <head>XML Representation of Wildcard Schema Components</head>
    <p>The XML representation for a wildcard schema component is an
<eltref ref="any"/> or <eltref ref="anyAttribute"/> element information item.    The correspondences between the
properties of an <eltref ref="any"/> information item and
properties of the components it corresponds to are as follows (see <eltref ref="complexType"/> and <eltref ref="attributeGroup"/> for the correspondences for <eltref ref="anyAttribute"/>):</p>
    <reprdef>
 <reprelt eltname="any"/>
     <p>A particle containing a wildcard, with properties as follows (unless <code>minOccurs=maxOccurs=0</code>, in which case the item
corresponds to no component at all):</p>
     <reprcomp abstract="Particle" ref="Particle_details">
<propmap name="p-min_occurs">The &i-value; of the <code>minOccurs</code>
&i-attribute;, if present, otherwise <code>1</code></propmap>
  <propmap name="p-max_occurs"><pt>unbounded</pt>, if the <code>maxOccurs</code>
&i-attribute; equals <pt>unbounded</pt>, otherwise the numeric &i-value; of the <code>maxOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
<propmap name="term">A wildcard as given below</propmap>
</reprcomp>
 <reprcomp abstract="Wildcard" ref="Wildcard_details">
<propmap name="namespace_constraint">Dependent on the &i-value; of the
<code>namespace</code> &i-attribute;: if absent, then <pt>any</pt>, otherwise as follows:<glist>
  <gitem>
   <label>##any</label>
   <def>
    <p><pt>any</pt></p>
   </def>
  </gitem>
  <gitem>
   <label>##other</label>
   <def>
    <p>a pair of <pt>not</pt> and the &i-value; of the <code>targetNamespace</code> &i-attribute; of the <eltref ref="schema"/> ancestor
element information item if present, otherwise <termref def="key-null">absent</termref></p>
   </def>
  </gitem>
  <gitem>
   <label><emph>otherwise</emph></label>
   <def>
    <p>a set whose members are namespace URIs corresponding to the
space-delimited substrings of the string, except
     <olist>
      <item>
       <p>if one such
substring is <code>##targetNamespace</code>, the corresponding member is the &i-value; of the <code>targetNamespace</code> &i-attribute; of the <eltref ref="schema"/> ancestor
element information item if present, otherwise <termref def="key-null">absent</termref></p>
      </item>
      <item>
       <p>if one such
substring is <code>##local</code>, the corresponding member is <termref def="key-null">absent</termref></p>
      </item>
     </olist>
    </p>
   </def>
  </gitem>
 </glist>
</propmap>
  <propmap name="process_contents">One of <pt>lax</pt>, <pt>skip</pt>,
<pt>strict</pt>, corresponding to the &i-value; of the
<code>processContents</code> &i-attribute;, if present, otherwise <pt>strict</pt></propmap>
<propmap name="w-annotation">The annotation corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, otherwise <termref def="key-null">absent</termref></propmap>
</reprcomp></reprdef>
    <p>Wildcards are subject to the same ambiguity constraints
(<specref ref="cos-nonambig"/>) as other
content model particles:  If an instance element could match either an explicit
particle and a wildcard, or one of two wildcards, within the content model of a
type, that model is in error.</p>
    <note role="example"><eg xml:space="preserve"><![CDATA[<xs:any processContents="skip"/>

<xs:any namespace="##other" processContents="lax"/>

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

<xs:any namespace="##targetNamespace"/>

<xs:anyAttribute namespace="http://www.w3.org/XML/1998/namespace"/>]]></eg>
    <p>Concrete examples of the four basic types of wildcard, plus one attribute wildcard.</p>
</note>
    <constraintnote type="src" id="src-wildcard">
   <head>Wildcard Representation OK</head>
   <p>In addition to the conditions imposed on <eltref ref="any"/> element
information items by the schema for schemas, the following must also hold:
    <olist>
    <item>
     <p>The corresponding particle and model group must satisfy the conditions set
out in <specref ref="coss-modelGroup"/> and <specref ref="coss-particle"/>.</p>
    </item>
   </olist>
   </p>
  </constraintnote>
   </div3>
   <div3 id="declare-key">
    <head>XML Representation of &Constraint; Definition Schema Components</head>
<p>The XML representation for an &constraint; definition schema component is
either a
<eltref ref="key"/>, a <eltref ref="keyref"/> or a <eltref ref="unique"/>
element information item.    The correspondences between the
properties of those information items and
properties of the component they correspond to are as follows:</p>
    <reprdef>
 <reprelt eltname="unique"/>
 <reprelt eltname="key"/>
 <reprelt eltname="keyref"/>
 <reprelt eltname="selector"/>
 <reprelt eltname="field"/>
 <reprcomp abstract="&Constraint; Definition" ref="&Constraint;_Definition_details"><propmap name="c-name">The &i-value; of the <code>name</code> &i-attribute;</propmap>
  <propmap name="c-target_namespace">The &i-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <code>schema</code>
element information item.</propmap>
<propmap name="&constraint;_name">One of <pt>key</pt>, <pt>keyref</pt> or
<pt>unique</pt>, depending on the item</propmap>
<propmap name="selector">An XPath expression corresponding to the &i-value; of
the <eltref ref="selector"/> element information item among the &i-children;</propmap>
<propmap name="fields">A sequence of XPath expressions, corresponding to the
&i-value;s of the <eltref ref="field"/> element information item &i-children;, in order.</propmap>
<propmap name="referenced_key">If the item is a <eltref ref="keyref"/>, the
&constraint; definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>refer</code> &i-attribute;, otherwise <termref def="key-null">absent</termref></propmap>
<propmap name="rc-annotation">The annotation corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, otherwise <termref def="key-null">absent</termref></propmap>
</reprcomp></reprdef>
    <p>The <code>XPathExprApprox</code> simple type referenced above
is defined in <specref ref="normative-schemaSchema"/>.  It is a
permissive approximation to the syntax of XPath expressions as defined
in <bibref ref="bib-xpath"/>, and is <emph>not</emph> an accurate
reconstruction of that syntax.  Its use by reference from other schema
documents is deprecated: In due course a schema for XPath
will be published which includes a simple type definition appropriate
for widespread use.</p>
    
    <note role="example">
     <eg xml:space="preserve"><![CDATA[<xs:element name="state">
 <xs:complexType>
  <xs:sequence>
   <xs:element name="stateCode" type="twoLetterCode"/>
   <xs:element name="vehicle">
    <xs:complexType>
     . . .
     <xs:attribute name="regNo" type="xs:integer"/>
    </xs:complexType>
   </xs:element>
  </xs:sequence>
 </xs:complexType>
</xs:element>

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

<xs:element name="person">
 <xs:complexType>
  <xs:sequence>
   . . .
   <xs:element name="car">
    <xs:complexType>
     . . .
     <xs:attribute name="regRef" type="xs:integer"/>
     <xs:attribute name="regState" type="twoLetterCode"/>
    </xs:complexType>
   </xs:element>
  </xs:sequence>
 </xs:complexType>

 <xs:keyref name="carRef" refer="regKey">
  <xs:selector xpath=".//car[@regRef]"/>
  <xs:field xpath="@regRef"/>
  <xs:field xpath="@regState"/>
 </xs:keyref>
</xs:element>]]></eg>
     <p>A <code>state</code> element is defined, which <emph>inter alia</emph>
contains a <code>stateCode</code> descendant and some <code>vehicle</code>
descendants.  A <code>vehicle</code> in turn has a <code>regNo</code> attribute,
which is an integer.  The combination of <code>stateCode</code> and
<code>regNo</code> is asserted to be a <pt>key</pt> for
<code>vehicle</code> within <code>state</code>.  Furthermore, a <code>person</code> element has
inter-alia an empty <code>car</code> element, with <code>regRef</code> and
<code>regState</code> attributes, which are then asserted together to refer to
<code>vehicles</code> via the <code>regKey</code> constraint.</p>
    </note>
    <constraintnote type="src" id="src-&constraint;">
   <head>&Constraint; Definition Representation OK</head>
   <p>In addition to the conditions imposed on <eltref ref="key"/>, <eltref ref="keyref"/> and <eltref ref="unique"/> element
information items by the schema for schemas, the following must also hold:
    <olist>
    <item>
     <p>The corresponding &constraint; definition must satisfy the conditions set
out in <specref ref="coss-&constraint;"/>.</p>
    </item>
   </olist>
   </p>
  </constraintnote>
 </div3>
<div3 id="declare-notation">
<head>XML Representation of Notation Declaration Schema Components</head>
<p>The XML representation for a notation declaration schema component is
a
<eltref ref="notation"/>
element information item.    The correspondences between the
properties of that information item and
properties of the component it corresponds to are as follows:</p>
 <reprdef>
 <reprelt eltname="notation"/>
 <reprcomp abstract="Notation Declaration" ref="Notation_Declaration_details">
<propmap name="n-name">The &i-value; of the
<code>name</code> &i-attribute;</propmap>
  <propmap name="n-target_namespace">The &i-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <code>schema</code>
element information item.</propmap>
<propmap name="system_identifier">A URI reference corresponding to the &i-value; of the <code>system</code>
&i-attribute;, if present, otherwise <termref def="key-null">absent</termref></propmap>
<propmap name="public_identifier">A URI reference corresponding to the &i-value; of the <code>public</code> &i-attribute;</propmap>
<propmap name="n-annotation">The annotation corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, otherwise <termref def="key-null">absent</termref></propmap>
</reprcomp></reprdef>
<note role="example">
<eg xml:space="preserve">
&lt;xs:notation name="jpeg"
             public="image/jpeg" system="viewer.exe" /&gt;

&lt;xs:element name="picture"&gt;
 &lt;xs:complexType>
  &lt;xs:complexContent>
   &lt;xs:extension base="xs:binary"&gt;
    &lt;xs:attribute name="pictype" type="xs:NOTATION"/&gt;
   &lt;/xs:extension>
  &lt;/xs:complexContent>
 &lt;/xs:complexType&gt;
&lt;/xs:element&gt;

&lt;picture pictype="jpeg"&gt;...&lt;/picture>
</eg>

</note>
 <constraintnote type="src" id="src-notation">
   <head>Notation Definition Representation OK</head>
   <p>In addition to the conditions imposed on <eltref ref="notation"/> element
information items by the schema for schemas, the following must also hold:
    <olist>
    <item>
     <p>The corresponding notation definition must satisfy the conditions set
out in <specref ref="coss-notation"/>.</p>
    </item>
   </olist>
   </p>
  </constraintnote>
</div3>
<div3 id="declare-annotation">
<head>XML Representation of Annotation Schema Components</head>
 <p>Annotation of schemas and schema components, with material for human or
computer consumption, is provided for by allowing application information and
human information at the beginning of most major schema elements, and anywhere
at the top level of schemas.  The XML representation for an annotation schema component is
an
<eltref ref="annotation"/>
element information item.    The correspondences between the
properties of that information item and
properties of the component it corresponds to are as follows:</p>
 <reprdef>
 <reprelt eltname="annotation"/>
 <reprelt eltname="appinfo"/>
 <reprelt eltname="documentation"/>
 <reprcomp abstract="Annotation" ref="Annotation_details">
<propmap name="application_information">A sequence of the <eltref ref="appinfo"/> element
information items from among the &i-children;, in order, if any, otherwise the
empty sequence.</propmap>
<propmap name="user_information">A sequence of the <eltref ref="documentation"/> element
information items from among the &i-children;, in order, if any, otherwise the
empty sequence.</propmap>
</reprcomp></reprdef>
 <constraintnote type="src" id="src-annotation">
   <head>Annotation Definition Representation OK</head>
   <p>In addition to the conditions imposed on <eltref ref="annotation"/> element
information items by the schema for schemas, the following must also hold:
    <olist>
    <item>
     <p>The corresponding annotation must satisfy the conditions set
out in <specref ref="coss-annotation"/>.</p>
    </item>
   </olist>
   </p>
  </constraintnote>
</div3>
 <div3 id="declare-datatype">
  <head>(non-normative) XML Representation of Simple Type Definition Schema Components</head>
<note>
  <p>This section reproduces a version of material from <bibref ref="ref-xsp2"/>, for local cross-reference purposes.</p>
 </note>
 <reprdef>
 <reprelt eltname="simpleType" type="simpleType"/>
 <reprelt eltname="restriction"/>
 <reprelt eltname="list"/>
 <reprelt eltname="union"/>
 <reprcomp abstract="Simple Type Definition" ref="Simple_Type_Definition_details">
  <propmap name="st-name">The &i-value; of the <code>name</code> &i-attribute; if present, otherwise <termref def="key-null">absent</termref></propmap>
  <propmap name="st-target_namespace">The &i-value; of the
<code>targetNamespace</code> &i-attribute; of the <eltref ref="schema"/> ancestor
element information item if present, otherwise <termref def="key-null">absent</termref></propmap>
  <propmap name="st-base_type_definition">The type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>base</code> &i-attribute;, if present, otherwise the
type definition corresponding to the <eltref ref="simpleType"/> among
the &i-children; of <eltref ref="restriction"/>, if present, otherwise (the
<eltref ref="restriction"/> alternative is not chosen), the <termref def="simple-ur-type-itself">simple ur-type definition</termref>.</propmap>
  <propmap name="variety">If there is a <eltref ref="list"/> among the
&i-children;, then <pt>list</pt>, otherwise if there is a <eltref ref="union"/> among the
&i-children;, then <pt>union</pt>, otherwise (there is a <eltref ref="restriction"/> among the
&i-children;), then the <propref ref="variety"/> of the <propref ref="st-base_type_definition"/></propmap>
</reprcomp>
  <p>If the <propref ref="variety"/> is <pt>atomic</pt>, the following
additional property mappings also apply:</p>
  <reprcomp abstract="Atomic Simple Type Definition" ref="Simple_Type_Definition_details">
   <propmap name="st-primitive_type_definition">The built-in primitive type
definition from which the <propref ref="st-base_type_definition"/> is derived.</propmap>
   <propmap name="facets">a set of facet components <termref def="key-facets-restriction">constituting a restriction</termref>
of the <propref ref="facets"/> of the
<propref ref="st-base_type_definition"/> with respect to a
set of facet components corresponding to the appropriate element information items among the
&i-children; (i.e. those which specify facets, if any), as
defined in <specref ref="st-restrict-facets"/>.</propmap>
</reprcomp>
  <p>If the <propref ref="variety"/> is <pt>list</pt>, the following
additional property mappings also apply:</p>
  <reprcomp abstract="List Simple Type Definition" ref="Simple_Type_Definition_details">
   <propmap name="st-item_type_definition">Starting from the <eltref ref="list"/> among the &i-children; of <eltref ref="simpleType"/> or the <eltref ref="list"/> among the &i-children; of <eltref ref="restriction"/>, whichever is present, the type definition <termref def="src-resolve">resolved</termref> to by the
&i-value; of the <code>itemType</code> &i-attribute;, if present, otherwise the
type definition corresponding to the <eltref ref="simpleType"/> among
the &i-children;.</propmap>
   <propmap name="facets">If the <eltref ref="restriction"/> alternative is
chosen, a
set of facet components corresponding to the appropriate element information items among the
&i-children; (i.e. those which specify facets, if any), otherwise the empty set.</propmap>
</reprcomp>
  <p>If the <propref ref="variety"/> is <pt>union</pt>, the following
additional property mappings also apply:</p>
  <reprcomp abstract="Union Simple Type Definition" ref="Simple_Type_Definition_details">
   <propmap name="st-member_type_definitions"><termdef id="key-exm" term="explicit members">Define the <term>explicit members</term> as follows:</termdef>  Starting from the <eltref ref="union"/> among the &i-children; of <eltref ref="simpleType"/> or the <eltref ref="union"/> among the &i-children; of <eltref ref="restriction"/>, whichever is present, the type definitions <termref def="src-resolve">resolved</termref> to by the
space-delimited items in the &i-value; of the <code>memberTypes</code>
&i-attribute;, if any, followed by the
type definitions corresponding to the <eltref ref="simpleType"/>s among
the &i-children;, if any.  The actual value is then formed by replacing any union type definition
in the <termref def="key-exm">explicit members</termref> with its <propref ref="st-member_type_definitions"/>.
   </propmap>
   <propmap name="facets">If the <eltref ref="restriction"/> alternative is
chosen, a
set of facet components corresponding to the appropriate element information items among the
&i-children; (i.e. those which specify facets, if any), otherwise the empty set.</propmap>
</reprcomp>
 </reprdef>
  <constraintnote type="src" id="st-restrict-facets">
   <head>Simple Type Restriction (Facets)</head>
   <p>A simple type definition (call it <B>R</B>) restricts another simple type
definition (call it <B>B</B>) with a
set of facets (call this <B>S</B>) if: 
    <olist>
     <item>
      <p>The <propref ref="variety"/> and <propref ref="st-primitive_type_definition"/> of <B>R</B> are the same as those of <B>B</B>;</p>
     </item>
     <item>
      <p>The <propref ref="facets"/> of <B>R</B> are the union of <B>S</B> and
the <propref ref="facets"/> of <B>B</B>, without duplicates.  To avoid
duplicates, when a facet of the same kind occurs in both <B>S</B> and
the <propref ref="facets"/> of <B>B</B>, the one in the <propref ref="facets"/>
of <B>B</B> is not included, with the exception of <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#dt-enumeration">enumeration</xtermref> and <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#dt-pattern">pattern</xtermref> facets, for which multiple occurrences with distinct values are allowed.</p>
     </item>
    </olist>
   </p>
   <p><termdef id="key-facets-restriction" term="constitute a restriction">If
clause 1.2 above holds, we say that the <propref ref="facets"/> of <B>R</B> constitute a
<term>constitute a restriction</term> of the <propref ref="facets"/> of
<B>B</B> with respect to <B>S</B>.</termdef></p>
  </constraintnote>
</div3>
</div2>
</div1>
   <div1 id="conformance-details">
 <head>Schema Component Validity Constraints</head>
    <p>This chapter presents the constraints each kind of schema component must
satisfy to <emph>be</emph> a component.</p>
 <div2 id="coss-attribute">
  <head>Attribute Declaration Constraints</head>
  <p>All attribute declarations (see <specref ref="Attribute_Declaration_details"/>) must satisfy the following constraints.</p>
  <constraintnote type="cos" id="a-props-correct">
   <head>Attribute Declaration Properties Correct</head>
   <olist>
    <item>
     <p>The values of the properties of an attribute declaration must be as described in
the property tableau in
<specref ref="Attribute_Declaration_details"/>, modulo the impact of <specref ref="conformance-missing"/>;</p>
    </item>
    <item>
     <p>if there is a <propref ref="a-value_constraint"/>, its string must be
<termref def="key-vn">valid</termref> with respect to the <propref ref="a-simple_type_definition"/> as
defined in <specref ref="cvc-simple-type"/>
     </p>
    </item>
   </olist>
  </constraintnote>
  <constraintnote type="cos" id="no-xmlns">
   <head><code>xmlns</code> Not Allowed</head>
   <p>The <propref ref="a-name"/> of an attribute declaration must not match <code>xmlns</code>.</p>
<note>
<p>The <propref ref="a-name"/> of an attribute is an <termref def="gloss-NCName">NCName</termref>, which implicitly
prohibits attribute declarations of the form <code>xmlns:*</code></p>
</note>
  </constraintnote>
  <constraintnote type="cos" id="no-xsi">
   <head><code>xsi:</code> Not Allowed</head>
   <p>The <propref ref="a-target_namespace"/> of an attribute declaration,
whether local or global, must not match <code>http://www.w3.org/2000/10/XMLSchema-instance</code>.</p>
   <note>
<p>This reinforces the special status of these attributes, so that they not
only <emph>need</emph> not be declared to be allowed in instances, but
<emph>must</emph> not be declared.  It also removes any temptation to experiment with supplying global or fixed values
for e.g. <code>xsi:type</code> or <code>xsi:null</code>, which would be
seriously misleadingly, as they would have no effect.</p>
</note>
  </constraintnote>
 </div2>
 <div2 id="coss-element">
  <head>Element Declaration Constraints</head>
  <p>All element declarations (see <specref ref="Element_Declaration_details"/>) must satisfy the following constraint.</p>
  <constraintnote type="cos" id="e-props-correct">
   <head>Element Declaration Properties Correct</head>
   <olist>
    <item>
     <p>The values of the properties of an element declaration must be as described in
the property tableau in
<specref ref="Element_Declaration_details"/>, modulo the impact of <specref ref="conformance-missing"/>;</p>
    </item>
    <item>
     <p>If there is a <propref ref="e-value_constraint"/>, its string must be
<termref def="key-vn">valid</termref> with respect to the <propref ref="type_definition"/> as defined in <specref ref="cos-valid-default"/>;</p>
    </item>
    <item>
     <p>If there is an <propref ref="class_exemplar"/>, the <propref ref="type_definition"/> of the element declaration must
be validly derived from the <propref ref="type_definition"/> of the <propref ref="class_exemplar"/>, given the value of the <propref ref="e-final"/> of the <propref ref="class_exemplar"/>, as defined in <specref ref="cos-ct-derived-ok"/> (if the <propref ref="type_definition"/> is complex) or as defined in <specref ref="cos-st-derived-ok"/> (if the <propref ref="type_definition"/> is simple).
     </p>
    </item>
   </olist>
  </constraintnote>
  <p>The following constraints define relations appealed to elsewhere in this specification.</p>
  <constraintnote id="cos-valid-default" type="cos">
   <head>Element Default Valid (Immediate)</head>
   <p>A string is a valid default with respect to a type definition if
    <olist>
     <item>
      <p>The type definition is a simple type definition, and the string is
<termref def="key-vn">valid</termref> with respect to that definition as defined by <specref ref="cvc-simple-type"/></p>
     </item>
    </olist>
    or
    <olist>
     <item>
      <p>The type definition is a complex type definition whose <propref ref="content_type"/> is a simple type definition, and the string is
<termref def="key-vn">valid</termref> with respect to that simple type definition as defined by <specref ref="cvc-simple-type"/></p>
     </item>
    </olist>
    or
    <olist><item>
      <p>The type definition is a complex type definition whose <propref ref="content_type"/> is <pt>mixed</pt>, and the <propref ref="content_type"/>'s particle is <termref def="cd-emptiable">emptiable</termref> as defined by <specref ref="cos-group-emptiable"/>.</p>
     </item></olist>
   </p>
  </constraintnote>
  <constraintnote id="cos-equiv-derived-ok-rec" type="cos">
   <head>Substitution Group OK (Transitive)</head>
   <p>An element declaration (call it <B>D</B>) together with a blocking constraint (a subset of
{<pt>substitution</pt>, <pt>extension</pt>, <pt>restriction</pt>}, the value of
a <propref ref="e-exact"/>) is validly substitutable for another element declaration (call it <B>C</B>) if
    <olist>
     <item>
      <p>the blocking constraint does not contain <pt>substitution</pt>;</p>
     </item>
     <item>
      <p>There is a chain of <propref ref="class_exemplar"/>s from <B>D</B> to
<B>C</B>, that is, either <B>D</B>'s <propref ref="class_exemplar"/> is
<B>C</B>, or <B>D</B>'s <propref ref="class_exemplar"/>'s <propref ref="class_exemplar"/> is <B>C</B>, or . . .;</p>
     </item>
     <item>
      <p>The set of all <propref ref="derivation_method"/>s
involved in the derivation of <B>D</B>'s <propref ref="type_definition"/> from
<B>C</B>'s <propref ref="type_definition"/> does not intersect with the union
of the blocking constraint, <B>C</B>'s <propref ref="ct-exact"/> and the
<propref ref="ct-exact"/> of any intermediate <propref ref="type_definition"/>s
in the derivation of <B>D</B>'s <propref ref="type_definition"/> from
<B>C</B>'s <propref ref="type_definition"/>.</p>
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote id="cos-equiv-class" type="cos">
   <head>Substitution Group</head>
   <p><termdef id="key-eq" term="substitution group">Every element declaration
in the <propref ref="element_declarations"/> of a schema defines a
<term>substitution group</term>, a subset of those <propref ref="element_declarations"/>, as follows:</termdef>
    <olist>
     <item>
      <p>The element declaration itself is in the group;</p>
     </item>
     <item>
      <p>the group is closed with respect to <propref ref="class_exemplar"/>, that
is, if any element declaration in the <propref ref="element_declarations"/> 
has a <propref ref="class_exemplar"/> in the group, then it is also in the group itself.</p>
     </item>
    </olist>
   </p>
  </constraintnote>
 </div2>
 <div2 id="coss-&constraint;">
  <head>&Constraint; Definition Constraints</head>
  <p>All &constraint; definitions (see <specref ref="&Constraint;_Definition_details"/>) must satisfy the following constraint.</p>
  <constraintnote type="cos" id="c-props-correct">
   <head>&Constraint; Definition Properties Correct</head>
   <olist>
    <item>
     <p>The values of the properties of an &constraint; definition must be as described in
the property tableau in
<specref ref="&Constraint;_Definition_details"/>, modulo the impact of <specref ref="conformance-missing"/>;</p>
    </item>
    <item>
     <p>If the <propref ref="&constraint;_name"/> is <pt>keyref</pt>, the
cardinality of the <propref ref="fields"/> must equal that of the <propref ref="fields"/> of the <propref ref="referenced_key"/></p>
    </item>
   </olist>
  </constraintnote>
 </div2>
 <div2 id="coss-attrGroup">
  <head>Attribute Group Definition Constraints</head>
<p>All attribute group definitions (see <specref ref="Attribute_Group_Definition_details"/>) must satisfy the following constraint.</p>
  <constraintnote type="cos" id="ag-props-correct">
   <head>Attribute Group Definition Properties Correct</head>
   <olist>
    <item>
     <p>The values of the properties of an attribute group definition must be as described in
the property tableau in
<specref ref="Attribute_Group_Definition_details"/>, modulo the impact of <specref ref="conformance-missing"/>;</p>
    </item>
    <item>
     <p>Two distinct members of the <propref ref="ag-attribute_declarations"/>
may not contain attribute declarations both of whose <propref ref="a-name"/>s
match and whose <propref ref="a-target_namespace"/>s are identical.</p>
    </item>
   </olist>
  </constraintnote>
  <p>The following constraint defines a relation appealed to elsewhere in this specification.</p>
  <constraintnote id="cos-aw-intersect" type="cos">
   <head>Attribute Wildcard Intersection</head>
   <p>An wildcard's <propref ref="namespace_constraint"/> value is the intensional
intersection of two other such values (call them <B>O1</B> and <B>O2</B>) if it
is the value determined as follows
    <olist>
     <item>
      <p>If <B>O1</B> and <B>O2</B> are the same value, then that value;</p>
     </item>
     <item>
      <p>Otherwise if either <B>O1</B> or <B>O2</B> is <pt>any</pt>, then the
other;</p>
     </item>
     <item>
      <p>Otherwise if either <B>O1</B> or <B>O2</B> is a pair of <pt>not</pt>
and a namespace URI and the other is a set of (namespace URIs or <termref def="key-null">absent</termref>), then that set,
minus the negated namespace URI if it was in the set;</p>
     </item>
     <item>
      <p>Otherwise if both <B>O1</B> and <B>O2</B> are sets of (namespace URIs
or <termref def="key-null">absent</termref>), then the intersection of those sets;</p>
     </item>
     <item>
      <p>Otherwise (the two are negations of different namespace URIs) the intersection is not expressible.</p>
     </item>
    </olist>
    In the case where there are more than two values, the intensional
intersection is determined by identifying the intensional intersection of two
of the values as above, then the intensional intersection of that value with
the third (providing the first intersection was expressible), and so on as required.
   </p>
  </constraintnote>
 </div2>
 <div2 id="coss-wildcard">
  <head>Wildcard Constraints</head>
  <p>All wildcards (see <specref ref="Wildcard_details"/>) must satisfy the following constraint.</p>
  <constraintnote type="cos" id="w-props-correct">
   <head>Wildcard Properties Correct</head>
   <olist>
    <item>
     <p>The values of the properties of a wildcard must be as described in
the property tableau in
<specref ref="Wildcard_details"/>, modulo the impact of <specref ref="conformance-missing"/>.</p>
    </item>
   </olist>
  </constraintnote>
  <p>The following constraint defines a relation appealed to elsewhere in this specification.</p>
  <constraintnote type="cos" id="cos-ns-subset">
  <head>Wildcard Subset</head>
   <p>A namespace constraint (call it <B>sub</B>) is an intensional subset of
another namespace constraint (call it <B>super</B>) if
    <olist>
     <item>
      <p><B>super</B> is <pt>any</pt></p>
     </item>
    </olist>
    or
    <olist>
     <item>
      <p><B>sub</B> is a pair of <pt>not</pt> and a namespace URI or <termref def="key-null">absent</termref> and super is a pair of <pt>not</pt> and the same value;</p>
     </item>
    </olist>
    or
    <olist>
     <item>
      <p><B>sub</B> is a set whose members are either namespace URIs or
<termref def="key-null">absent</termref> and either
       <olist>
       <item>
        <p><B>super</B> is the same set or a superset thereof</p>
       </item>
      </olist>
      or
       <olist>
        <item>
         <p><B>super</B> is a pair of <pt>not</pt> and a namespace URI or
<termref def="key-null">absent</termref> and that value is not in <B>sub</B>'s set.</p>
        </item>
       </olist>
      </p>
     </item>
    </olist>
   </p>
  </constraintnote>
 </div2>
 <div2 id="coss-groupDef">
  <head>Model Group Definition Constraints</head>
  <p>All model group definitions (see <specref ref="Model_Group_Definition_details"/>) must satisfy the following constraint.</p>
  <constraintnote type="cos" id="mgd-props-correct">
   <head>Model Group Definition Properties Correct</head>
   <olist>
    <item>
     <p>The values of the properties of a model group definition must be as described in
the property tableau in
<specref ref="Model_Group_Definition_details"/>, modulo the impact of <specref ref="conformance-missing"/>.</p>
    </item>
   </olist>
  </constraintnote>
 </div2>
 <div2 id="coss-modelGroup">
  <head>Model Group Constraints</head>
  <p>All model groups (see <specref ref="Model_Group_details"/>) must satisfy the following constraints.</p>
  <constraintnote type="cos" id="mg-props-correct">
   <head>Model Group Correct</head>
   <olist>
    <item>
     <p>The values of the properties of a model group must be as described in
the property tableau in
<specref ref="Model_Group_details"/>, modulo the impact of <specref ref="conformance-missing"/>.</p>
    </item>
   </olist>
  </constraintnote>
  <constraintnote type="cos" id="cos-all-limited">
   <head>All Group Limited</head>
   <p>A model group with <propref ref="compositor"/> <pt>all</pt> must only
appear either
    <olist>
     <item>
      <p>as the model group of a model group definition</p>
     </item>
    </olist>
    or
    <olist>
     <item>
      <p>in a particle with <propref ref="p-min_occurs"/>=<propref ref="p-max_occurs"/><code>=1</code>, and that particle
must be part of a pair which constitutes the <propref ref="content_type"/> of a
complex type definition.</p>
     </item>
    </olist>
    Furthermore, the <propref ref="p-max_occurs"/> of all the particles in the
<propref ref="particles"/> of an <pt>all</pt> group must be <code>0</code> or <code>1</code>.
   </p>
  </constraintnote>
  <constraintnote type="cos" id="cos-element-consistent">
   <head>Element Declarations Consistent</head>
   <p>If the <propref ref="particles"/> contains, either directly, indirectly
(that is, within the <propref ref="particles"/> of a contained model group,
recursively) or <termref def="key-impl-cont">implicitly</termref> two or more
element declaration particles with the same <propref ref="e-name"/> and
<propref ref="e-target_namespace"/>, all their
<propref ref="type_definition"/>s must be the same.</p>
  <p><termdef id="key-impl-cont" term="implicitly contains">We say that a list
of particles <term>implicitly contains</term> an element declaration if a
member of the list contains that
element declaration in its <termref def="key-eq">substitution group</termref></termdef>.</p>
  </constraintnote>
  <constraintnote type="cos" id="cos-nonambig">
<head>Unique Particle Attribution</head>
<p>A content model must be formed such that
during <termref def="key-vn">validation</termref> of an element information item sequence, the particle
contained directly, indirectly or <termref def="key-impl-cont">implicitly</termref> therein with which to attempt to <termref def="key-vn">validate</termref> each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.</p>   
   <note>
    <p>This constraint reconstructs for XML Schema the equivalent constraints of
<bibref ref="ref-xml"/> and SGML.  Given the presence of element substitution groups and wildcards, the concise expression of this constraint is difficult,
see <specref ref="non-ambig"/> for further discussion.</p>
   </note>
</constraintnote>
  <note>
    <p>Because locally-scoped element declarations may or may not have a
<propref ref="e-target_namespace"/>, the scope of declarations is
<emph>not</emph> relevant to enforcing either of the two preceding constraints.</p>
   </note>
  <p>The following constraints define relations appealed to elsewhere in this specification.</p>
  <constraintnote type="cos" id="cos-seq-range">
   <head>Effective Total Range (<pt>all</pt> and <pt>sequence</pt>)</head>
   <p>The effective total range of a particle whose <propref ref="term"/> is a group whose <propref ref="compositor"/> is
<pt>all</pt> or <pt>sequence</pt> is a pair of minimum and maximum, as follows </p>
   <glist>
    <gitem>
     <label>minimum</label>
     <def>
      <p>The product of the particle's <propref ref="p-min_occurs"/> and the
sum of the <propref ref="p-min_occurs"/> of every wildcard or element
declaration particle in the group's <propref ref="particles"/> and the minimum
part of the effective total range of each of the group particles in the group's <propref ref="particles"/> (or <code>0</code> if there are no <propref ref="particles"/>)</p>
     </def>
    </gitem>
    <gitem>
     <label>maximum</label>
     <def>
      <p><pt>unbounded</pt> if the <propref ref="p-max_occurs"/> of any wildcard or element
declaration particle in the group's <propref ref="particles"/> or the maximum
part of the effective total range of any of the group particles in the group's
<propref ref="particles"/> is <pt>unbounded</pt>, or if any of those is non-zero
and the <propref ref="p-max_occurs"/> of the particle itself is <pt>unbounded</pt>,
otherwise the product of the particle's <propref ref="p-max_occurs"/> and the
sum of the <propref ref="p-max_occurs"/> of every wildcard or element
declaration particle in the group's <propref ref="particles"/> and the maximum
part of the effective total range of each of the group particles in the group's <propref ref="particles"/> (or <code>0</code> if there are no <propref ref="particles"/>)</p>
     </def>
    </gitem>
   </glist>
  </constraintnote>
  <constraintnote type="cos" id="cos-choice-range">
   <head>Effective Total Range (<pt>choice</pt>)</head>
   <p>The effective total range of a particle whose <propref ref="term"/> is a group whose <propref ref="compositor"/> is
<pt>choice</pt> is a pair of minimum and maximum, as follows </p>
   <glist>
    <gitem>
     <label>minimum</label>
     <def>
      <p>The product of the particle's <propref ref="p-min_occurs"/> and the
minimum of the <propref ref="p-min_occurs"/> of every wildcard or element
declaration particle in the group's <propref ref="particles"/> and the minimum
part of the effective total range of each of the group particles in the group's <propref ref="particles"/> (or <code>0</code> if there are no <propref ref="particles"/>)</p>
     </def>
    </gitem>
    <gitem>
     <label>maximum</label>
     <def>
      <p><pt>unbounded</pt> if the <propref ref="p-max_occurs"/> of any wildcard or element
declaration particle in the group's <propref ref="particles"/> or the maximum
part of the effective total range of any of the group particles in the group's
<propref ref="particles"/> is <pt>unbounded</pt>, or if any of those is non-zero
and the <propref ref="p-max_occurs"/> of the particle itself is <pt>unbounded</pt>,
otherwise the product of the particle's <propref ref="p-max_occurs"/> and the
maximum of the <propref ref="p-max_occurs"/> of every wildcard or element
declaration particle in the group's <propref ref="particles"/> and the maximum
part of the effective total range of each of the group particles in the group's <propref ref="particles"/> (or <code>0</code> if there are no <propref ref="particles"/>)</p>
     </def>
    </gitem>
   </glist>
  </constraintnote>
</div2>
 <div2 id="coss-notation">
  <head>Notation Declaration Constraints</head>
  <p>All notation declarations (see <specref ref="Notation_Declaration_details"/>) must satisfy the following constraint.</p>
  <constraintnote type="cos" id="n-props-correct">
   <head>Notation Declaration Correct</head>
   <olist>
    <item>
     <p>The values of the properties of a notation declaration must be as described in
the property tableau in
<specref ref="Notation_Declaration_details"/>, modulo the impact of <specref ref="conformance-missing"/>.</p>
    </item>
   </olist>
  </constraintnote>
 </div2>
 <div2 id="coss-annotation">
  <head>Annotation Constraints</head>
  <p>All annotations (see <specref ref="Annotation_details"/>) must satisfy the following constraint.</p>
  <constraintnote type="cos" id="an-props-correct">
   <head>Annotation Correct</head>
   <olist>
    <item>
     <p>The values of the properties of an annotation must be as described in
the property tableau in
<specref ref="Annotation_details"/>, modulo the impact of <specref ref="conformance-missing"/>;</p>
    </item>
   </olist>
  </constraintnote>
 </div2>
 <div2 id="coss-particle">
  <head>Particle Constraints</head>
  <p>All particles (see <specref ref="Particle_details"/>) must satisfy the following constraints.</p>
  <constraintnote type="cos" id="p-props-correct">
   <head>Particle Correct</head>
   <olist>
    <item>
   <p>The values of the properties of a particle must be as described in
the property tableau in
<specref ref="Particle_details"/>, modulo the impact of <specref ref="conformance-missing"/>;</p>
    </item>
    <item>
     <p>If <propref ref="p-max_occurs"/> is not <pt>unbounded</pt>, that is, it has a
numeric value, then
    <olist>
     <item>
     <p><propref ref="p-min_occurs"/> must not be greater than <propref ref="p-max_occurs"/>;</p>
    </item>
    <item>
     <p><propref ref="p-max_occurs"/> must greater than or equal to 1;</p>
    </item>
    </olist>
   </p>
    </item>
   </olist>
  </constraintnote>
  <p>The following constraints define relations appealed to elsewhere in this specification.</p>
  <constraintnote type="cos" id="cos-particle-extend">
   <head>Particle Valid (Extension)</head>
   <p><termdef id="cd-model-extension" term="valid extension">A particle
(call it <B>E</B>, for extension) is a <term>valid extension</term> of
another particle (call it <B>B</B>, for base) if</termdef> either
    <olist>
     <item>
      <p>They are the same particle</p>
     </item>
    </olist>
    or
    <olist>
     <item>
      <p><B>E</B>'s <propref ref="p-min_occurs"/>=<propref ref="p-max_occurs"/><code>=1</code> and its <propref ref="term"/> is a <pt>sequence</pt> group whose <propref ref="particles"/>' first member is a particle all of whose properties, recursively, are identical to those of <B>B</B>, with the exception of <B>{annotation}</B> properties.</p>
     </item>
    </olist>
   </p>
  </constraintnote>
   <p>The approach to defining a type by restricting another type definition
set out here is designed to ensure that types defined in this way are
guaranteed to be a subset of the type they restrict.  This is accomplished by
requiring a clear mapping between the components of the base type definition and the
restricting type definition.  Permissible mappings are set out below via a set
of recursive definitions, bottoming out in the obvious cases, e.g. where an
(restricted) element declaration corresponds to another (base) element
declaration with the same name and type but the same or wider range of occurrence.</p>
   <note role="pf">
    <p>The structural correspondence approach to guaranteeing the subset
relation set out here is necessarily verbose, but has the advantage of being
checkable in a straightforward way.  The working group solicits feedback on how
difficult this is in practice, and on whether other approaches are found to be viable.</p>
   </note>
  <constraintnote type="cos" id="cos-particle-restrict">
   <head>Particle Valid (Restriction)</head>
   <p><termdef id="cd-model-restriction" term="valid restriction">A particle
(call it <B>R</B>, for restriction) is a <term>valid restriction</term> of
another particle (call it <B>B</B>, for base) if</termdef> either
    <olist>
     <item>
      <p>They are the same particle</p>
     </item>
    </olist>
    or
    <olist>
     <item>
      <p>depending on the kind of particle, per the table below, with the
qualifications that 
       <olist>
        <item>
         <p>any global element declaration particle (in <B>R</B> or
<B>B</B>) which is the
<propref ref="class_exemplar"/> of one or more other element declarations is
treated as if it were a <pt>choice</pt> group whose <propref ref="p-min_occurs"/> and <propref ref="p-max_occurs"/> are those of the particle, and whose <propref ref="particles"/> consists of
one particle with <propref ref="p-min_occurs"/> and <propref ref="p-max_occurs"/> of <code>1</code> for the global element declaration and for each of the declarations in its <termref def="key-eq">substitution group</termref>;</p>
        </item>
        <item>
         <p>Any pointless occurrences of <eltref ref="sequence"/>, <eltref ref="choice"/> or <eltref ref="any"/> may be ignored, where pointlessness is understood as follows:
          <glist>
           <gitem>
            <label><eltref ref="sequence"/></label>
            <def>
             <p>Either of the following:
              <olist>
              <item>
               <p><propref ref="particles"/> is empty;</p>
              </item>
               <item>
                <p>the particle within which this <eltref ref="sequence"/>
appears has <propref ref="p-max_occurs"/> and <propref ref="p-min_occurs"/> of
<code>1</code> and either
                 <olist> 
                  <item>
                   <p>the <eltref ref="sequence"/>'s <propref ref="particles"/>
has only one member</p>
                  </item>
                 </olist>
                 or
                 <olist>
                  <item>
                   <p>the particle within which this <eltref ref="sequence"/>
appears is itself among the <propref ref="particles"/> of a <eltref ref="sequence"/>;</p>
                  </item>
                 </olist>
                </p>
               </item>
             </olist>
             </p>
            </def>
           </gitem>
           <gitem>
            <label><eltref ref="all"/></label>
            <def>
             <p>Either of the following:
              <olist>
              <item>
               <p><propref ref="particles"/> is empty;</p>
              </item>
               <item>
                <p><propref ref="particles"/> has only one member;</p>
               </item>
             </olist>
             </p>
            </def>
           </gitem>
           <gitem>
            <label><eltref ref="choice"/></label>
            <def>
             <p>Either of the following:
              <olist>
              <item>
               <p><propref ref="particles"/> is empty and the
particle within which this <eltref ref="choice"/> appears has <propref ref="p-min_occurs"/> of <code>0</code>;</p>
              </item>
               <item>
                <p>the particle within which this <eltref ref="choice"/>
appears has <propref ref="p-max_occurs"/> and <propref ref="p-min_occurs"/> of
<code>1</code> and either
                 <olist> 
                  <item>
                   <p>the <eltref ref="choice"/>'s <propref ref="particles"/>
has only one member</p>
                  </item>
                 </olist>
                 or
                 <olist>
                  <item>
                   <p>the particle within which this <eltref ref="choice"/>
appears is itself among the <propref ref="particles"/> of a <eltref ref="choice"/>;</p>
                  </item>
                 </olist>
                </p>
               </item>
             </olist>
             </p>
            </def>
           </gitem>
          </glist>
         </p>
        </item>
       </olist>
       </p>
      <restrictCases>
        <restrict case="elt">
         <elt>NameAndTypeOK</elt>
         <any>NSCompat</any>
         <all>RecurseAsIfGroup</all>
         <choice>RecurseAsIfGroup</choice>
         <seq>RecurseAsIfGroup</seq>
        </restrict>
        <restrict case="any">
         <any>NSSubset</any>
         <elt>Forbidden</elt>
         <all>Forbidden</all>
         <choice>Forbidden</choice>
         <seq>Forbidden</seq>
        </restrict>
        <restrict case="all">
         <any>NSRecurseCheckCardinality</any>
         <all>Recurse</all>
         <elt>Forbidden</elt>
         <choice>Forbidden</choice>
         <seq>Forbidden</seq>
        </restrict>
        <restrict case="choice">
         <any>NSRecurseCheckCardinality</any>
         <choice>RecurseLax</choice>
         <all>Forbidden</all>
         <elt>Forbidden</elt>
         <seq>Forbidden</seq>
        </restrict>
        <restrict case="sequence">
         <any>NSRecurseCheckCardinality</any>
         <all>RecurseUnordered</all>
         <choice>MapAndSum</choice>
         <seq>Recurse</seq>
         <elt>Forbidden</elt>
        </restrict>
       </restrictCases>
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote id="range-ok" type="cos">
   <head>Occurrence Range OK</head>
   <p>A particle's occurrence range is a valid restriction of another's
occurrence range if
    <olist>
     <item>
      <p>Its <propref ref="p-min_occurs"/> is greater than or equal to the
other's <propref ref="p-min_occurs"/>;</p>
     </item>
     <item>
      <p>Either
       <olist>
        <item>
         <p>The other's <propref ref="p-max_occurs"/> is <pt>unbounded</pt></p>
        </item>
       </olist>
       or
       <olist>
        <item>
         <p>both <propref ref="p-max_occurs"/> are numbers, and the particle's is less than or equal to the
other's.</p>
        </item>
       </olist>
      </p>
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote type="cos" id="rcase-NameAndTypeOK">
   <head>Particle Restriction OK (Elt:Elt -- NameAndTypeOK)</head>
   <p>An element declaration particle is a <termref def="cd-model-restriction">valid restriction</termref> of another element declaration particle if
    <olist>
     <item>
      <p>The declarations' <propref ref="e-name"/>s, <propref ref="e-target_namespace"/>s and <propref ref="nullable"/> are the same;</p>
     </item>
     <item>
      <p><B>R</B>'s occurrence range is a valid
restriction of <B>B</B>'s occurrence range as defined by <specref ref="range-ok"/>;</p>
     </item>
     <item>
      <p>either <B>B</B>'s declaration's <propref ref="e-value_constraint"/>
absent, or is
not <pt>fixed</pt>, or <B>R</B>'s declaration's <propref ref="e-value_constraint"/> is
<pt>fixed</pt> with the same string;</p>
     </item>
     <item>
      <p><B>R</B>'s declaration's <propref ref="&constraint;_definitions"/> is
a subset of <B>B</B>'s declaration's <propref ref="&constraint;_definitions"/>,
if any.</p>
     </item>
     <item>
      <p><B>R</B>'s declaration's <propref ref="e-exact"/> is
a superset of <B>B</B>'s declaration's <propref ref="e-exact"/>.</p>
     </item>
     <item>
      <p><B>R</B>'s <propref ref="type_definition"/> is validly derived given
{<pt>extension</pt>} from <B>B</B>'s <propref ref="type_definition"/> as defined by
<specref ref="cos-ct-derived-ok"/> or <specref ref="cos-st-derived-ok"/>, as appropriate.</p>
     </item>
    </olist>
   </p>
   <note>
    <p>The above constraint on <propref ref="type_definition"/> means that in
deriving a type by restriction, any contained type definitions must themselves be
explicitly derived by restriction from the corresponding type definitions in the
base definition.</p>
   </note>
  </constraintnote>
  <constraintnote type="cos" id="rcase-NSCompat">
   <head>Particle Derivation OK (Elt:Any -- NSCompat)</head>
   <p>An element declaration particle is a <termref def="cd-model-restriction">valid restriction</termref> of a wildcard particle if
    <olist>
     <item>
      <p>The element declaration's <propref ref="e-target_namespace"/> is
<termref def="key-vn">valid</termref> with respect to the wildcard's <propref ref="namespace_constraint"/> as
defined by <specref ref="cvc-wildcard-namespace"/></p>
     </item>
     <item>
      <p><B>R</B>'s occurrence range is a valid
restriction of <B>B</B>'s occurrence range as defined by <specref ref="range-ok"/>;</p>
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote type="cos" id="rcase-RecurseAsIfGroup">
   <head>Particle Derivation OK (Elt:All/Choice/Sequence -- RecurseAsIfGroup)</head>
   <p>An element declaration particle is a <termref def="cd-model-restriction">valid restriction</termref> of a group particle (<pt>all</pt>, <pt>choice</pt> or <pt>sequence</pt>) if
a group particle of the variety corresponding to <B>B</B>'s, with
<propref ref="p-min_occurs"/> and <propref ref="p-max_occurs"/> of <code>1</code> and with <propref ref="particles"/> consisting of a single particle
the same as the element declaration is a <termref def="cd-model-restriction">valid restriction</termref> of the group as defined by <specref ref="rcase-Recurse"/>, <specref ref="rcase-RecurseLax"/> or <specref ref="rcase-Recurse"/>, depending on whether the group is <pt>all</pt>, <pt>choice</pt> or <pt>sequence</pt>.</p>
  </constraintnote>
  <constraintnote type="cos" id="rcase-NSSubset">
   <head>Particle Derivation OK (Any:Any -- NSSubset)</head>
   <p>A wildcard particle is a <termref def="cd-model-restriction">valid restriction</termref> of another wildcard particle if
    <olist>
     <item>
      <p><B>R</B>'s occurrence range is a valid
restriction of <B>B</B>'s occurrence range as defined by <specref ref="range-ok"/>;</p>
     </item>
     <item>
      <p><B>R</B>'s <propref ref="namespace_constraint"/> is an intensional
subset of <B>B</B>'s <propref ref="namespace_constraint"/> as defined by <specref ref="cos-ns-subset"/>.</p>
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote type="cos" id="rcase-NSRecurseCheckCardinality">
   <head>Particle Derivation OK (All/Choice/Sequence:Any -- NSRecurseCheckCardinality)</head>
   <p>A group particle is a <termref def="cd-model-restriction">valid restriction</termref> of a wildcard particle if
    <olist>
     <item>
      <p>Every member of the <propref ref="particles"/> of the group is a
<termref def="cd-model-restriction">valid restriction</termref> of the wildcard
as defined by <specref ref="cos-particle-restrict"/></p>
     </item>
     <item>
      <p>The effective total range of the group, as defined by <specref ref="cos-seq-range"/> (if
the group is <pt>all</pt> or <pt>sequence</pt>) or 
<specref ref="cos-choice-range"/> (if it is <pt>choice</pt>) is a valid
restriction of <B>B</B>'s occurrence range as defined by <specref ref="range-ok"/>.</p>
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote type="cos" id="rcase-Recurse">
   <head>Particle Derivation OK (All:All,Sequence:Sequence -- Recurse)</head>
   <p>An <pt>all</pt> or <pt>sequence</pt> group particle is a <termref def="cd-model-restriction">valid restriction</termref> of another group particle with the same <propref ref="compositor"/> if 
    <olist>
     <item>
      <p><B>R</B>'s occurrence range is a valid
restriction of <B>B</B>'s occurrence range as defined by <specref ref="range-ok"/>;</p>
     </item>
     <item>
      <p>there is a complete <termref def="key-op">order-preserving</termref> functional mapping from the particles in the
<propref ref="particles"/> of <B>R</B> to the particles in the <propref ref="particles"/> of <B>B</B> such that
       <olist>
        <item>
         <p>Each particle in the <propref ref="particles"/> of <B>R</B> is a
<termref def="cd-model-restriction">valid restriction</termref> of the
particle in the <propref ref="particles"/> of <B>B</B> it maps to as defined
by <specref ref="cos-particle-restrict"/>;</p>
        </item>
        <item>
         <p>All particles in the <propref ref="particles"/> of <B>B</B> which
are not mapped to by any particle in the <propref ref="particles"/> of <B>R</B>
are <termref def="cd-emptiable">emptiable</termref> as defined by <specref ref="cos-group-emptiable"/>.</p>
        </item>
       </olist></p>
     </item>
    </olist>
   </p>
   <note>
    <p>Although the <termref def="key-vn">validation</termref> semantics of an <pt>all</pt> group does not
depend on the order of its particles, we require derived <pt>all</pt> groups to
match the order of their base to simplify checking that the derivation is OK.</p>
   </note>
   <p><termdef id="key-op" term="order-preserving">A complete functional mapping is
<term>order-preserving</term> if each particle <B>r</B> in the domain <B>R</B> maps to a
particle <B>b</B> in the range <B>B</B> which follows (not necessarily
immediately) the particle in the range
<B>B</B> mapped to by the predecessor of <B>r</B>, if any, where
<quote>predecessor</quote> and <quote>follows</quote> are defined with respect
to the order of the lists which constitute <B>R</B> and <B>B</B>.</termdef></p>
  </constraintnote>
  <constraintnote type="cos" id="rcase-RecurseLax">
   <head>Particle Derivation OK (Choice:Choice -- RecurseLax)</head>
   <p>A <pt>choice</pt> group particle is a <termref def="cd-model-restriction">valid restriction</termref> of another <pt>choice</pt> group particle if 
    <olist>
     <item>
      <p><B>R</B>'s occurrence range is a valid
restriction of <B>B</B>'s occurrence range as defined by <specref ref="range-ok"/>;</p>
     </item>
     <item>
      <p>There is a complete <termref def="key-op">order-preserving</termref> functional mapping from the particles in the
<propref ref="particles"/> of <B>R</B> to the particles in the <propref ref="particles"/> of <B>B</B> such that each particle in the <propref ref="particles"/> of <B>R</B> is a
<termref def="cd-model-restriction">valid restriction</termref> of the
particle in the <propref ref="particles"/> of <B>B</B> it maps to as defined
by <specref ref="cos-particle-restrict"/>.</p>
     </item>
    </olist>
    </p>
   <note>
    <p>Although the <termref def="key-vn">validation</termref> semantics of a <pt>choice</pt> group does not
depend on the order of its particles, we require derived <pt>choice</pt> groups to
match the order of their base to simplify checking that the derivation is OK.</p>
   </note>
  </constraintnote>
  <constraintnote type="cos" id="rcase-RecurseUnordered">
   <head>Particle Derivation OK (Sequence:All -- RecurseUnordered)</head>
   <p>A <pt>sequence</pt> group particle is a <termref def="cd-model-restriction">valid restriction</termref> of an <pt>all</pt> group particle if
    <olist>
     <item>
      <p><B>R</B>'s occurrence range is a valid
restriction of <B>B</B>'s occurrence range as defined by <specref ref="range-ok"/>;</p>
     </item>
     <item>
      <p>there is a complete functional mapping from the particles in the
<propref ref="particles"/> of <B>R</B> to the particles in the <propref ref="particles"/> of <B>B</B> such that
       <olist>
        <item>
         <p>No particle in the <propref ref="particles"/> of <B>B</B> is mapped
to by more than one of the particles in the
<propref ref="particles"/> of <B>R</B>;</p>
        </item>
        <item>
         <p>Each particle in the <propref ref="particles"/> of <B>R</B> is a
<termref def="cd-model-restriction">valid restriction</termref> of the
particle in the <propref ref="particles"/> of <B>B</B> it maps to as defined
by <specref ref="cos-particle-restrict"/>;</p>
        </item>
        <item>
         <p>All particles in the <propref ref="particles"/> of <B>B</B> which
are not mapped to by any particle in the <propref ref="particles"/> of <B>R</B>
are <termref def="cd-emptiable">emptiable</termref> as defined by <specref ref="cos-group-emptiable"/>.</p>
        </item>
       </olist></p>
     </item>
    </olist>
   </p>
   <note>
    <p>Although this clause allows reordering, because of the limits on the
contents of <pt>all</pt> groups the checking process can still be deterministic.</p>
   </note>
  </constraintnote>
  <constraintnote type="cos" id="rcase-MapAndSum">
   <head>Particle Derivation OK (Sequence:Choice -- MapAndSum)</head>
   <p>A <pt>sequence</pt> group particle is a <termref def="cd-model-restriction">valid restriction</termref> of a <pt>choice</pt> group particle if
    <olist>
     <item>
      <p>there is a complete functional mapping from the particles in the
<propref ref="particles"/> of <B>R</B> to the particles in the <propref ref="particles"/> of <B>B</B> such that each particle in the <propref ref="particles"/> of <B>R</B> is a
<termref def="cd-model-restriction">valid restriction</termref> of the
particle in the <propref ref="particles"/> of <B>B</B> it maps to as defined
by <specref ref="cos-particle-restrict"/>;</p>
     </item>
     <item>
      <p>The pair consisting of the product of the <propref ref="p-min_occurs"/> of <B>R</B> and the length of its <propref ref="particles"/> and <pt>unbounded</pt> if <propref ref="p-max_occurs"/> is <pt>unbounded</pt> otherwise the product of the <propref ref="p-max_occurs"/> of <B>R</B> and the length of its <propref ref="particles"/> is a valid
restriction of <B>B</B>'s occurrence range as defined by <specref ref="range-ok"/>.</p>
      <note>
       <p>This clause is in principle more restrictive than absolutely
necessary, but in practice will cover all the likely cases, and is much easier
to specify than the fully general version.</p>
      </note>
     </item>
    </olist>
   </p>
   <note>
    <p>This case allows the <quote>unfolding</quote> of iterated disjunctions
into sequences.  It may be particularly useful when the disjunction is an
implicit one arising from the use of substitution groups.</p>
   </note>
  </constraintnote>
 <constraintnote id="cos-group-emptiable" type="cos">
  <head>Particle Emptiable</head>
  <p><termdef id="cd-emptiable" term="emptiable">A particle is
<term>emptiable</term> if</termdef> either
   <olist>
    <item>
     <p>its <propref ref="p-min_occurs"/> is <code>0</code></p>
    </item>
   </olist>
   or
   <olist>
    <item>
     <p>its <propref ref="term"/> is a group and the minimum part of the
effective total range of that group, as defined by <specref ref="cos-seq-range"/> (if
the group is <pt>all</pt> or <pt>sequence</pt>) or 
<specref ref="cos-choice-range"/> (if it is <pt>choice</pt>), is <code>0</code>.</p>
    </item>
   </olist>
  </p>
 </constraintnote>
 </div2>
 <div2 id="coss-ct">
  <head>Complex Type Definition Constraints</head>
  <p>All complex type definitions (see <specref ref="Complex_Type_Definition_details"/>) must satisfy the following constraints.</p>
  <constraintnote type="cos" id="ct-props-correct">
   <head>Complex Type Definition Properties Correct</head>
   <olist>
    <item>
     <p>The values of the properties of a complex type definition must be as described in
the property tableau in
<specref ref="Complex_Type_Definition_details"/>, modulo the impact of <specref ref="conformance-missing"/>;</p>
    </item>
    <item>
     <p>If the <propref ref="ct-base_type_definition"/> is a simple type
definition, the <propref ref="derivation_method"/> must be <pt>extension</pt>;</p>
    </item>
    <item>
     <p>No two attribute declarations in the <propref ref="ct-attribute_declarations"/> may have identical <propref ref="a-name"/>s and <propref ref="a-target_namespace"/>s.</p>
    </item>
   </olist>
  </constraintnote>
  <constraintnote type="cos" id="cos-ct-extends">
     <head>Derivation Valid (Extension)</head>
     <p>If the <propref ref="derivation_method"/> is <pt>extension</pt>:
      <olist>
       <item>
        <p>If the <propref ref="ct-base_type_definition"/> is a complex type
definition:
         <olist>
          <item>
           <p>The <propref ref="ct-final"/> of the <propref ref="ct-base_type_definition"/> must not contain <pt>extension</pt></p>
          </item>
          <item>
           <p>Its <propref ref="ct-attribute_declarations"/> must be a subset
of the <propref ref="ct-attribute_declarations"/> of the complex type
definition itself, that is, for every <termref def="key-aup">attribute use pair</termref> in the
<propref ref="ct-attribute_declarations"/> of the
<propref ref="ct-base_type_definition"/>, there must be a pair in the <propref ref="ct-attribute_declarations"/> of the complex
type definition itself whose attribute declaration has the same <propref ref="a-name"/>,
<propref ref="a-target_namespace"/> and
<propref ref="a-simple_type_definition"/> as its attribute declaration;</p>
          </item>
          <item>
           <p>If it has an <propref ref="ct-attribute_wildcard"/>, the complex
type definition must also have one, and the base type definition's <propref ref="ct-attribute_wildcard"/>'s <propref ref="namespace_constraint"/> must be a subset of the complex type definition's <propref ref="ct-attribute_wildcard"/>'s <propref ref="namespace_constraint"/>, as defined by <specref ref="cos-ns-subset"/>;</p>
          </item>
          <item>
           <p>Either the <propref ref="content_type"/> of the <propref ref="ct-base_type_definition"/> and the <propref ref="content_type"/> of the complex type definition itself must be the same simple type definition, or else the <propref ref="content_type"/> of the complex type definition itself must specify a particle and either the <propref ref="content_type"/> of the <propref ref="ct-base_type_definition"/> must be <pt>empty</pt> or</p>
           <olist>
            <item>
             <p>both <propref ref="content_type"/>s must be <pt>mixed</pt>
or both must be <pt>element-only</pt>;</p>
            </item>
            <item>
             <p>the particle of the complex type definition must be a
<termref def="cd-model-extension">valid extension</termref> of the <propref ref="ct-base_type_definition"/>'s particle, as defined in <specref ref="cos-particle-extend"/>.</p>
            </item>
           </olist>
          </item>
          <item>
           <p>It must in principle be possible to derive the complex type
definition in two steps, the first an extension and the
second a restriction (possibly vacuous), from that type definition among its
ancestors whose <propref ref="ct-base_type_definition"/> is the <termref def="ur-type-itself">ur-type definition</termref>.</p>
           <note>
            <p>This requirement ensures that nothing removed by a restriction
is subsequently added back by an extension.  It is trivial to check if the
extension in question is the only extension in its derivation, or if there are
no restrictions bar the first from the <termref def="ur-type-itself">ur-type definition</termref>.</p>
            <p>Constructing the intermediate type definition to check this
constraint is straightforward:  simply re-order the derivation to put all the
extension steps first, then collapse them into a single extension.  If the
resulting definition can be the basis for a valid restriction to the desired
definition, the constraint is satisfied.</p>
           </note>
          </item>
          </olist>
        </p>
       </item>
       <item>
        <p>If the <propref ref="ct-base_type_definition"/> is a simple type
definition, the <propref ref="content_type"/> must be the same simple type
definition.</p>
       </item>
      </olist>
      <termdef id="cd-ct-extension" term="valid extension">If this
constraint holds of a complex type definition, we say it is a <term>valid
extension</term> of its <propref ref="ct-base_type_definition"/>.</termdef>
     </p>
    </constraintnote>
    <constraintnote type="cos" id="derivation-ok-restriction">
    <head>Derivation Valid (Restriction, Complex)</head>
    <p>If the <propref ref="derivation_method"/> is <pt>restriction</pt>:
     <olist>
      <item>
       <p>The <propref ref="ct-base_type_definition"/> must be a complex type
definition whose <propref ref="ct-final"/> does not contain <pt>restriction</pt>;</p>
      </item>
      <item>
       <p>For each <termref def="key-aup">attribute use pair</termref> in the <propref ref="ct-attribute_declarations"/>:
        <olist>
         <item>
          <p> there must be a pair whose attribute declaration has the same <propref ref="a-name"/> and <propref ref="a-target_namespace"/> in the
<propref ref="ct-attribute_declarations"/> of the <propref ref="ct-base_type_definition"/> from whose <propref ref="a-simple_type_definition"/> the attribute in question's <propref ref="a-simple_type_definition"/> must be validly derived given the
empty set as defined in
<specref ref="cos-st-derived-ok"/>;</p>
         </item>
        </olist>
        or
        <olist>
         <item>
          <p>the <propref ref="ct-base_type_definition"/> must have an <propref ref="ct-attribute_wildcard"/> and the <propref ref="a-target_namespace"/> of the attribute in question must be <termref def="key-vn">valid</termref> with respect to that wildcard, as defined in <specref ref="cvc-wildcard-namespace"/>.</p>
         </item>
        </olist>
       </p>
      </item>
      <item>
       <p>For each <termref def="key-aup">attribute use pair</termref> in the <propref ref="ct-attribute_declarations"/> of
the <propref ref="ct-base_type_definition"/> whose boolean part is
<pt>true</pt>, there must be a pair with an attribute declaration with the same <propref ref="a-name"/> and <propref ref="a-target_namespace"/> as its attribute declaration in the
<propref ref="ct-attribute_declarations"/> of the complex type definition itself;</p>
      </item>
      <item>
           <p>If there is an <propref ref="ct-attribute_wildcard"/>, the
<propref ref="ct-base_type_definition"/> must also have one, and the complex
type definition's <propref ref="ct-attribute_wildcard"/>'s <propref ref="namespace_constraint"/> must be a subset of the <propref ref="ct-base_type_definition"/>'s <propref ref="ct-attribute_wildcard"/>'s <propref ref="namespace_constraint"/>, as defined by <specref ref="cos-ns-subset"/>;</p>
          </item>
      <item>
       <p>Either
        <olist>
         <item>
          <p>the <propref ref="content_type"/> of the complex type definition
is a simple type definition and either
           <olist>
            <item>
             <p>the <propref ref="content_type"/> of the <propref ref="ct-base_type_definition"/> is a simple type
definition of which the <propref ref="content_type"/> is a <termref def="cd-st-restriction">valid restriction</termref> as defined in
<specref ref="cos-st-restricts"/></p>
            </item>
           </olist>
           or
           <olist>
            <item>
             <p>The <propref ref="ct-base_type_definition"/> is <pt>mixed</pt>
and has a particle which is <termref def="cd-emptiable">emptiable</termref> as defined in <specref ref="cos-group-emptiable"/>.</p>
            </item>
           </olist>
          </p>
         </item>
        </olist>
        or
        <ulist>
         <item>
          <p>The <propref ref="content_type"/> of the complex type itself
is <pt>empty</pt> and either 
           <olist>
            <item>
             <p>the <propref ref="content_type"/> of the <propref ref="ct-base_type_definition"/> is also <pt>empty</pt></p>
            </item>
           </olist>
           or
           <olist>
            <item>
             <p>the <propref ref="content_type"/> of the <propref ref="ct-base_type_definition"/> is <pt>elementOnly</pt> or <pt>mixed</pt> and has a particle which is <termref def="cd-emptiable">emptiable</termref> as defined in <specref ref="cos-group-emptiable"/>.</p>
            </item>
           </olist>
          </p>
          <note>
           <p>To restrict a complex type definition with a simple base type
definition to <pt>empty</pt>, use a simple type definition with a
<pt>fixed</pt> value of the empty string:  this preserves the type information.</p>
          </note>
         </item>
        </ulist>
        or
        <ulist>
         <item>
          <p>The <propref ref="content_type"/> of the <propref ref="ct-base_type_definition"/> is <pt>mixed</pt> or the <propref ref="content_type"/> of the complex type definition itself is <pt>element-only</pt>; the particle of the complex type definition itself is a <termref def="cd-model-restriction">valid restriction</termref> of the particle of the <propref ref="content_type"/> of the <propref ref="ct-base_type_definition"/> as defined in <specref ref="cos-particle-restrict"/>.</p>
         </item>
        </ulist>
        </p>
      </item>

</olist> <termdef id="cd-ct-restriction" term="valid restriction">If this
constraint holds of a complex type definition, we say it is a <term>valid
restriction</term> of its <propref ref="ct-base_type_definition"/>.</termdef>
  </p>
  </constraintnote>
    <p>The following constraint defines a relation appealed to elsewhere in this specification.</p>
  <constraintnote id="cos-ct-derived-ok" type="cos">
   <head>Type Derivation OK (Complex)</head>
   <p>A complex type definition (call it <B>D</B>, for derived) is validly
derived from a type definition (call this <B>B</B>, for base) given
a subset of {<pt>extension</pt>, <pt>restriction</pt>} if:
    <olist>
     <item>
      <p>The <propref ref="derivation_method"/> of <B>D</B> is not in the
subset, or in the <propref ref="ct-final"/> of its <propref ref="ct-base_type_definition"/>;</p>
     </item>
     <item>
      <p>Either
       <olist>
        <item>
      <p>They are the same type definition;</p>
     </item>
       </olist>
       or
       <olist>
        <item>
         <p><B>B</B> is the <propref ref="ct-base_type_definition"/></p>
        </item>
       </olist>
       or
       <olist>
        <item>
         <p>the <propref ref="ct-base_type_definition"/> is not the
<termref def="ur-type-itself">ur-type definition</termref> and is validly derived
from <B>B</B> given the subset as defined by this constraint (if the <propref ref="ct-base_type_definition"/> is complex) or as defined in <specref ref="cos-st-derived-ok"/> (if the <propref ref="ct-base_type_definition"/> is simple).</p>
        </item>
       </olist>
      </p>
     </item>
    </olist>
   </p>
  </constraintnote>
  <note>
   <p>This constraint is used to check that when someone uses a type in a
context where another type was expected (either via <code>xsi:type</code> or
substitution groups), that the type used is actually derived from the expected
type, and that that derivation does not involve a form of derivation which was
ruled out by the expected type.</p>
  </note>
 </div2>
 <div2 id="coss-st">
  <head>Simple Type Definition Constraints</head>
  <p>All simple type definitions (see <specref ref="Simple_Type_Definition_details"/>) must satisfy the following constraints.</p>
  <constraintnote type="cos" id="st-props-correct">
   <head>Simple Type Definition Properties Correct</head>
   <olist>
    <item>
     <p>The values of the properties of a simple type definition must be as described in
the property tableau in
<specref ref="Simple_Type_Definition_details"/>, modulo the impact of <specref ref="conformance-missing"/>;</p>
    </item>
   </olist>
  </constraintnote>
  <constraintnote type="cos" id="cos-st-restricts">
<head>Derivation Valid (Restriction, Simple)</head>
   <olist>
    <item>
     <p>If the <propref ref="variety"/> is <pt>atomic</pt>:
     <olist>
      <item>
       <p>The <propref ref="st-base_type_definition"/> must be an atomic simple type
definition or a built-in
primitive datatype;</p>
      </item>
      <item>
       <p>For each facet in the <propref ref="facets"/>there must be a facet of the same kind in the
<propref ref="facets"/> of the <propref ref="st-base_type_definition"/> of
whose <B>{value}</B> the facet in question's <B>{value}</B> must be a valid restriction as
defined in <bibref ref="ref-xsp2"/>;</p>
      </item>
     </olist>
  </p>
    </item>
    <item>
       <p>If the <propref ref="variety"/> is <pt>list</pt>:</p>
       <olist>
        <item>
         <p>The <propref ref="st-item_type_definition"/> must have a <propref ref="variety"/> of <pt>atomic</pt> or <pt>union</pt> and not have any
members in its value space which contain spaces;</p>
        </item>
        <item><p>Only <pt>length</pt>, <pt>minLength</pt>, <pt>maxLength</pt>,
<pt>pattern</pt> and <pt>enumeration</pt> facet components are allowed among
the <propref ref="facets"/>.</p></item>
        <item>
          <p>If the <propref ref="st-base_type_definition"/> is not the
<termref def="simple-ur-type-itself">simple ur-type definition</termref>, then 
           <olist>
            <item>
             <p>the <propref ref="st-base_type_definition"/> must have a <propref ref="variety"/> of <pt>list</pt></p>
            </item>
            <item>
             <p>for each facet in the <propref ref="facets"/> there must be a facet of the same kind in the
<propref ref="facets"/> of the <propref ref="st-base_type_definition"/> of
whose <B>{value}</B> the facet in question's <B>{value}</B> must be a valid restriction as
defined in <bibref ref="ref-xsp2"/>;</p>
            </item>
           </olist>
          </p>
         </item>
       </olist>
      </item>
    <item>
       <p>If the <propref ref="variety"/> is <pt>union</pt>:</p>
       <olist>
        <item>
         <p>The <propref ref="st-item_type_definition"/> must have <propref ref="variety"/> of <pt>atomic</pt> or <pt>list</pt>;</p>
        </item>
        <item><p>Only <pt>pattern</pt> and <pt>enumeration</pt> facet components are allowed among
the <propref ref="facets"/>.</p></item>
        <item>
          <p>If the <propref ref="st-base_type_definition"/> is not the
<termref def="simple-ur-type-itself">simple ur-type definition</termref>, then 
           <olist>
            <item>
             <p>the <propref ref="st-base_type_definition"/> must have a <propref ref="variety"/> of <pt>union</pt></p>
            </item>
            <item>
             <p>for each facet in the <propref ref="facets"/> there must be a facet of the same kind in the
<propref ref="facets"/> of the <propref ref="st-base_type_definition"/> of
whose <B>{value}</B> the facet in question's <B>{value}</B> must be a valid restriction as
defined in <bibref ref="ref-xsp2"/>;</p>
            </item>
           </olist>
          </p>
         </item>
       </olist>
      </item>
   </olist>
   <p><termdef id="cd-st-restriction" term="valid restriction">If this
constraint holds of a simple type definition, we say it is a <term>valid
restriction</term> of its <termref def="st-base_type_definition">base type definition</termref>.</termdef></p>
</constraintnote>
    <p>The following constraints define relations appealed to elsewhere in this specification.</p>
    <constraintnote id="cos-st-derived-ok" type="cos">
   <head>Type Derivation OK (Simple)</head>
   <p>A simple type definition (call it <B>D</B>, for derived) is validly
derived from a simple type definition (call this <B>B</B>, for base) given a
subset of {<pt>extension</pt>, <pt>restriction</pt>} (of which
only <pt>restriction</pt> is actually relevant) if:
    <olist>
     <item>
      <p>They are the same type definition</p>
     </item>
    </olist>
    or
    <olist>     
     <item>
      <p><pt>restriction</pt> is not in the
subset;</p>
     </item>
     <item>
      <p>
      <olist>
      <item>
      <p><B>D</B>'s <termref def="st-base_type_definition">base type definition</termref> is <B>B</B></p>
     </item>
    </olist>
    or
       <olist>
        <item>
         <p><B>D</B>'s <termref def="st-base_type_definition">base type definition</termref> is not the
<termref def="simple-ur-type-itself">simple ur-type definition</termref> and is validly derived
from <B>B</B> given the subset, as defined by this constraint.</p>
        </item>
       </olist>
    or 
       <olist>
        <item>
         <p><B>D</B>'s <propref ref="variety"/> is <pt>list</pt> or <pt>union</pt> and <B>B</B>
is the <termref def="simple-ur-type-itself">simple ur-type definition</termref></p>
        </item>
       </olist>or
       <olist>
       <item>
        <p><B>B</B>'s <propref ref="variety"/> is <pt>union</pt> and
<B>D</B> is validly derived
from a type definition in <B>B</B>'s <propref ref="st-member_type_definitions"/> given the subset, as defined by this constraint.</p>
       </item>
</olist>
</p>
     </item>
    </olist>
   </p>
  </constraintnote>
 </div2>
 <div2 id="coss-schema">
  <head>Schema Constraints</head>
  <p>All schemas (see <specref ref="Schema_details"/>) must satisfy the following constraint.</p>
  <constraintnote type="cos" id="sch-props-correct">
   <head>Schema Properties Correct</head>
   <olist>
    <item>
     <p>The values of the properties of a schema must be as described in
the property tableau in
<specref ref="Schema_details"/>, modulo the impact of <specref ref="conformance-missing"/>;</p>
    </item>
    <item>
     <p>Each of the <propref ref="type_definitions"/>,  <propref ref="element_declarations"/>, <propref ref="attribute_group_definitions"/>, <propref ref="model_group_definitions"/> and <propref ref="notation_declarations"/> must not contain two or more schema components with the same <B>{name}</B> and <B>{target
namespace}</B>.</p>
    </item>
   </olist>
  </constraintnote>
 </div2>
   </div1>
   <div1 id="composition">
    <head>Schema Access and Composition</head>
<p>This chapter defines the mechanisms by which we establish the necessary precondition for <termref def="key-va">assessment</termref>, namely access to one or more schemas. This chapter also describes in detail related mechanisms for using in
one schema, definitions and declarations from another, possibly with modifications. </p>
<p><specref ref="concepts-conformance"/> describes three levels of conformance for schema
processors, and <specref ref="conformance"/> provides a formal definition of <termref def="key-va">assessment</termref>. Here we set out
in detail the 3-layer architecture implied by the three conformance levels.
The layers
are: </p>
<olist>
  <item><p>The <termref def="key-va">assessment</termref> core, relating schema components and instance
information items; </p></item>
  <item><p>Schema representation: the connections between XML
representations and schema components, including the
  relationships between namespaces and schema components; </p></item>
  <item><p>XML Schema web-interoperability guidelines: instance-&gt;schema and
  schema-&gt;schema connections for the WWW. </p></item></olist>
<p>Layer 1 specifies the manner in which a schema composed of schema components
can be applied to in the <termref def="key-va">assessment</termref> of an instance element information item. Layer 2, which is
primarily defined in <specref ref="declare"/>, specifies the use of <eltref ref="schema"/>
elements in XML documents as the standard XML representation for
schema information in a broad range of computer systems and execution
environments. To support interoperation over the World Wide Web in particular,
layer 3 provides a set of conventions for schema reference on the
Web. Additional details on each of the three layers is provided in the sections below.</p>


<div2 id="layer1">
<head>Layer 1: Summary of the schema-validity assessment core </head>
<p>The fundamental purpose of the <termref def="key-va">assessment</termref> core is to define <termref def="key-va">assessment</termref> for a single
element information item and its descendants with respect to a
complex type
definition. All processors are required to implement this core predicate in a
manner which conforms exactly to this specification. </p>
<p><termref def="key-va">assessment</termref> is defined with reference to an <termref def="key-schema">XML Schema</termref> (note <emph>not</emph> a
<termref def="key-schemaDoc">schema document</termref>) which consists of (at a minimum) the set of schema
components (definitions and declarations) required for that
<termref def="key-va">assessment</termref>.  This is not a circular definition, but rather a
<emph>post facto</emph> observation:  no element information item can
be fully assessed unless all the components required by any aspect of
its (potentially recursive) <termref def="key-va">assessment</termref> are present in the schema.</p>
<p>As specified above, each schema component is associated directly or
indirectly with a target namespace, or explicitly with no namespace. In the case of multi-namespace documents,
components for more than one target namespace will co-exist in a schema.</p>
<p>Processors have the option to assemble (and perhaps to optimize or
pre-compile) the entire schema prior to the start of an <termref def="key-va">assessment</termref> episode, or to
gather the schema lazily as individual components are required. In all
cases it is required that:</p>
<ulist>
  <item><p>The processor succeed in locating the <termref def="key-component">schema component</termref>s
  transitively required to complete an <termref def="key-va">assessment</termref> (note that components derived
from <termref def="key-schemaDoc">schema document</termref>s can be integrated
with components obtained through other means);</p></item>
  <item><p>no definition or declaration changes once it has been established;</p></item>
  <item><p>if the processor chooses to acquire declarations and definitions
  dynamically, that there be no side effects of such dynamic acquisition that
  would cause the results of <termref def="key-va">assessment</termref> to differ from that which would have
  been obtained from the same schema components acquired in bulk.</p></item></ulist>
<note><p> the <termref def="key-va">assessment</termref> core is defined in terms of schema components at the
abstract level, and no mention is made of the schema definition
syntax (i.e. <eltref ref="schema"/>). Although many processors will acquire
schemas in this format, others may operate on compiled representations, on a
programmatic representation as exposed in some programming language, etc.
</p></note>
<p>The obligation of a schema-aware processor as far as the <termref def="key-va">assessment</termref>
core is concerned is to implement one or more of the options for <termref def="key-va">assessment</termref> given below in <specref ref="validation_outcome"/>. Neither the
choice of element information item for that <termref def="key-va">assessment</termref>, nor which of the
means of initiating <termref def="key-va">assessment</termref> are used, is within the scope of this specification.</p>
<p>Although <termref def="key-va">assessment</termref> is defined recursively, it is also intended to be
implementable in streaming
processors.  Such processors may choose to incrementally assemble the schema during
processing in response, for example, to encountering new namespaces. 
The implication of the
invariants expressed above is that such incremental assembly must
result in an <termref def="key-va">assessment</termref> 
outcome that is the 
<emph>same</emph> as would
be given if <termref def="key-va">assessment</termref> was undertaken again
with the final, fully assembled schema. </p>
</div2>
<div2 id="layer2">
<head>Layer 2: Schema definitions in XML</head>
<p><specref ref="declare"/> defines an
XML representation for type definitions and element declarations and so on,
specifying their target namespace and collecting them into schema documents.
The two following sections relate to assembling a complete schema for <termref def="key-va">assessment</termref> from multiple sources.  They should <emph>not</emph> be understood as a form of text substitution, but rather as providing mechanisms for distributed definition of schema components, with appropriate schema-specific semantics.</p>
<note><p> The core <termref def="key-va">assessment</termref> architecture requires that a complete schema with
all the necessary declarations and definitions be
available. This may involve resolving both
instance->schema and schema->schema references. As observed earlier in <specref ref="concepts-conformance"/>, 
we anticipate
that the precise mechanisms for resolving such references will evolve over time.
In support of such evolution, we have attempted to observe the design principle that references from
one schema document to another schema use mechanisms that directly parallel those used to
reference a schema from an instance document.</p></note>
<note><p>In the sections below, "schemaLocation" really belongs at layer 3. 
For convenience, we document it with the layer 2 mechanisms of import and
include, with which it is closely associated.</p></note>
 <ednote role="pf">
<edtext>Each of the subsequent sections ends with a note about multiple
inclusion/redefinition/importing.  The space of possibilities here, particular
once nesting is considered, is very
large:  we solicit feedback on ease of implementation, and any interoperability
issues which arise.</edtext>
</ednote>
<div3 id="compound-schema">
<head>Assembling a schema for a single target namespace from multiple schema definition documents</head>
 <p>Schema components for a single target namespace can be assembled from
several <termref def="key-schemaDoc">schema document</termref>s, that is several <eltref ref="schema"/> element
information items: </p>
 <reprdef>
 <reprelt eltname="include"/>
</reprdef>
 <p>A <eltref ref="schema"/> information item may contain any number of <eltref ref="include"/> elements. Their <code>schemaLocation</code> attributes, consisting of a URI reference, identify other <termref def="key-schemaDoc">schema document</termref>s, that is <eltref ref="schema"/> information items. 
</p>
<p>The <termref def="key-schema">XML Schema</termref> corresponding 
to <eltref ref="schema"/> contains not only the components specified elsewhere
in this specification, but also
all the components of all the <termref def="key-schema">XML Schema</termref>s corresponding to any <eltref ref="include"/>d schema documents.
Such included components must either (a) have the same
<code>targetNamespace</code> as the <eltref ref="include"/>ing schema document, or 
(b) no <code>targetNamespace</code> at all, in which case all the top-level
<eltref ref="include"/>d components are converted to the <eltref ref="include"/>ing schema document's <code>targetNamespace</code>.</p>
 <constraintnote type="src" id="src-include">
 <head>Inclusion Constraints and Semantics</head>
 <p>In addition to the conditions imposed on <eltref ref="include"/> element
information items by the schema for schemas, the following must also hold:
    <olist>
    <item>
     <p>If the &i-value; of the <code>schemaLocation</code> &i-attribute;
successfully resolves, it resolves either
      <olist>
       <item>
        <p>to (a fragment of) a resource of type
<code>text/xml</code>, which in turn corresponds to a <eltref ref="schema"/>
element information item in a well-formed information set, which in turn
corresponds to a valid schema</p>
       </item>
      </olist>
      or
      <olist>
       <item>
        <p>to a <eltref ref="schema"/>
element information item in a well-formed information set, which in turn
corresponds to a valid schema.</p>
       </item>
      </olist>
      In either case call the <eltref ref="schema"/> item <B>SII</B> and the valid schema <B>I</B>.</p>
    </item>
     <item>
      <p>The <code>targetNamespace</code> of <B>SII</B> is either 
       <olist>
        <item>
         <p><termref def="key-null">absent</termref></p>
        </item>
       </olist>
        or
       <olist>
        <item>
         <p>identical to the <code>targetNamespace</code> of the <eltref ref="include"/>
item's parent <eltref ref="schema"/>.</p>
        </item>
       </olist>
</p>
     </item>
   </olist>
   </p>
 <p>It is <emph>not</emph> an error for the &i-value; of the
<code>schemaLocation</code> &i-attribute; to fail to resolve it all, in which case no
corresponding inclusion is performed.  It
<emph>is</emph> an error for it to resolve but the rest of clause 1.1 above to
fail to obtain.  Failure to resolve may well cause less than complete
<termref def="key-va">assessment</termref> outcomes, of course.</p>
 <p>The <termref def="key-component">schema component</termref>s (that is
<propref ref="type_definitions"/> <propref ref="attribute_declarations"/>, <propref ref="element_declarations"/>, <propref ref="attribute_group_definitions"/>, <propref ref="model_group_definitions"/>, <propref ref="notation_declarations"/>) of a schema corresponding to a
<eltref ref="schema"/> element information item with one or more <eltref ref="include"/> element information items must include not only definitions or declarations corresponding to the appropriate members of its &i-children;, but also, for each of those <eltref ref="include"/> element information items for which clause 1.1 above obtains successfully, a set of components identical to all the <termref def="key-component">schema component</termref>s of <B>I</B> (if clause 1.2.2 above obtains), or identical in all respects except their <B>{target namespace}</B>, which is that of the <eltref ref="include"/>ing <eltref ref="schema"/> (if clause 1.2.1 above obtains).</p>
</constraintnote>
 <note><p>The above is carefully worded so that multiple <eltref ref="include"/>ing of the same schema document will not constitute a violation of
clause 2 of <specref ref="sch-props-correct"/>, but applications are
allowed, indeed encouraged, to avoid <eltref ref="include"/>ing the same schema document more than once to forestall the necessity of establishing identity
component by component.</p></note>
</div3>
<div3 id="modify-schema">
<head>Including modified component definitions</head>
 <p>In an effort to provide some support for evolution and versioning, it is
possible to incorporate components corresponding to a schema document
<emph>with modifications</emph>.  The modifications have a pervasive impact,
that is, only the redefined components are used, even when referenced from
other incorporated components, whether redefined themselves or not.</p>
 <ednote role="pf">
  <edtext>This facility is very powerful, perhaps too powerful.  Reports of implementation
experience, in terms of useability for particular purposes, of the constraints on
redefinition imposed below and 
of implementation difficulty, would be very welcome.</edtext>
 </ednote>
 <reprdef>
 <reprelt eltname="redefine"/>
</reprdef>
 <p>A <eltref ref="schema"/> information item may contain any number of <eltref ref="redefine"/> elements. Their <code>schemaLocation</code> attributes, consisting of a URI reference, identify other <termref def="key-schemaDoc">schema document</termref>s, that is <eltref ref="schema"/> information items. 
</p>
<p>The <termref def="key-schema">XML Schema</termref> corresponding 
to <eltref ref="schema"/> not only contains all the components specified elsewhere, but also
all the components of all the <termref def="key-schema">XML Schema</termref>s corresponding to any <eltref ref="redefine"/>d schema documents.
Such components must either (a) have the same
<code>targetNamespace</code> as the <eltref ref="include"/>ing schema document, or 
(b) no <code>targetNamespace</code> at all, in which case all the top-level
components are converted to the <eltref ref="redefine"/>ing schema document's <code>targetNamespace</code>.</p>
 <p>The definitions within the <eltref ref="redefine"/> element itself are
restricted to be redefinitions of components from the <eltref ref="redefine"/>d
schema document, <emph>in terms of themselves</emph>.  That is, type
definitions must use themselves as their base type definition, and attribute
group definitions and model group definitions must include exactly one reference to
themselves.  Not all the definitions of the <eltref ref="redefine"/>d
schema document need be redefined.</p>
 <p>This mechanism is intended to provide a declarative and modular approach to
schema modification, with functionality no different except in scope from what
would be achieved by wholesale text copying and redefinition by editing.  In
particular redefining a type is not guaranteed to be side-effect free:  it may
in particular have unexpected impacts on other type definitions which are based
on the redefined one, even to the extent that some such definitions become ill-formed.</p>
 <note role="example">
  <eg xml:space="preserve"><![CDATA[v1.xsd:
 <xs:complexType name="personName">
  <xs:sequence>
   <xs:element name="title" minOccurs="0"/>
   <xs:element name="forename" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
 </xs:complexType>

 <xs:element name="addressee" type="personName"/>

v2.xsd:
 <xs:redefine schemaLocation="v1.xsd">
  <xs:complexType name="personName">
   <xs:complexContent>
    <xs:extension base="personName">
     <xs:sequence>
      <xs:element name="generation" minOccurs="0"/>
     </xs:sequence>
    </xs:extension>
   </xs:complexContent>
  </xs:complexType>
 </xs:redefine>

 <xs:element name="author" type="personName"/>]]>
  </eg>
  <p>The schema corresponding to <code>v2.xsd</code> has everything specified
by <code>v1.xsd</code>, with the <code>personName</code> type redefined, as
well as everything it specifies itself.  According to
this schema, elements constrained
by the <code>personName</code> type may end with a <code>generation</code>
element.  This includes not only the <code>author</code> element, but also the
<code>addressee</code> element.</p>
 </note>
 <constraintnote type="src" id="src-redefine">
 <head>Redefinition Constraints and Semantics</head>
 <p>In addition to the conditions imposed on <eltref ref="redefine"/> element
information items by the schema for schemas, the following must also hold:
    <olist>
    <item>
     <p>If the &i-value; of the <code>schemaLocation</code> &i-attribute;
successfully resolves, it resolves either
      <olist>
       <item>
        <p>to (a fragment of) a resource of type
<code>text/xml</code>, which in turn corresponds to a <eltref ref="schema"/>
element information item in a well-formed information set, which in turn
corresponds to a valid schema</p>
       </item>
      </olist>
      or
      <olist>
       <item>
        <p>to a <eltref ref="schema"/>
element information item in a well-formed information set, which in turn
corresponds to a valid schema.</p>
       </item>
      </olist>
      In either case call the <eltref ref="schema"/> item <B>SII</B> and the valid schema <B>I</B>.</p>
    </item>
     <item>
      <p>The <code>targetNamespace</code> of <B>SII</B> is either 
       <olist>
        <item>
         <p><termref def="key-null">absent</termref></p>
        </item>
       </olist>
        or
       <olist>
        <item>
         <p>identical to the <code>targetNamespace</code> of the <eltref ref="include"/>
item's parent <eltref ref="schema"/>.</p>
        </item>
       </olist>
</p>
     </item>
     <item>
      <p>Within the &i-children;, each <eltref ref="simpleType"/> must
have a <eltref ref="restriction"/> among its &i-children; and each <eltref ref="complexType"/> must have a <code>restriction</code> or <code>extension</code> among its grand-&i-children; the &i-value; of whose <code>base</code> &i-attribute; must be the same as the &i-value; of its own <code>name</code> attribute plus target namespace;</p>
     </item>
     <item>
      <p>Within the &i-children;, each <eltref ref="group"/> must have exactly one
<eltref ref="group"/> among its contents at some level the &i-value; of whose
<code>ref</code> &i-attribute; must be the same as the &i-value; of its own
<code>name</code> attribute plus target namespace;</p>
     </item>
     <item>
      <p>Within the &i-children;, each <eltref ref="attributeGroup"/> must have
exactly one
<eltref ref="attributeGroup" inside="simpleContent"/> among its &i-children; the &i-value; of whose
<code>ref</code> &i-attribute; must be the same as the &i-value; of its own
<code>name</code> attribute plus target namespace;</p>
     </item>
   </olist>
   </p>
 <p>It is <emph>not</emph> an error for the &i-value; of the
<code>schemaLocation</code> &i-attribute; to fail to resolve it all, in which case no
corresponding redefinition is performed.  It
<emph>is</emph> an error for it to resolve but the rest of clause 1.1 above to
fail to obtain.  Failure to resolve may well cause less than complete
<termref def="key-va">assessment</termref> outcomes, of course.</p>
 <p>The <termref def="key-component">schema component</termref>s (that is
<propref ref="type_definitions"/> <propref ref="attribute_declarations"/>, <propref ref="element_declarations"/>, <propref ref="attribute_group_definitions"/>, <propref ref="model_group_definitions"/>, <propref ref="notation_declarations"/>) of a schema corresponding to a
<eltref ref="schema"/> element information item with one or more <eltref ref="redefine"/> element information items must include not only definitions or declarations corresponding to the appropriate members of its &i-children;, but also, for each of those <eltref ref="redefine"/> element information items for which clause 1.1 above obtains successfully, with the exception of those components explicitly redefined, as described in <specref ref="src-expredef"/> below, a set of components identical to all the <termref def="key-component">schema component</termref>s of <B>I</B> (if clause 1.2.2 above obtains), or identical in all respects except their <B>{target namespace}</B>, which is that of the <eltref ref="include"/>ing <eltref ref="schema"/> (if clause 1.2.1 above obtains).</p>
</constraintnote>
 <constraintnote type="src" id="src-expredef">
  <head>Individual Component Redefinition</head>
  <p>Corresponding to each non-<eltref ref="annotation"/> member of the
&i-children; of a <eltref ref="redefine"/> there are one or two schema components in
the <eltref ref="redefine"/>ing schema:</p>
  <olist>
   <item>
    <p>The <eltref ref="simpleType"/> and <eltref ref="complexType"/>
&i-children; information items each
correspond to two components:</p>
    <olist>
     <item>
      <p>One component which corresponds to the top-level definition item with
the same <code>name</code> in
the <eltref ref="redefine"/>d schema document, as defined in <specref ref="declare"/>, except that its <B>{name}</B> is <termref def="key-null">absent</termref>;</p>
     </item>
     <item>
      <p>One component which corresponds to the information item itself, as defined
in <specref ref="declare"/>, except that its <B>{base type definition}</B> is
the component defined in 1.1 above</p>
     </item>
    </olist>
    <p>This pairing ensures the coherence constraints on type definitions
are respected, while at the same time achieving the desired effect, namely that
references to names of redefined components in both the <eltref ref="redefine"/>ing and
<eltref ref="redefine"/>d schema documents resolve to the redefined component
as specified in 1.2 above.</p>
   </item>
   <item>
    <p>The <eltref ref="group"/> and <eltref ref="attributeGroup"/>
&i-children; each correspond to a single component, as defined in <specref ref="declare"/>, except that when the <code>ref</code> &i-attribute; whose &i-value; is the same as the item's <code>name</code> plus target namespace is resolved, a component which corresponds to the top-level definition item of that name and the appropriate kind in
the <eltref ref="redefine"/>d schema document, as defined in <specref ref="declare"/>, is used.</p>
   </item>
  </olist>
  <p>In all cases there must be a top-level definition item of the appropriate name and kind in
the <eltref ref="redefine"/>d schema document.</p>
 </constraintnote>
 <note><p>The above is carefully worded so that multiple equivalent <eltref ref="redefine"/>ing of the same schema document will not constitute a violation of
clause 2 of <specref ref="sch-props-correct"/>, but applications are
allowed, indeed encouraged, to avoid <eltref ref="redefine"/>ing the same
schema document in the same way more than once to forestall the necessity of
establishing identity component by component (although this will have to be
done for the individual redefinitions themselves).</p></note>
</div3>
<div3 id="composition-schemaImport">
<head>References to schema components across namespaces</head>
<p>As described in <specref ref="concepts-data-model"/>, every global schema component is associated with
a target namespace (or, explicitly, with none).  In this section we set out
the exact mechanism and syntax in the XML form of
schema definition by which a reference to a foreign component is made, that is, a component with a different target namespace from that of the referring component.</p>
<p>We require not only a means
of addressing such foreign components but also a signal to schema-aware processors that a
schema document contains such references:</p>
 <reprdef>
 <reprelt eltname="import"/>
</reprdef>
 <p>The <eltref ref="import"/> element information item identifies namespaces
used in external references, i.e. those whose
<termref def="gloss-QName">QName</termref> identifies them as coming from a
different namespace (or none) than the enclosing schema document's
<code>targetNamespace</code>.  The &i-value; of its <code>namespace</code>
&i-attribute; indicates that the containing schema document may contain
qualified references to schema components in that namespace (via one or more
prefixes declared with namespace declarations in the normal way).  If that
attribute is absent, then the import allows unqualified reference to components
with no target namespace.
Note that components to be imported need not be in the form of a
<termref def="key-schemaDoc">schema document</termref>;  the processor
is free to access or construct components using means of its own
choosing.</p>
<p>The
&i-value; of the <code>schemaLocation</code>, if present, gives a
hint as to where a  <termref def="key-schemaDoc">schema document</termref> with declarations and definitions for that
namespace (or none) may be found.  When no
<code>schemaLocation</code> &i-attribute; is present, the schema author is leaving the
identification of that schema to the instance, application or user, via the mechanisms described
below in <specref ref="composition-instances"/>.  When a <code>schemaLocation</code> is present, it
must contain a single URI reference which the schema author
warrants will resolve to a <termref def="key-schemaDoc">schema document</termref> containing the component(s) in the
<eltref ref="import"/>ed namespace referred to elsewhere in the containing
schema document.</p>
 <note>
  <p>Since both the <code>namespace</code> and <code>schemaLocation</code>
&i-attribute; are optional, a bare <code>&lt;import/></code> information item
is allowed.  This simply allows unqualified reference to foreign
components without giving any hints as to where to find them.</p>
 </note>
 <note role="example"><p>We may use the same namespace both for real work, and in the course of
defining schema components in terms of foreign components:</p>
<eg xml:space="preserve">&lt;schema xmlns="http://www.w3.org/2000/10/XMLSchema"
        xmlns:html="http://www.w3.org/1999/xhtml"
        targetNamespace="uri:mywork" xmlns:my="uri:mywork">

 &lt;import namespace="http://www.w3.org/1999/xhtml"/>

 &lt;annotation>
  &lt;documentation>
   &lt;html:p>[Some documentation for my schema]&lt;/html:p>
  &lt;/documentation>
 &lt;/annotation>

 . . .

 &lt;complexType name="myType">
  &lt;sequence>
   &lt;element ref="html:p" minOccurs="0"/>
  &lt;/sequence>
  . . .
 &lt;/complexType>

 &lt;element name="myElt" type="my:myType"/>
&lt;/schema>
</eg>
<p>The treatment of references as <termref def="gloss-QName">QNames</termref> implies that since (with the exception of
the schema for schemas) the target namespace and the XML Schema namespace
differ, without massive redeclaration of the default namespace
<emph>either</emph> internal references to the names being defined in a schema document
<emph>or</emph> the schema declaration and definition elements themselves must
be explicitly qualified.  This example takes the first option -- most other
examples in this specification have taken the second.</p>
</note>
 <constraintnote type="src" id="src-import">
 <head>Import Constraints and Semantics</head>
 <p>In addition to the conditions imposed on <eltref ref="import"/> element
information items by the schema for schemas, the following must also hold:
    <olist>
    <item>
     <p>If the application schema reference strategy using the &i-value;s of
the <code>schemaLocation</code> and <code>namespace</code> &i-attributes;,
provides a referent, as defined by <specref ref="schema_reference"/>, it is
either
      <olist>
       <item>
        <p>(a fragment of) a resource of type
<code>text/xml</code>, which in turn corresponds to a <eltref ref="schema"/>
element information item in a well-formed information set, which in turn
corresponds to a valid schema</p>
       </item>
      </olist>
      or
      <olist>
       <item>
        <p>a <eltref ref="schema"/>
element information item in a well-formed information set, which in turn
corresponds to a valid schema.</p>
       </item>
      </olist>
      In either case call the <eltref ref="schema"/> item <B>SII</B> and the valid schema <B>I</B>.</p>
    </item>
     <item>
      <p>The <code>targetNamespace</code> of <B>SII</B> is identical to the &i-value; of the
<code>namespace</code> &i-attribute;</p>
     </item>
   </olist>
   </p>
 <p>It is <emph>not</emph> an error for the application schema reference
strategy to fail.  It
<emph>is</emph> an error for it to resolve but the rest of clause 1.1 above to
fail to obtain.  Failure to find a referent may well cause less than complete
<termref def="key-va">assessment</termref> outcomes, of course.</p>
 <p>The <termref def="key-component">schema component</termref>s (that is
<propref ref="type_definitions"/> <propref ref="attribute_declarations"/>, <propref ref="element_declarations"/>, <propref ref="attribute_group_definitions"/>, <propref ref="model_group_definitions"/>, <propref ref="notation_declarations"/>) of a schema corresponding to a
<eltref ref="schema"/> element information item with one or more <eltref ref="import"/> element information items must include not only definitions or declarations corresponding to the appropriate members of its &i-children;, but also, for each of those <eltref ref="import"/> element information items for which clause 1.1 above obtains successfully, a set of <termref def="key-component">schema component</termref>s identical to all the <termref def="key-component">schema component</termref>s of <B>I</B>.</p>
</constraintnote>
 <note><p>The above is carefully worded so that multiple <eltref ref="import"/>ing of the same schema document will not constitute a violation of
clause 2 of <specref ref="sch-props-correct"/>, but applications are
allowed, indeed encouraged, to avoid <eltref ref="import"/>ing the same schema document more than once to forestall the necessity of establishing identity
component by component.  Given that the <code>schemaLocation</code>
&i-attribute; is only a hint, it is open to applications to ignore all but the
first <eltref ref="import"/> for a given namespace, regardless of the &i-value; of
<code>schemaLocation</code>, but such a strategy risks missing useful
information when new <code>schemaLocation</code>s are offered.</p></note>
</div3></div2>
<div2 id="composition-instances">
<head>Layer 3: Web-interoperability</head>
<p>Layers 1 and 2 provide a framework for <termref def="key-va">assessment</termref> and XML definition of schemas in a broad variety of environments. Over time, we expect that a range
of standards and conventions will evolve to support interoperability of XML
Schema implementations on the World Wide Web. Layer 3 defines the minimum level
of function required of all conformant processors operating on the Web:
it is intended that, over time, future standards (e.g. XML Packages) for interoperability on the
Web and in other environments can be introduced without the need to republish
this specification.</p>
<div3 id="schema-repr">
<head>Standards for representation of schemas and retrieval of schema documents on the Web</head>
<p>For interoperability, schema documents like all other Web resources may be identified by
URI and retrieved using the standard mechanisms of the Web (e.g. http, https,
etc.) Schema documents on the Web must be part of documents with the MIME type <code>text/xml</code>, and are represented in the
standard XML schema definition form described by layer 2 (that is as <eltref ref="schema"/>
element information items). </p>
<note><p> there will often be times when a schema document will be a
complete XML 1.0 document whose document element is <eltref ref="schema"/>. There will be
other occasions in which <eltref ref="schema"/> items will be contained in other
documents, perhaps referenced using fragment and/or Xpointer notation.
</p></note>
</div3>
<div3 id="schema-loc">
<head>How schema definitions are located on the Web</head>
<p>As described in <specref ref="layer1"/>, processors are responsible for providing the
schema components (definitions and declarations) needed for <termref def="key-va">assessment</termref>. This
section introduces a set of normative conventions to facilitate interoperability
for instance and schema documents retrieved and processed from the Web.</p>
<note><p> As discussed above in <specref ref="layer2"/>, other non-Web mechanisms for delivering schemas for <termref def="key-va">assessment</termref> may exist, but are outside the scope of this specification.</p></note>
<p>Processors on the Web are free to undertaking <termref def="key-va">assessment</termref> against arbitrary
schemas in any of the ways set out in <specref ref="validation_outcome"/>. However, it
is useful to have a common convention for determining the schema to use. For
this purpose, we require that for general-purpose schema-aware processors (i.e. those not
specialised to one or a fixed set of pre-determined schemas)
undertaking <termref def="key-va">assessment</termref> of a document on the web:
<ulist>
<item>
<p>unless directed otherwise by the user, <termref def="key-va">assessment</termref> is undertaken on the document
element information item of the specified document;</p>
</item>
<item>
<p>unless directed otherwise by a user, the
processor is required to construct a schema corresponding to a schema document
whose <code>targetNamespace</code> is
identical to the
namespace URI, if any, of the element information item on which <termref def="key-va">assessment</termref> is undertaken.</p>
</item>
</ulist>
</p>
<p>The composition of the complete
schema for use in <termref def="key-va">assessment</termref> is discussed in <specref ref="layer2"/> above.
The means used to locate appropriate schema document(s) are processor and
application dependent, subject to the following requirements: </p>
<olist>
  <item><p>Schemas are represented on the Web in the form specified above in <specref ref="schema-repr"/>;</p></item>
  <item><p>The author of a document uses namespace declarations to indicate the intended
interpretation of names appearing therein; there may or may not be a schema
retrievable via the namespace URI.  Accordingly whether a processor's default
behaviour is or is not to attempt such dereferencing, it must always provide
for user-directed overriding of that default.
</p>
<note><p> Experience suggests that it is not in all cases safe or desirable from
a performance point of view to dereference NS URIs as a matter of course.  User community and/or
consumer/provider agreements may establish circumstances in which such dereference is a sensible
default strategy:  this specification allows but does not require particular communities to
establish and implement such conventions.  Users are always free to supply namespace URIs as schema location information when dereferencing <emph>is</emph> desired:  see below.</p></note></item>
<item>
<p>
On the other hand, in case a document author (human or not) created a
document with a particular schema in view, and warrants that some or
all of the document is conforms to that schema, we provide the
<code>schemaLocation</code> and <code>noNamespaceSchemaLocation</code> &i-attributes; (in the XML Schema instance namespace,
that is, <code>http://www.w3.org/2000/10/XMLSchema-instance</code>) (hereafter
<code>xsi:schemaLocation</code> and
<code>xsi:noNamespaceSchemaLocation</code>).  The first records
the author's warrant with pairs of URI references (one for the namespace URI, and
one for a hint as to the location of a schema document defining names for that
namespace URI).  The second similarly provides a URI reference as a hint as to
the location of a schema document with no <code>targetNamespace</code> &i-attribute;.</p>
<p>Unless directed otherwise, for example by the invoking application
or by command line option, processors
should attempt to dereference each schema document location URI in the
&i-value; of such
<code>xsi:schemaLocation</code> and <code>xsi:noNamespaceSchemaLocation</code> &i-attributes;, see details below.</p>
</item>
<item>  <p><code>xsi:schemaLocation</code> and
<code>xsi:noNamespaceSchemaLocation</code> &i-attributes; can occur on any
element.  However, it is an error if such an attribute occurs
<emph>after</emph> the first appearance of an element or attribute information
item within an
element information item initially <termref def="key-vn">validated</termref> whose <xpropref href="http://www.w3.org/TR/xml-infoset#infoitem.attribute">namespace URI</xpropref> it addresses. According to the rules of
  <specref ref="layer1"/>, the corresponding schema may be lazily assembled, but is otherwise
  stable throughout <termref def="key-va">assessment</termref>. Although schema location attributes can occur
  on any element, and can be processed incrementally as discovered, their effect
  is essentially global to the <termref def="key-va">assessment</termref>. Definitions and declarations remain
  in effect beyond the scope of the element on which the binding is declared.
  </p></item>
</olist>
<note role="example"><p>Multiple schema bindings can be declared using a single
attribute.  For example consider a stylesheet:</p>
<eg xml:space="preserve">
 &lt;stylesheet xmlns="http://www.w3.org/1999/XSL/Transform"
            xmlns:html="http://www.w3.org/1999/xhtml"
            xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
            xsi:schemaLocation="http://www.w3.org/1999/XSL/Transform
                                http://www.w3.org/1999/XSL/Transform.xsd
                                http://www.w3.org/1999/xhtml
                                http://www.w3.org/1999/xhtml.xsd">
</eg><p>The namespace URIs used in <code>schemaLocation</code> can, but need not
  be identical to those actually qualifying the element within whose start tag
it is found or its other attributes. For example, as above, all
  schema location information can be declared on the document element
of a document, if desired,
  regardless of where the namespaces are actually used. </p></note>
 <constraintnote id="schema_reference" type="src">
 <head>Schema Document Location Strategy</head>
<p>Given a namespace URI (or none) and (optionally) a URI reference from
<code>xsi:schemaLocation</code> or <code>xsi:noNamespaceSchemaLocation</code>,
schema-aware processors may implement any combination of the following 
strategies, in any order:
<olist><item><p>
Do nothing, for instance because a schema containing components for the
given namespace URI is already known to be available, or because it
is known in advance that no efforts to locate schema documents will be successful 
(for
example in embedded systems);
</p></item>
<item><p>
Based on the location URI, 
identify an existing schema document,
either as a text/xml resource or a <eltref ref="schema"/> element
information item, in some local schema repository;
</p></item>

<item><p>
Based on the namespace URI, identify an existing schema document,
either as a text/xml resource or a <eltref ref="schema"/> element
information item, in some local schema repository;
</p></item>
<item><p>
Attempt to resolve the location URI, 
to locate a
resource on the web which is or contains or references a <eltref ref="schema"/> element;
</p></item>
<item><p>
Attempt to resolve the namespace URI to locate such a resource.
</p></item>
</olist>
Whenever possible configuration and/or invocation options for selecting and/or ordering 
the implemented strategies should be provided.
</p>
</constraintnote>
<p>We note that improved or alternative conventions for Web interoperability can
be standardized in the future without reopening this specification. For
example, the W3C is currently considering initiatives to standardize the
packaging of resources relating to particular documents and/or namespaces: this
would be an addition to the mechanisms described here for layer 3. This
architecture also facilitates innovation at layer 2: for example, it would be
possible in the future to define an additional standard for the representation of
schema components which allowed e.g. type definitions to be specified piece by
piece, rather than all at once.</p>
</div3>
</div2>

</div1>
<div1 id="conformance">
<head>Schemas and schema-validity assessment</head>
 <p>The architecture of schema-aware processing allows for a rich characterization of XML documents:  schema validity is not a binary predicate.</p>
 <p>We distinguish between errors in schema construction and structure, on the
one hand, and schema validation outcomes, on the other.</p>
<div2 id="conformance-schemaValidity">
<head>Errors in Schema Construction and Structure</head>
 <p>Before <termref def="key-va">assessment</termref> can be attempted, a schema is required. 
Special-purpose applications are free to determine a schema for use in <termref def="key-va">assessment</termref> by whatever
means are appropriate, but general purpose processors should implement the
strategy set out in <specref ref="schema_reference"/>, starting with the
namespaces declared in the document whose <termref def="key-va">assessment</termref> is being undertaken, and the &i-value;s of the
<code>xsi:schemaLocation</code> and <code>xsi:noNamespaceSchemaLocation</code>
&i-attributes; thereof, if any, along with an other information about
schema identity or schema document location provided by users in
application-specific ways, if any.</p>
 <p>It is an
error if a
schema and all the components which are the value of any of its properties,
recursively, fail to satisfy all the relevant Constraints on Schemas set out in
<specref ref="conformance-details"/>.</p>
 <p>If a schema is derived from one or more schema documents (that is, one or
more <eltref ref="schema"/> element information items) based on the
correspondence rules set out in <specref ref="declare"/> and <specref ref="composition"/>, two additional
conditions hold:
  <ulist>
   <item>
    <p>It is an error if any such schema document would not be fully valid with respect
to a schema corresponding to the <specref ref="normative-schemaSchema"/>, that
is, following schema-validation with such a schema, the <eltref ref="schema"/> element
information items would have a <xpropref>validation attempted</xpropref>
property with value <pt>full</pt> or <pt>partial</pt> and a <xpropref>validity</xpropref> property
with value <pt>valid</pt>.</p>
   </item>
   <item>
    <p>It is an error if any such schema document is or contains any element
information items which violate any of the relevant Schema Representation
Constraints set out in <specref ref="declare"/> and <specref ref="composition"/>.</p>
   </item>
  </ulist>
 </p>
 <p>The three cases described above are the only types of error which this
specification defines.  With respect to the processes of the checking of schema structure
and the construction of schemas corresponding to schema documents, this
specification imposes no restrictions on processors after an error is detected.
However <termref def="key-va">assessment</termref> with respect to schema-like entities which do <emph>not</emph>
satisfy all the above conditions is incoherent.  Accordingly, conformant
processors must not attempt to undertake <termref def="key-va">assessment</termref> using such non-schemas.</p>
</div2>
 <div2 id="validation_outcome">
  <head>Assessing Schema-Validity of Documents</head>
  <p>With a schema which satisfies the conditions expressed in <specref ref="conformance-schemaValidity"/> above, the schema-validity of an element information item can be assessed.  Three primary approaches to this are possible:
   <olist>
    <item>
     <p>The user or application identifies a complex type definition from among the
<propref ref="type_definitions"/> of the schema, and appeals to <specref ref="cvc-assess-elt"/> (clause 1.1.2);</p>
    </item>
    <item>
    <p>The user or application identifies a element declaration from among the
<propref ref="element_declarations"/> of the schema, and appeals to <specref ref="cvc-assess-elt"/> (clause 1.1.1);</p></item>
    <item>
     <p>The processor starts from <specref ref="cvc-assess-elt"/> with no
stipulated declaration or definition, and either <termref def="key-sva">strict</termref> or <termref def="key-lva">lax</termref> assessment ensues, depending on whether or not the element information and the schema determine either an element declaration (by name) or a type definition (via <code>xsi:type</code>) or not.</p>
    </item>
   </olist>
  </p>
  <p>The outcome of this effort, in any case, will be manifest in the <xpropref>validation attempted</xpropref>
and <xpropref>validity</xpropref> properties on
the element information item and its &i-attributes; and &i-children;,
recursively, as defined by <specref ref="sic-e-outcome"/> and <specref ref="sic-a-outcome"/>.  It is up to applications to decide what constitutes a successful outcome.</p>
  <p>Note that every element and attribute information item
participating in the <termref def="key-va">assessment</termref> will also have a <xpropref>validation context</xpropref> property
which refers back to the element information item at which assessment began.</p>
  <note>
   <p>This specification has nothing normative to say about multiple <termref def="key-va">assessment</termref>
episodes.  It should however be clear from the above that if a processor
restarts <termref def="key-va">assessment</termref> with respect to a &PSVI; some <specref ref="gloss-sic"/>
may be overwritten.  Restarting none-the-less may be useful, particularly at a node whose
<xpropref>validation attempted</xpropref> property is <pt>none</pt>, in which
case there are three obvious cases in which additional useful information may result:
    <ulist>
     <item>
      <p><termref def="key-va">assessment</termref> was not attempted because
of a <termref def="key-vn">validation</termref> failure, but declarations
and/or definitions are available for at least some of the &i-children; or &i-attributes;;</p>
     </item>
     <item>
      <p><termref def="key-va">assessment</termref> was not attempted because a
named definition or declaration was missing, but after further effort the
processor has retrieved it.</p>
     </item>
     <item>
      <p><termref def="key-va">assessment</termref> was not attempted because
it was <pt>skip</pt>ped, but the processor has at least some declarations
and/or definitions available for at least some of the &i-children; or &i-attributes;.</p>
     </item>
    </ulist>
   </p>
  </note>
 </div2>
 <div2 id="conformance-missing">
  <head>Missing Sub-components</head>
  <p>At the beginning of <specref ref="components"/>, attention is drawn to the
fact that most kinds of schema components have properties which are described therein
as having other components, or sets of other components, as values, but that
when components are constructed on the basis of their correspondence with
element information items in schema documents, such properties usually
correspond to <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#QName">QNames</xtermref>, and the
<termref def="src-resolve">resolution</termref> of such <xtermref href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes#QName">QNames</xtermref> may fail, resulting in one or more values of or containing <termref def="key-null">absent</termref> where a component is mandated.</p>
  <p>If at any time during <termref def="key-va">assessment</termref>, an
element or attribute information item is being <termref def="key-vn">validated</termref> with respect to a component of any kind any of whose
properties has or contains such an <termref def="key-null">absent</termref> value,
the <termref def="key-vn">validation</termref> is modified, as following:
   <ulist>
    <item>
     <p>In the case of attribute information items, the effect is
as if clause 1.1 of <specref ref="cvc-attribute"/> had failed;</p>
    </item>
    <item>
     <p>In the case of element information items, the effect is
as if clause 1.1 of <specref ref="cvc-elt"/> had failed;</p>
    </item>
    <item>
     <p>In the case of element information items, processors may choose to
continue <termref def="key-va">assessment</termref>: see <termref def="key-lva">lax assessment</termref>.</p>
    </item>
   </ulist>
  </p>
  <p>Because of the value specification for <xpropref>validation
attempted</xpropref> in <specref ref="sic-e-outcome"/>, if this situation ever arises, the
document as a whole cannot show a <xpropref>validation attempted</xpropref>
of <pt>full</pt>.</p>
 </div2>

<div2 id="conformance-processorResponsibilities">
<head>Responsibilities of Schema-aware processors</head>
 <p>Schema-aware processors are responsible for processing XML documents,
schemas and schema documents, as appropriate given the level of conformance
(as defined in <specref ref="concepts-conformance"/>) they support,
consistently with the conditions set out above.</p>
</div2>
</div1>
</body>

<back>
<div1 id="normative-schemaSchema">
<head>Schema for Schemas (normative)</head>
<p>The XML Schema definition for &XSP1; itself is presented here as normative
part of the specification, and as an illustrative example of the XML Schema in
defining itself with the very constructs that it defines. The names of XML
Schema language types, elements, attributes and groups defined here
are evocative of their purpose, but are occasionally verbose. </p>
<p>There is some annotation in comments, but a fuller annotation will require
the use of embedded documentation facilities or a hyperlinked external
annotation for which tools are not yet readily available.</p>
<p>Since an &XSP1; is an XML document, it has optional XML and doctype
declarations that are provided here for completeness. The root
<code>schema</code> element defines a new schema. Since this is a schema for
&XSP1;, the <code>targetNamespace</code> references the XML Schema namespace itself.</p>
<eg xml:space="preserve" text="XMLSchema.xsd,txt"/>
<note>
<p>And that is the end of the schema for &XSP1;.</p>
</note>


</div1>
<div1 id="normative-references">
<head>References (normative)</head>
<blist> 
<bibl id="ref-xsp2" key="XML Schemas: Datatypes">
<emph>XML Schema Part 2: Datatypes</emph>, Paul V. Biron and Ashok
Malhotra, eds.  See <loc href="http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes.html">http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/datatypes.html</loc> </bibl>
<bibl id="ref-xsreq" key="XML Schema Requirements">
<emph>XML Schema Requirements </emph>, Ashok Malhotra and Murray Maloney, ed.,
W3C, 15 February 1999. See <loc href="http://www.w3.org/TR/NOTE-xml-schema-req">http://www.w3.org/TR/NOTE-xml-schema-req
</loc> </bibl>
<bibl id="ref-xml" key="XML"> <emph>Extensible
Markup Language (XML) 1.0</emph>, Tim Bray, et al., eds., W3C, 10 February 1998. See
<loc href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</loc>
</bibl>
 <bibl id="ref-xbase" key="XML Base"><emph>XML Base</emph>, Jonathan Marsh,
ed., W3C, 8 September 2000.  See <loc href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</loc></bibl>
<bibl id="ref-xmlinfo" key="XML-Infoset">XML Information Set (public WD),
John Cowan, ed., W3C, July 2000. See
<loc href="http://www.w3.org/TR/xml-infoset">http://www.w3.org/TR/xml-infoset</loc>
</bibl>
<bibl id="ref-xml-namespaces" key="XML-Namespaces">
Namespaces in XML, Tim Bray et al., W3C, 1998. See
<loc href="http://www.w3.org/TR/REC-xml-names/">http://www.w3.org/TR/WD-xml-names/</loc> </bibl>
<bibl id="ref-xpointer" key="XPointer"> <emph>XML
Pointer Language (XPointer)</emph>, Eve Maler and Steve DeRose, W3C, 3 March
1998. See <loc href="http://www.w3.org/TR/xptr">http://www.w3.org/TR/xptr</loc> </bibl>
 <bibl id="bib-xpath" key="XPath"><emph>XML Path Language</emph>, James Clark
and Steve DeRose, editors, 16 November 1999.  See <loc href="http://www.w3.org/TR/xpath">http://www.w3.org/TR/xpath</loc></bibl>
</blist>
</div1>
 <div1 id="outcomes">
  <head>Outcome Tabulations (normative)</head>
  <p>To facilitate consistent reporting of schema errors and <termref def="key-vn">validation</termref>
failures, this section tabulates and provides unique names for all the
constraints listed in this document.  Wherever such constraints have numbered
parts, reports should use the name given below plus the part number, separated
by a period ('.').  Thus for example <code>cos-ct-extends.1.2</code> should be
used to report a violation of the second clause of
<specref ref="cos-ct-extends"/>.</p>
  <div2 id="schema_errors">
   <head>Constraints on Schemas and Schema Representation Constraints</head>
   <p/>
  </div2>
  <div2 id="validation_failures">
   <head>Validity Rules</head>
   <p/>
  </div2>
  <div2 id="PSVI_contributions">
   <head>&PSVI; Contributions</head>
  </div2>
 </div1>
 <div1 id="infoset">
  <head>Required Information Set Items and Properties (normative)</head>
  <p>This specification requires as a precondition for <termref def="key-va">assessment</termref> an information set as defined in <bibref ref="ref-xmlinfo"/> which supports at least the following information items and properties:</p>
  <glist>
   <gitem>
    <label>Attribute Information Item</label>
    <def>
     <p><xpropref>local name</xpropref>, <xpropref>namespace URI</xpropref>,
<xpropref>normalized value</xpropref></p>
    </def>
   </gitem>
   <gitem>
    <label>Character Information Item</label>
    <def>
     <p><xpropref>character code</xpropref></p>
    </def>
   </gitem>
   <gitem>
    <label>Element Information Item</label>
    <def>
     <p><xpropref>local name</xpropref>, <xpropref>namespace URI</xpropref>,
<xpropref>children</xpropref>, <xpropref>attributes</xpropref>, <xpropref>in-scope namespaces</xpropref> or
<xpropref>declared namespaces</xpropref></p>
    </def>
   </gitem>
   <gitem>
    <label>Namespace Declaration Information Item</label>
    <def>
     <p><xpropref>prefix</xpropref>, <xpropref>children</xpropref></p>
    </def>
   </gitem>
  </glist>
 </div1> 
<div1 id="normative-glossary">
<head>Glossary (non-normative)</head>
<p>The listing below is for the benefit of readers of a printed version of this
document:  it collects together all the definitions which appear in the
document above.</p>
<ednote role="glossary">
<edtext>An XSL macro is used to
collect definitions from throughout the spec and gather them here for easy
reference.</edtext>
</ednote>

</div1>
 <div1 id="nonnormative-schemaDTD">
<head>DTD for Schemas (non-normative)</head>
<p>The DTD for &XSP1; is given below.  Note there is <emph>no</emph>
implication here the <code>schema</code> must be the root element of a
document.</p>
<p>Although this DTD is non-normative, any XML document which is
     not valid per this DTD, given redefinitions in its internal subset of the
     'p' and 's' parameter entities below appropriate to its namespace
     declaration of the XML Schema namespace, is almost certainly not
     a valid schema document, with the exception of documents with multiple namespace
     prefixes for the XML Schema namespace itself.  Accordingly
authoring XML Schema documents using this DTD and DTD-based authoring tools, and
specifying it as the DOCTYPE of documents intended to be XML Schema
documents and validating them with a validating XML parser, are
sensible development strategies which users are encouraged to adopt
until XML Schema-based authoring tools and validators are more widely available.</p>
<eg xml:space="preserve" text="XMLSchema.dtd,txt"/>
</div1>
 <div1 id="non-ambig">
  <head>Analysis of the Unique Particle Attribution constraint (non-normative)</head>
  <p>A specification of the import of <specref ref="cos-nonambig"/> which does
not appeal to a processing model is difficult.  What follows is intended as
guidance, without claiming to be complete.</p>
   <p><termdef term="overlap" id="key-overlap">We say that two non-group
particles <term>overlap</term> if </termdef>
   <ulist>
    <item>
     <p>They are both element declaration particles whose declarations have the
same <propref ref="e-name"/> and <propref ref="e-target_namespace"/></p>
    </item>
   </ulist>
    or
    <ulist>
    <item>
     <p>They are both element declaration particles one of which is in the
other's <termref def="key-eq">substitution group</termref></p>
    </item>
   </ulist>
    or
    <ulist>
     <item>
      <p>They are both wildcards, and the intensional intersection of their <propref ref="namespace_constraint"/>s as defined
in <specref ref="cos-aw-intersect"/> is not the empty set</p>
     </item>
    </ulist>
    or
    <ulist>
     <item>
      <p>One is a wildcard and the other an element declaration, and the
<propref ref="e-target_namespace"/> of the element declaration, or of any
member of its <termref def="key-eq">substitution group</termref>, is <termref def="key-vn">valid</termref> with respect to the <propref ref="namespace_constraint"/> of the wildcard.</p>
     </item>
    </ulist>
   </p>
   <p>A content model will violate the unique attribution constraint if it
contains two particles which <termref def="key-overlap">overlap</termref> and which either
    <ulist>
     <item>
      <p>are both in the <propref ref="particles"/> of a <pt>choice</pt> or
<pt>all</pt> group</p>
     </item>
    </ulist>
    or
    <ulist>
     <item>
      <p>may <termref def="key-vn">validate</termref> adjacent information items and the first has
<propref ref="p-min_occurs"/> less than <propref ref="p-max_occurs"/></p>
     </item>
    </ulist>
   </p>
   <p>Two particles may <termref def="key-vn">validate</termref> adjacent information items if they are
separated by at most epsilon transitions in the most obvious transcription of a
content model into a finite-state automaton.</p>
  <p>A precise formulation of this constraint can also be offered in terms of
operations on finite-state automaton:  transcribe the content model into an
automaton in the usual way using epsilon transitions for optionality and
unbounded maxOccurs, unfolding other numeric occurrence ranges and treating the heads of substitution groups as if
they were choices over all elements in the group, <emph>but</emph> using not
element QNames as transition labels, but rather pairs of element QNames and
positions in the model.  Determinise this automaton, treating wildcard transitions as opaque.  Now replace all
QName+position transition labels with the element QNames alone.  If the result has any states
with two or more identical-QName-labelled transitions from it, or a
QName-labelled transition and a wildcard transition which subsumes it, or two
wildcard transitions whose intentional intersection is non-empty, the model does not
satisfy the Unique Attribution constraint.   </p>
 </div1>
 <div1 id="nonnormative-references">
  <head>References (non-normative)</head>
  <blist>
<bibl id="ref-dcd" key="DCD"> <emph>Document
Content Description for XML (DCD)</emph>, Tim Bray et al. W3C, 10 August 1998.
See <loc href="http://www.w3.org/TR/NOTE-dcd">http://www.w3.org/TR/NOTE-dcd
</loc> </bibl>
<bibl id="ref-ddml" key="DDML"> <emph>Document
Definition Markup Language</emph>. See
<loc href="http://www.w3.org/TR/NOTE-ddml">http://www.w3.org/TR/NOTE-ddml
</loc> </bibl>
 <bibl id="bib-expo" key="XML Schema: Primer"><emph>XML Schema:
Primer</emph>, David C. Fallside, ed.  See <loc href="http://www.w3.org/TR/2000/CR-xmlschema-0-20001024/primer.html">http://www.w3.org/TR/2000/CR-xmlschema-0-20001024/primer.html</loc></bibl>
<bibl id="ref-sox" key="SOX"> <emph>Schema for
Object-oriented XML</emph>, Matt Fuchs, et al. W3C, 1998. See
<loc href="http://www.w3.org/Submission/1998/15/">http://www.w3.org/Submission/1998/15/
</loc> </bibl>
<bibl id="ref-sox-1.1" key="SOX-1.1"> <emph>Schema
for Object-oriented XML</emph>, Version 1.1, Matt Fuchs, et al. W3C, 1999. See
???</bibl>
<bibl id="ref-xdr" key="XDR"> <emph>XML-Data
Reduced</emph>, Frankston, Charles, and Henry S. Thompson, ed. See
<loc href="http://www.ltg.ed.ac.uk/~ht/XMLData-Reduced.htm">http://www.ltg.ed.ac.uk/~ht/XMLData-Reduced.htm
</loc> </bibl>
<bibl id="ref-xml-data" key="XML-Data">
<emph>XML-Data</emph>, Andrew Layman, et al. W3C, 05 January 1998. See
<loc href="http://www.w3.org/TR/1998/NOTE-XML-data-0105/">http://www.w3.org/TR/1998/NOTE-XML-data-0105/</loc> </bibl>
<bibl id="ref-xschema" key="XSchema"> <emph>XSchema
Specification</emph>, Simon St. Laurent, Ronald Bourret, John Cowan, et al.,
Version 1.0, Draft, 18 October 1998. See
<loc href="http://www.simonstl.com/xschema/spec/xscspecv4.htm">http://www.simonstl.com/xschema/spec/xscspecv4.htm
</loc>.  For more general information, consult
<loc href="http://purl.oclc.org/NET/xschema">http://purl.oclc.org/NET/xschema
</loc> </bibl>
  </blist>
 </div1>
<div1 id="acknowledgments">
<head>Acknowledgements (non-normative)</head>
 <p>The following have contributed material to this draft:</p>
 <slist>
  <sitem>David Fallside, IBM</sitem>
  <sitem>Scott Lawrence, Agranat Systems</sitem>
  <sitem>Andrew Layman, Microsoft</sitem>
  <sitem>Eve L. Maler, Sun Microsystems</sitem>
 </slist>
<p>The editors acknowledge the members of the XML Schema Working Group, the members of other W3C Working Groups, and industry experts in other
forums who have contributed directly or indirectly to the process or content of
creating this document. The Working Group is particularly grateful to Lotus
Development Corp. and IBM for providing teleconferencing facilities.</p>
 <p>The current members of the XML Schema Working Group are:</p>
<orglist>
<member>
 <name>Jim Barnette</name>
 <affiliation>Defense Information Systems Agency (DISA)</affiliation>
</member>
<member>
 <name>David Beech</name>
 <affiliation>Oracle Corp.</affiliation>
</member>
<member>
 <name>Paul V. Biron</name>
 <affiliation>Health Level Seven</affiliation>
</member>
<member>
 <name>Don Box</name>
 <affiliation>DevelopMentor</affiliation>
</member>
<member>
 <name>Allen Brown</name>
 <affiliation>Microsoft</affiliation>
</member>
<member>
 <name>Lee Buck</name>
 <affiliation>TIBCO Extensibility</affiliation>
</member>
<member>
 <name>Charles E. Campbell</name>
 <affiliation>Informix</affiliation>
</member>
 <member>
  <name>Wayne Carr</name>
  <affiliation>Intel</affiliation>
 </member>
<member>
 <name>Peter Chen</name>
 <affiliation>Bootstrap Alliance and LSU</affiliation>
</member>
<member>
 <name>David Cleary</name>
 <affiliation>Progress Software</affiliation>
</member>
 <member>
  <name>Mike Cokus</name>
  <affiliation>MITRE</affiliation>
 </member>
<member>
 <name>Dan Connolly</name>
 <affiliation>W3C</affiliation>
 <role>staff contact</role>
</member>
<member>
 <name>Roger L. Costello</name>
 <affiliation>MITRE</affiliation>
</member>
<member>
 <name>Ugo Corda</name>
 <affiliation>Xerox</affiliation>
</member>
 <member>
  <name>Haavard Danielson</name>
  <affiliation>Progress Software</affiliation>
 </member>
<member>
 <name>David Ezell</name>
 <affiliation>Hewlett Packard Company</affiliation>
</member>
<member>
 <name>David Fallside</name>
 <affiliation>IBM</affiliation>
</member>
<member>
 <name>Matthew Fuchs</name>
 <affiliation>Commerce One</affiliation>
</member>
<member>
 <name>Andrew Goodchild</name>
 <affiliation>Distributed Systems Technology Centre (DSTC Pty Ltd)</affiliation>
</member>
<member>
 <name>Paul Grosso</name>
 <affiliation>ArborText, Inc</affiliation>
</member>
<member>
 <name>Martin Gudgin</name>
 <affiliation>DevelopMentor</affiliation>
</member>
<member>
 <name>Dave Hollander</name>
 <affiliation>Contivo</affiliation>
 <role>co-chair</role>
</member>
<member>
 <name>Mary Holstege</name>
 <affiliation>Calico Commerce</affiliation>
</member>
<member>
 <name>Jane Hunter</name>
 <affiliation>Distributed Systems Technology Centre (DSTC Pty Ltd)</affiliation>
</member>
 <member>
  <name>Rick Jelliffe</name>
  <affiliation>Academia Sinica</affiliation>
 </member>
<member>
 <name>Andrew Layman</name>
 <affiliation>Microsoft</affiliation>
</member>
<member>
 <name>Dmitry Lenkov</name>
 <affiliation>Hewlett Packard Company</affiliation>
</member>
<member>
 <name>Ashok Malhotra</name>
 <affiliation>IBM</affiliation>
</member>
<member>
 <name>Murray Maloney</name>
 <affiliation>Muzmo Communication, acting for Commerce One</affiliation>
</member>
<member>
 <name>John McCarthy</name>
 <affiliation>Lawrence Berkeley National Laboratory</affiliation>
</member>
<member>
 <name>Noah Mendelsohn</name>
 <affiliation>Lotus Development Corporation</affiliation>
</member>
<member>
 <name>Don Mullen</name>
 <affiliation>TIBCO Extensibility</affiliation>
</member>
 <member>
  <name>Alex Milowski</name>
  <affiliation>Lexica LLC</affiliation>
 </member>
<member>
 <name>Frank Olken</name>
 <affiliation>Lawrence Berkeley National Laboratory</affiliation>
</member>
 <member>
  <name>Dave Peterson</name>
  <affiliation>Graphic Communications Association</affiliation>
 </member>
<member>
 <name>Jonathan Robie</name>
 <affiliation>Software AG</affiliation>
</member>
 <member>
  <name>Lew Shannon</name>
  <affiliation>NCR</affiliation>
 </member>
<member>
 <name>C. M. Sperberg-McQueen</name>
 <affiliation>W3C</affiliation>
 <role>co-chair</role>
</member>
<member>
 <name>Bob Streich</name>
 <affiliation>Calico Commerce</affiliation>
</member>
<member>
 <name>Henry S. Thompson</name>
 <affiliation>University of Edinburgh</affiliation>
</member>
<member>
 <name>Matt Timmermans</name>
 <affiliation>Microstar</affiliation>
</member>
<member>
 <name>Jim Trezzo</name>
 <affiliation>Oracle Corp.</affiliation>
</member>
<member>
 <name>Mark Tucker</name>
 <affiliation>Health Level Seven</affiliation>
</member>
 <member>
  <name>Asir S. Vedamuthu</name>
  <affiliation>webMethods, Inc</affiliation>
 </member>
<member>
 <name>Priscilla Walmsley</name>
 <affiliation>XMLSolutions</affiliation>
</member>
<member>
 <name>Norm Walsh</name>
 <affiliation>Sun Microsystems</affiliation>
</member>
<member>
 <name>Aki Yoshida</name>
 <affiliation>SAP AG</affiliation>
</member>
</orglist>
 <p>The XML Schema Working Group has benefited in its work from the
participation and contributions of a number of people not currently
members of the Working Group, including
in particular those named below.  Affiliations given are those current at
the time of their work with the WG.
</p>
 <orglist>
<member>
 <name>Paula Angerstein</name>
 <affiliation>Vignette Corporation</affiliation>
</member>
 <member>
  <name>Gabe Beged-Dov</name>
  <affiliation>Rogue Wave Software</affiliation>
 </member>
<member>
 <name>Greg Bumgardner</name>
 <affiliation>Rogue Wave Software</affiliation>
</member>
<member>
 <name>Dean Burson</name>
 <affiliation>Lotus Development Corporation</affiliation>
</member>
 <member>
 <name>Andrew Eisenberg</name>
 <affiliation>Progress Software</affiliation>
</member>
<member>
 <name>Rob Ellman</name>
 <affiliation>Calico Commerce</affiliation>
</member>
 <member>
  <name>George Feinberg</name>
  <affiliation>Object Design</affiliation>
 </member>
 <member>
  <name>Charles Frankston</name>
  <affiliation>Microsoft</affiliation>
 </member>
 <member>
  <name>Ernesto Guerrieri</name>
  <affiliation>Inso</affiliation>
 </member>
 <member>
  <name>Michael Hyman</name>
  <affiliation>Microsoft</affiliation>
 </member>
<member>
 <name>Renato Iannella</name>
 <affiliation>Distributed Systems Technology Centre (DSTC Pty Ltd)</affiliation>
</member>
 <member>
  <name>Dianne Kennedy</name>
  <affiliation>Graphic Communications Association</affiliation>
 </member>
<member>
 <name>Janet Koenig</name>
 <affiliation>Sun Microsystems</affiliation>
</member>
<member>
 <name>Setrag Khoshafian</name>
 <affiliation>Technology Deployment International (TDI)</affiliation>
</member>
<member>
 <name>Ara Kullukian</name>
 <affiliation>Technology Deployment International (TDI)</affiliation>
</member>
<member>
 <name>Murata Makoto</name>
 <affiliation>Xerox</affiliation>
</member>
<member>
 <name>Eve Maler</name>
 <affiliation>Sun Microsystems</affiliation>
</member>
 <member>
  <name>Chris Olds</name>
  <affiliation>Wall Data</affiliation>
 </member>
<member>
 <name>Shriram Revankar</name>
 <affiliation>Xerox</affiliation>
</member>
<member>
 <name>Mark Reinhold</name>
 <affiliation>Sun Microsystems</affiliation>
</member>
<member>
 <name>John C. Schneider</name>
 <affiliation>MITRE</affiliation>
</member>
 <member>
  <name>William Shea</name>
  <affiliation>Merrill Lynch</affiliation>
 </member>
 <member>
  <name>Ralph Swick</name>
  <affiliation>W3C</affiliation>
 </member>
 <member>
  <name>Tony Stewart</name>
  <affiliation>Rivcom</affiliation>
 </member>
<member>
 <name>Steph Tryphonas</name>
 <affiliation>Microstar</affiliation>
</member>
 </orglist>
</div1>
 <div1 id="changes">
  <head>Description of changes (non-normative)</head>
  <p>This section gives brief summaries of the substantive changes to this
specification since <loc href="http://www.w3.org/TR/2000/WD-xmlschema-1-20000407/">the public working draft of 7 April 2000</loc>.</p>
  <div2>
   <head>Equivalence classes renamed</head>
   <p>Equivalence classes have been renamed substitution groups, to reflect the
fact that their semantics is not symmetrical.</p>
  </div2>
  <div2>
   <head>Content model of <code>complexType</code> element changed</head>
   <p>The content model of the <eltref ref="complexType"/> element has been
significantly changed, allowing for tighter content models and a better fit
between the abstract component and its XML Representation.  The side conditions
on well-formed representations not captured in the schema for schemas have
accordingly been downsized.  No changes to the abstract complex type definition
component were involved.</p>
  </div2>
  <div2>
   <head>Declaring empty and mixed content models</head>
   <p>Part of the change to the <eltref ref="complexType"/> element described
immediately above involved eliminating its <code>content</code> attribute. 
Empty content models are now signalled by an explicit empty content
particle (see <specref ref="declare-contentModel"/>), mixed content by specifying the value <code>true</code> for the <code>mixed</code> attribute on <eltref ref="complexType"/> or <eltref ref="complexContent"/>.</p>
  </div2>
  <div2>
   <head>Simple type definitions changed</head>
   <p>Both the abstract component and the XML representation for simple type
definitions have been changed, the former to handle list type
definitions more cleanly and to support union type definitions, the latter to
give tighter content models and a better fit
between the abstract component and its XML Representation.</p>
  </div2>
  <div2>
   <head>Simple value normalization</head>
   <p>All values governed by simple type definitions are now subject to
normalization, as in XML 1.0 attribute value normalization.</p>
  </div2>
  <div2>
   <head>Schema component redefinition</head>
   <p>A new form of schema composition operation, similar to that provided by
<eltref ref="include"/> but allowing constrained
redefinition of the included components has been added, using a <eltref ref="redefine"/> element.</p>
  </div2>
  <div2>
   <head>Element and attribute reference restricted</head>
   <p>The ability to override properties of global element declarations when
referencing them from complex type definitions has been removed.  As a
consequence of this attribute declarations no longer have max- and minOccurs properties.</p>
  </div2>
  <div2>
   <head>Default values for <code>minOccurs</code> and <code>maxOccurs</code>
attributes</head>
   <p>The defaulting for these attributes of <eltref ref="element"/> has been simplified:  it is now
<code>1</code> in both cases, with no interdependencies.</p>
  </div2>
  <div2>
   <head>Content model for Model Group definition</head>
   <p>The content model for the <eltref ref="group"/> element when it occurs at
the top level has been tightened, to allow only a single <eltref ref="all"/>,
<eltref ref="choice"/>, <eltref ref="group"/> or <eltref ref="sequence"/> child.</p>
  </div2>
  <div2>
   <head>XML Schema namespace URI</head>
   <p>In recognition of the above changes, the namespace URI for XML Schema ahs
been changed to <code>http://www.w3.org/2000/10/XMLSchema</code>.  There has been no change to the
XML Schema instance namespace URI, which remains <code>http://www.w3.org/2000/10/XMLSchema-instance</code>.</p>
  </div2>
  <div2>
   <head>Error codes</head>
   <p>A standard format for identifying validation failures and schema form
errors is now provided, and a &PSVI; property specified
which processors may, but need not, use to record validation failure codes.</p>
  </div2>
  <div2>
   <head>DTD non-normative</head>
   <p>To avoid potential confusion the DTD for schemas is no longer normative,
but its use is still encouraged.</p>
  </div2>
  <div2>
   <head>Abstract types in element declarations</head>
   <p>These had inadvertently been disallowed:  they are now allowed, since
the use of either substitution groups or <code>xsi:type</code> may derive a
non-abstract type in all actual occurrences.</p>
  </div2>
  <div2 id="sci">
   <head>Schema components as info items (optional)</head>
   <p>Processors may, but need not, provide detailed information in the
form of
  &PSVI; contributions of information items
corresponding to element declaration and type definition components.  They may
also do the same for schema components in general.</p>
  </div2>
  <div2>
   <head>Validation outcomes</head>
   <p>The determination of the values of the &PSVI;
properties relating to validation has been reworked.</p>
  </div2>
  <div2>
   <head>Ur-types</head>
   <p>The structure and nature of the ur-type has been clarified, with names
provided for both its complex and simple forms.  Approximations to definitions
at both the component and XML representation layer are now provided.  The
status of lists and unions wrt the type hierarchy has been regularised.</p>
  </div2>
  <div2>
   <head>Type-related validation properties</head>
   <p>In the &PSVI;, element and attribute items now
always have type information, even when validation is lax.  In this case the type
information given is the simple or complex ur-type, as appropriate.</p>
  </div2>
  <div2>
   <head>Facilitate online schema validation</head>
   <p>The first <code>xsi:schemaLocation</code> for a namespace must not be preceded by any
names from that namespace; otherwise it is an error.</p>
  </div2>
  <div2>
   <head>Complex type definitions by extension</head>
   <p>Complex type definitions which extended other complex type definitions whose base type
definition is simple had inadvertently been disallowed:  this is now allowed.</p>
  </div2>
 </div1>
</back>
</spec>
