<?xml version='1.0'?>
<!-- Id: structures.xml,v 1.6.2.55 2005/02/22 07:20:49 cmsmcq Exp  -->
<?xml-stylesheet type='text/xsl' href='xmlschema_diffs.xsl'?>
<!DOCTYPE spec SYSTEM "local.dtd" [
   <!ENTITY suffix "">

<!--* must, formerly 'should' *-->
<!ENTITY must.x.s 
  '<phrase diff="del" dg="fpwd">should</phrase><phrase diff="add" dg="fpwd">&must;</phrase>'>
<!--* is, formerly 'must' *-->
<!ENTITY is.xm 
  '<phrase diff="del" dg="modals">&must; be</phrase><phrase diff="add" dg="modals">is</phrase>'>
<!--* are, formerly 'must' *-->
<!ENTITY are.xm 
  '<phrase diff="del" dg="modals">&must; be</phrase><phrase diff="add" dg="modals">are</phrase>'>
<!--* is not, formerly 'must not be' *-->
<!ENTITY isnot.xmnb 
  '<phrase diff="del" dg="modals">&mustnot; be</phrase><phrase diff="add" dg="modals">is not</phrase>'>
<!ENTITY has.xmh '<phrase diff="del" dg="modals">&must; have</phrase><phrase diff="add" dg="modals">has</phrase>'>
<!ENTITY doesnot.xmn '<phrase diff="del" dg="modals">&mustnot;</phrase><phrase diff="add" dg="modals">does not</phrase>'>
<!ENTITY can.xm '<phrase diff="del" dg="may">may</phrase><phrase diff="add" dg="may">can</phrase>'>
<!ENTITY will.xm '<phrase diff="del" dg="may">may</phrase><phrase diff="add" dg="may">will</phrase>'>
<!ENTITY may.xm '<phrase diff="del" dg="may">may</phrase><phrase diff="add" dg="may">&may;</phrase>'>
<!ENTITY should.xs '<phrase diff="del" dg="modals">should</phrase><phrase diff="add" dg="modals">&should;</phrase>'>

<!ENTITY non-absent '<phrase diff="del" dg="modals">non-<termref
def="key-null">absent</termref></phrase><phrase diff="add"
dg="modals"><termref def="key-null">non-absent</termref></phrase>
'>
<!ENTITY prime  "&#x2032;" ><!--/prime =prime or minute-->
<!ENTITY Prime  "&#x2033;" ><!--=double prime or second-->
<!ENTITY lsquo  "&#x2018;" ><!--=single quotation mark, left-->
<!ENTITY rsquo  "&#x2019;" ><!--=single quotation mark, right-->
<!ENTITY ldquo  "&#x201C;" ><!--=double quotation mark, left-->
<!ENTITY rdquo  "&#x201D;" ><!--=double quotation mark, right-->
<!ENTITY rarr   "&#x2192;" ><!--/rightarrow /to A: =rightward arrow-->
]>
<spec xml:lang="en" w3c-doctype="wd" status="final">
 <header>
  <title>XML Schema 1.1 Part 1: Structures</title>
  <w3c-designation>wd-20050224</w3c-designation>
  <w3c-doctype>W3C Working Draft</w3c-doctype>
  <pubdate>
   <day>24</day>
   <month>February</month>
   <year>2005</year><!--  Id: structures.xml,v 1.6.2.55 2005/02/22 07:20:49 cmsmcq Exp  -->
  </pubdate>
  <publoc> 
   <loc href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/">http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/</loc> 
  </publoc>
  <altlocs><loc href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.diff-1.0.xml">XML</loc>
<!--*
   <loc href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.diff-1.0.diff-1.0.html">XHTML with changes since version 1.0 marked</loc>
   <loc href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.diff-1.0.diff-wd.html">XHTML with changes since previous Working Draft marked</loc>
*-->
   <loc href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.diff-1.0.html">XHTML with changes since version 1.0 marked</loc>
   <loc href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.diff-wd.html">XHTML with changes since previous Working Draft marked</loc>
   <loc href="http://www.w3.org/2001/XMLSchema.xsd">Independent copy of the schema for schema
    documents</loc>
   <loc href="http://www.w3.org/2001/XMLSchema.dtd">Independent copy of the DTD for schema documents</loc>
   <loc href="compDefs.xml">Independent tabulation of components and microcomponents</loc>
   <loc href="http://www.w3.org/2003/03/Translations/byTechnology?technology=xmlschema"
    >List of translations</loc>
  </altlocs>
  <latestloc>
   <loc href="http://www.w3.org/TR/xmlschema11-1/">http://www.w3.org/TR/xmlschema11-1/</loc>
  </latestloc>
  <prevlocs>
   <loc href="http://www.w3.org/TR/2004/WD-xmlschema11-1-20040716/">http://www.w3.org/TR/2004/WD-xmlschema11-1-20040716/</loc>
  </prevlocs>
  <authlist>
   <author>
    <name>Henry S. Thompson</name>
    <affiliation>University of Edinburgh</affiliation>
    <email diff="chg" href="mailto:ht@inf.ed.ac.uk">ht@inf.ed.ac.uk</email>
   </author>
   <author diff="add">
    <name>C. M. Sperberg-McQueen</name>
    <affiliation>World Wide Web Consortium</affiliation>
    <email href="mailto:cmsmcq@w3.org">cmsmcq@w3.org</email>
   </author>
   <author role="1.0">
    <name>Noah Mendelsohn</name>
    <affiliation>IBM</affiliation>
    <email href="mailto:noah_mendelsohn@us.ibm.com">noah_mendelsohn@us.ibm.com</email>
   </author>
   <author role="1.0">
    <name>David Beech</name>
    <affiliation>Oracle Corporation (retired)</affiliation>
    <email href="mailto:davidbeech@earthlink.net">davidbeech@earthlink.net</email>
   </author>
   <author role="1.0">
    <name>Murray Maloney</name>
    <affiliation>Muzmo Communications</affiliation>
    <email href="mailto:murray@muzmo.com">murray@muzmo.com</email>
   </author>
  </authlist>

<status>
<p><emph>This section describes the status of this document at the
time of its publication. Other documents may supersede this document.
A list of current W3C publications and the latest revision of this
technical report can be found in the <loc href="http://www.w3.org/TR/">W3C technical reports index</loc> at
http://www.w3.org/TR/.</emph></p>
<p>This is a [member-only review version which will soon become a]
Public Working Draft of XML Schema 1.1.  It is here made
available for review by W3C members and the public.  It is intended to
give an indication of the W3C XML Schema Working Group's intentions
for this new version of the XML Schema language and our progress in
achieving them.  It attempts to be complete in indicating
<emph>what</emph> will change from version 1.0, but does
<emph>not</emph> specify in all cases <emph>how</emph> things will
change.</p>
<p>For those primarily interested in the changes since version 1.0,
the <specref ref="changes"/> appendix, which summarizes
both changes already made and also those in prospect, with links to
the relevant sections of this draft, is the recommended starting
point.  Accompanying versions of this document display in color
all changes to normative text since version 1.0 and since the
previous Working Draft.</p>
<p>This draft was published on 24&#x20;February&#x20;2005.
The major changes are:</p>
<ulist>
<item>
<p>The rules for checking validity of complex-type restrictions
have been simplified by reformulating the constraint in terms
of local validity.</p>
</item>
<item>
<p>The treatment of the base of the type hierarchy has been
regularized; <pt>anyType</pt> (the default type for elements) is now
distinguished from the root of the type hierarchy (now called
<pt>rootType</pt>, and the default base type for complex-type
restrictions); this distinction enables some rules to be simplified
by eliminating special cases for <pt>anyType</pt>.</p>
</item>
<item>
<p>
Ways in which conforming XML Schema-aware processors are permitted to
vary are now tabulated in an appendix, and terminology is provided
to describe various choices open to implementors.</p>
</item>
<item>
<p>A number of editorial changes have been made in the interests
of clarity.</p>
</item>
</ulist>
<p>
The Working Group does not currently have consensus on the details 
of all of these changes; text which does not currently command
the consensus of the Working Group is marked in this document with special
delimiter characters and displayed 
with a <phrase diff="add" dg="nsq">tinted background</phrase>.
The Working Group has special interest in feedback on the text thus marked;
some of it is merely unpolished, while other parts of it
are actively controversial within the Working Group.
</p>
<p>Please send comments on this Working Draft 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/">archive</loc>).</p>
<p>Publication as a Working Draft does not imply endorsement by the
W3C Membership. This is a draft document and may be updated, replaced
or obsoleted by other documents at any time. It is inappropriate to
cite this document as other than work in progress.</p>

<p>
This document has been produced by the 
<loc href="http://www.w3.org/XML/Schema">W3C XML Schema Working Group</loc>
as part of the W3C <loc href="http://www.w3.org/XML/Activity">XML
Activity</loc>. The goals of the XML Schema language version 1.1 are
discussed in the <loc href="http://www.w3.org/TR/2003/WD-xmlschema-11-req-20030121/">Requirements 
for XML Schema 1.1</loc> document. The authors of this document are
the members of the XML Schema Working Group.  Different parts of this
specification have different editors.
</p>
<p>Patent disclosures relevant to this specification may
be found on the Working Group's <loc role="disclosure" href="http://www.w3.org/2004/01/pp-impl/19482/status">Patent
disclosure page</loc> in conformance with the <loc href="http://www.w3.org/Consortium/Patent-Policy-20040205/">W3C Patent
Policy</loc> of 5 February 2004.  An individual who has actual
knowledge of a patent which the individual believes contains Essential
Claim(s) with respect to this specification should disclose the
information in accordance with <loc href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 
6 of the W3C Patent Policy</loc>.</p>
      
<!--* <p>In accordance with 
<loc href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Exclusion">section 
4 of the W3C Patent Policy</loc>, Working Group participants have 150
days from the title page date of this document to exclude essential
claims from the W3C RF licensing requirements with respect to this
document series. Exclusions are with respect to the exclusion
reference document, defined by the <loc href="http://www.w3.org/Consortium/Patent-Policy-20040205/">W3C Patent
Policy</loc> to be the latest version of a document in this series
that is published no later than 90 days after the title page date of
this document.</p> *-->

<p>The English version of this specification is the only normative
version. Information about translations of this document is available
at <loc href="http://www.w3.org/2003/03/Translations/byTechnology?technology=xmlschema"
>http://www.w3.org/2003/03/Translations/byTechnology?technology=xmlschema</loc>.</p>

</status>

  <abstract id="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<phrase diff="del" dg="fpwd"> 1.0</phrase> documents, including those which exploit the XML
    Namespace facility. The schema language, which is itself represented in XML<phrase diff="del" dg="fpwd">
     1.0</phrase> and uses namespaces, substantially reconstructs and considerably extends the capabilities found in XML<phrase diff="del" dg="fpwd"> 1.0</phrase> document type
    definitions (DTDs).  This specification depends on <emph>XML Schema<phrase diff="add" dg="fpwd">
      1.1</phrase> Part 2:
     Datatypes</emph>.          
    <issue id="RQ-152i" role="1.1">
     <p><loc href="&reqs;#xml1.1" target="reqs">RQ-152 (xml1.1)</loc></p>
     <p>How should this specification be aligned with XML 1.1?  The changes in
      character set and name characters, and the question of what determines which
      ones to use, must be addressed.</p>
    </issue>
   </p>
  </abstract>
  <pubstmt>
   <p>Edinburgh, et al.: World-Wide Web Consortium, XML
    Working Group, 2004.</p>
  </pubstmt>
  <sourcedesc>
   <p>Created in electronic form using XML, starting from <loc href="http://www.w3.org/XML/Group/2003/09/xmlschema-1/structures.xml">[internal draft
     of] XML Schema Part 1: Structures, Second Edition</loc>.</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>For changes, see CVS change log at the end of the document.
For marked diff groups, see the following items.</sitem>
<sitem id="fpwd">Changes made (and with very few exceptions 
marked as such) in the first public working draft of July 2004.
Mostly approved 2005-02-18.  (What wasn't approved is now 
tagged ep01.)</sitem>
<sitem id="m01">Minor typos and corrections made by MSM; these
will be batched together and handled in an editorial change 
proposal.  Approved as part of EP-06, 2005-02-18.</sitem>
<sitem id="imp">Changes to the section on import (mostly &mdash; 
some go beyond import to the rest of the section), based on
NM's proposal in Brisbane.  Approved as EP-07, 2005-02-18.</sitem>
<sitem id="rq17">Non-status-quo draft changes to implement
Brisbane partial consensus wrt RQ-17.
Discussed 2005-02-18, into WD as non-status-quo text.
</sitem>
<sitem id="rq17a">Additional changes to fix links broken by rq17.
Not discussed 2005-02-18, but into WD anyway as non-status-quo text
(because otherwise links are broken).
</sitem>
<sitem id="rq17aux">Auxiliary diff group for RQ-17.  Has no independent
value; its sole purpose is to make the output valid when diff group
rq17 and rq17a are not adopted.  Display as 'pre' iff rq17 is pre,
otherwise display as 'post'.
Added 2005-02-19.  Needs no discussion or approval; it's just
an artifact of our diff system.
</sitem>
<sitem id="rq144">Draft rough wording (not status quo) for RQ-144.
Discussed 2005-02-18, into WD as non-status-quo text.
</sitem>
<sitem id="rq144a">Fixes to broken links caused by diff group rq144.
Not discussed 2005-02-18, not sure what to do.
</sitem>
<sitem id="rq144aux">Auxiliary diff group for RQ-144. Has no
independent value; its sole purpose is to make the output document valid
with or without rq144.  Display as 'pre' iff rq144 is pre;
otherwise display as 'post'.
Added 2005-02-19.  Does not need WG discussion or approval; it's
just a mechanism for controlling the diff and the markup.
</sitem>
<sitem id="modals">An editorial proposal prepared by MSM.
Eliminate nested modals, to avoid entailing modal logic.
Check all occurrences of 'must', 'may', and 'should', eliminate
where not aligned with RFC 2119.  (Not entirely successful; I
eliminated almost all non-2119 occcurrences of 'may', but not of
'should'.)
Partly approved 2005-02-18 as EP-08, partly postponed.  Postponed bits
('may') retagged as diff group 'may'.
</sitem>
<sitem id="may">Originally part of "modals".  Split off 2005-02-18
after HT and MSM were unable to agree on specific cases; to be taken
up again later.
</sitem>
<sitem id="ep06a">Proposed amendments to EP-06 (2005-02).
Approved 2005-02-18.</sitem>
<sitem id="ep08a">Proposed amendments to EP-08 (2005-02).
Approved 2005-02-18.</sitem>
<sitem id="ep01">Diff group for changes related to micro-components 
(were originally tagged fpwd).  Split off from fpwd 2005-02-18.</sitem>
<sitem id="dgaat">Diff group for changes related to anyAtomicType
(were originally tagged fpwd).  Approved 2005-02-18.</sitem>
<sitem id="wd2">Other last-minute fixes for WD 2 (2005-02).</sitem>
<sitem id="wd2.silent">Changes which we record for the sake of
the audit trail but which are not to be shown colored in WD 2 (2005-02).</sitem>
<sitem id="nsq">Dummy diff group for sample non-status-quo text.</sitem>
<sitem id="abandoned">Change markup which we decided against, but
which for whatever reason (sentimentality, or a suspicion that
we might change our minds back, or just a hope we will) we do
not wish to delete. Yet.</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, the representation of each 
component in XML, 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 4 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 5 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> primarily designed
to serve as a motivating introduction to the design and its features, or as a
tutorial for new users.
Rather it presents 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="intro1.1" diff="add" dg="fpwd">
   <head>Introduction to Version 1.1</head>
     <p>The Working Group has two main goals for this version of W3C XML Schema:</p>
     <ulist>
<item><p>Significant improvements in simplicity of design and clarity of
   exposition <emph>without</emph> loss of backward <emph>or</emph> forward compatibility;

 </p></item>
<item><p>Provision of support for versioning of XML languages defined using
   the XML Schema specification, including the XML transfer syntax for
   schemas itself.</p></item>
</ulist>
<p>These goals are <phrase diff="del" dg="ep06a">slightly</phrase> 
in tension with one another<phrase diff="del" dg="ep06a"> &mdash; the following
summarizes the</phrase><phrase diff="add" dg="ep06a">The</phrase> 
Working Group's strategic guidelines for changes
between versions 1.0 and 1.1<phrase diff="add" dg="ep06a"> can be summarized
as follows</phrase>:</p>
<olist>
<item><p><phrase diff="del" dg="ep06a">Add support</phrase><phrase diff="add" dg="ep06a">Support</phrase> for versioning (acknowledging
that this <emph>may</emph> be slightly disruptive to the XML transfer
syntax at the margins)</p></item>
<item><p><phrase diff="del" dg="ep06a">Allow b</phrase><phrase diff="add" dg="ep06a">B</phrase>ug fixes (unless in specific cases we
decide that the fix is too disruptive for a point release)</p></item>
<item><p><phrase diff="del" dg="ep06a">Allow e</phrase><phrase diff="add" dg="ep06a">E</phrase>ditorial changes</p></item>
<item><p><phrase diff="del" dg="ep06a">Allow d</phrase><phrase diff="add" dg="ep06a">D</phrase>esign cleanup <phrase diff="del" dg="ep06a">to</phrase><phrase diff="add" dg="ep06a">will possibly</phrase>
change behavior in edge cases</p></item>
<item><p><phrase diff="del" dg="ep06a">Allow relatively
n</phrase><phrase diff="add" dg="ep06a">N</phrase>on-disruptive changes
to type hierarchy (to better support current and forthcoming
international standards and W3C recommendations)</p></item>
<item><p><phrase diff="del" dg="ep06a">Allow d</phrase><phrase diff="add" dg="ep06a">D</phrase>esign cleanup <phrase diff="del" dg="ep06a">to</phrase><phrase diff="add" dg="ep06a">will possibly</phrase>
change component structure (changes to functionality restricted to
edge cases)</p></item>
<item><p><phrase diff="del" dg="ep06a">Do not allow any</phrase><phrase diff="add" dg="ep06a">No</phrase> significant changes in
functionality</p></item>
<item><p><phrase diff="del" dg="ep06a">Do not allow any</phrase><phrase diff="add" dg="ep06a">No</phrase> changes to XML transfer syntax except
those required by version control hooks and bug fixes</p></item>
</olist>
<p>The <phrase diff="del" dg="ep06a">overall aim as
regards</phrase><phrase diff="add" dg="ep06a">aim with regard
to</phrase> compatibility is that</p>

<ulist>
<item><p>All schema documents conformant to version 1.0 of this
    specification should also conform to version 1.1, and should have
    the same validation behaviour across 1.0 and 1.1 implementations
    (except possibly in edge cases and in the details of the resulting
    PSVI);</p></item>
<item><p>The vast majority of schema documents conformant to version 1.1 of
    this specification should also conform to version 1.0, leaving
    aside any incompatibilities arising from support for versioning,
    and when they are conformant to version 1.0 (or are made
    conformant by the removal of versioning information), should have
    the same validation behaviour across 1.0 and 1.1 implementations
    (again except possibly in edge cases and in the details of the
    resulting PSVI);
 </p></item>
</ulist>
    </div2>
      <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 &can.xm; 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 &will.xm; require constraint capabilities not
        expressible in this language, and so &will.xm; need to perform their own additional
        validations.</p>
    </div2>
    <div2 id="intro-relatedWork">
      <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"/>.</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 section introduces the highlighting and typography as used in
          this document to present technical material.</p>
     <p diff="add" dg="fpwd">Aspects of this document which the Working Group are committed to
changing, but where (all) changes are not yet in place, are signalled by the
appearance of an Issue, with a link to the associated version 1.1 Requirement,
for example:</p>
     <issue id="xmpl" role="example">
      <p><loc href="&reqs;">RQ-nnn</loc></p>
     </issue>
     <p diff="add" dg="fpwd">All such issues are 
      <phrase diff="del" dg="wd2.silent">tabluated</phrase><phrase diff="add" dg="wd2.silent">tabulated</phrase> 
      in <specref ref="issues"/><phrase diff="add" dg="wd2.silent">.</phrase></p>
        <p>Special terms are defined at their point of
introduction in the text.  For example <termdef id="key-sampledef" term="term" role="local">a <term>term</term> is
          something used with a special meaning</termdef>.  The definition is
labeled as such and the term it defines is displayed in boldface.  The end of the definition is not specially marked
in the displayed or printed text.  Uses of defined terms are links to
their definitions, set off with middle dots, for instance <termref def="key-sampledef">term</termref>.</p>
          <p>Non-normative examples are set off in boxes 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>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>
        <!--* !!! not sure whether it's sensible or feasible to mark this 
            * as deletion and insertion.  It changed in first WD (vis a vis
            * 1.0 2E), but I'll leave it for now. *-->
        <compdef name="Example" abbrev="ex">
         <property arity="singleton" name="example property" required="true" type="Component" valueType="component">
          <description>
           <p>An example property</p>
          </description>
         </property>
        </compdef>
     <p>References to properties of schema components are links to
the relevant definition as exemplified above, set off with curly braces, for instance <propref comp="ex" prop="example property"/>.</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. This is followed by a tabulation of the
correspondence between properties of the component and properties of
the information item.  Where context <phrase diff="del" dg="may">may determine</phrase><phrase diff="add" dg="may">determines</phrase> which of several different components
<phrase diff="del" dg="may">may arise</phrase><phrase diff="add" dg="may">corresponds to the source declaration</phrase>, several
tabulations, one per context, are given.  The property correspondences
are normative, as are the illustrations of the XML representation
element information items.
</p>
     <p>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.  Where an attribute information item has a built-in simple
type definition defined in <bibref ref="ref-xsp2"/>, a hyperlink to its
definition therein is given.</p>
     <p>The allowed content of the information item is
shown as a grammar fragment, using the Kleene operators <code>?</code>,
<code>*</code> and <code>+</code>.  Each element name therein is a hyperlink to
its own illustration.</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 comp="ex" prop="example property">Description of what the property corresponds to, e.g. the value of the <code>size</code>
&i-attribute;
</propmap>
</reprcomp>
 </reprdef>
     <p>References to elements in the text are links to
the relevant illustration as exemplified above, set off with angle brackets, for instance <eltref ref="example"/>.</p>
     <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>Properties which this specification defines for information items are
introduced as follows:</p>
     <proplist item="example" role="psvi">
      <propdef id="ex-foo" name="new property">The value the property gets.</propdef>
     </proplist>
<p>References to properties of information items defined in this specification
are notated as links to their introduction as exemplified above, set off with square brackets, for example <propref role="psvi" ref="ex-foo"/>.</p>
      <p>The following highlighting is used for non-normative commentary in
        this document:</p>


      <note>
        <p>General comments directed to all readers. </p>
      </note>
     <p><phrase diff="del" dg="ep06a">Following 
<bibref ref="ref-xml" diff="del" dg="fpwd"/><bibref ref="rfc-2119" diff="add" dg="fpwd"/>, 
w</phrase><phrase diff="add" dg="ep06a">W</phrase>ithin normative prose 
in this specification, the words &may;<phrase diff="del" dg="fpwd"> and</phrase><phrase diff="add" dg="ep06a">, &should;</phrase><phrase diff="add" dg="fpwd">,</phrase> &must;<phrase diff="add" dg="fpwd"> and &mustnot;</phrase> 
are defined as follows:</p>
     <glist>
      <gitem>
       <label>&may;</label>
       <def>
        <p>Conforming documents and XML Schema-aware processors are permitted to but need not behave as described.</p>
       </def>
<!--*
5. MAY   This word, or the adjective "OPTIONAL", mean that an item is
   truly optional.  One vendor may choose to include the item because a
   particular marketplace requires it or because the vendor feels that
   it enhances the product while another vendor may omit the same item.
   An implementation which does not include a particular option MUST be
   prepared to interoperate with another implementation which does
   include the option, though perhaps with reduced functionality. In the
   same vein an implementation which does include a particular option
   MUST be prepared to interoperate with another implementation which
   does not include the option (except, of course, for the feature the
   option provides.)
*-->
      </gitem>
      <gitem diff="add" dg="ep06a">
       <label>&should;</label>
       <def>
        <p>It is recommended that conforming documents and 
XML Schema-aware processors behave as described, but there can
be valid reasons for them not to; it is important that the 
full implications be understood and carefully weighed before
adopting behavior at variance with the recommendation.</p>
       </def>
<!--*
3. SHOULD   This word, or the adjective "RECOMMENDED", mean that there
   may exist valid reasons in particular circumstances to ignore a
   particular item, but the full implications must be understood and
   carefully weighed before choosing a different course.
*-->
<!--*
4. SHOULD NOT   This phrase, or the phrase "NOT RECOMMENDED" mean that
   there may exist valid reasons in particular circumstances when the
   particular behavior is acceptable or even useful, but the full
   implications should be understood and the case carefully weighed
   before implementing any behavior described with this label.
*-->
      </gitem>
      <gitem>
       <label>&must;</label>
       <def>
        <p>Conforming documents and XML Schema-aware processors are required to behave as described; otherwise they are in error.</p>
       </def>
<!--*
1. MUST   This word, or the terms "REQUIRED" or "SHALL", mean that the
   definition is an absolute requirement of the specification.
*-->
      </gitem>
      <gitem diff="add" dg="fpwd">
       <label>&mustnot;</label>
       <def>
        <p diff="add" dg="fpwd">Conforming documents and XML Schema-aware processors are forbidden
to behave as described; if they do they are in error.</p>
       </def>
<!--*
2. MUST NOT   This phrase, or the phrase "SHALL NOT", mean that the
   definition is an absolute prohibition of the specification.
*-->
      </gitem>


     </glist>
<p diff="add" dg="ep06a">These definitions describe in
terms specific to this document the meanings assigned to
these terms by <bibref ref="rfc-2119"/>.
The specific wording follows that of
<bibref ref="ref-xml"/>.
</p>
     <p><phrase diff="del" dg="fpwd">Note however that
this</phrase><phrase diff="add" dg="fpwd">This</phrase> specification
provides a definition of error and of conformant processors'
responsibilities with respect to errors <phrase diff="del" dg="fpwd">(see</phrase><phrase diff="add" dg="fpwd">in</phrase>
<specref ref="conformance"/><phrase diff="del" dg="fpwd">) which is
considerably more complex than that of <bibref ref="ref-xml"/></phrase>.</p>

    </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, including a normative representation in XML for the
components of the model. Readers interested primarily in learning to
write schema documents &will.xm; wish to first read <bibref ref="bib-expo"/> for a tutorial introduction, and
only then consult the sub-sections of 
<specref ref="components"/> named <emph>XML Representation of
...</emph> for the details.</p>
   <div2>
    <head>Overview of XML Schema</head>
    <p>An XML Schema
<phrase diff="del" dg="rq144">consists</phrase><phrase diff="add" dg="rq144">is
a set</phrase>
of components such as type definitions and element declarations.  
These can be used to assess the validity of well-formed element and 
attribute information items (as defined
in <bibref ref="ref-xmlinfo"/>), and furthermore
&may.xm; specify augmentations to those items and their descendants.  
This augmentation makes explicit information <phrase diff="del" dg="may">which may have
been</phrase> 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.
<phrase diff="add" dg="rq144">The input information set can
also be augmented with information about the validity of
the item, or about other properties described in this specification.</phrase>
<termdef term="post-schema-validation infoset" id="key-psvi">We refer to the
augmented infoset which results from conformant processing as defined
in this specification as the <term>post-schema-validation
infoset</term>, or PSVI</termdef>.
<phrase diff="add" dg="rq144">Conforming
processors &may; provide access to different parts of the
PSVI, as described in <specref ref="var_psvi"/>. The
mechanisms by which processors provide access to the PSVI
are neither defined nor constrained by this specification.</phrase></p>

    <note diff="add" dg="rq144a">
     <p>In this version of this specification, PSVI properties are
      typically introduced with wording which suggests that they 
      &must; be supplied by conforming processors; this will be
      changed in future revisions.
     </p>
    </note>

	<issue id="RQ-142i" role="1.1">
	  <p><loc href="&reqs;#PSVIProp" target="reqs">RQ-142 (PSVIProp)</loc>,
   <loc href="&reqs;#WhichPSVIPropertiesReqd" target="reqs">RQ-144 (WhichPSVIPropertiesReqd)</loc></p>
  <p>Version 1.0 included several properties in the PSVI whose absence carried
information (e.g. <propref role="psvi" ref="e-type_definition"/>), while at the
same time not being completely clear about which PSVI properties, if any, were
required.  The Working Group intends to eliminate the former and clarify the latter.</p>
  <resolution>
   <p>For 142, which mandates that insofar as possible absence of a property
should not in general signify, when it does explicit 'if-and-only-if' langauge
is required, the effect is distributed throughout the PSVI sub-sub-sections in
section 3.</p>
   <p>MSM proposed the following summary of our views; we appear to be close
to consensus, though perhaps not quite ready to make a final decision:
<olist>
 <item>
<p>We should eliminate any dependency on the absence of specific
    properties (i.e. important situations should be describable
    and distinguishable in terms of properties and their values,
    without appeal to the absence of particular properties), or if
    this proves unfeasible in particular cases we should say 
    explicitly that a property is present "if and only if" certain
    conditions apply.  Any remaining "if" (if any) would be a
    true conditional, not an equivalence.</p>
 </item>
 <item>
<p>Any specification of a class of processors (including ours) can
    require specific additional information not in the PSVI, though
    should note that interoperability is better if applications depend
    only on the properties present in the PSVI as we define it.</p>
 </item>
 <item>
<p>In our own specification of processor classes, we should be
    explicit that processors may provide additional information.
    (Or alternatively be explicit that they must not -- but the
    chair believes the WG consensus was to allow it.)</p>
 </item>
</olist> 
</p>
   <p>For 144, a few general remarks here about flexible-but-firm conformance
are wanted here, most of the new work should end up in section 4 and/or 5.</p>
  </resolution>
	  </issue>
    <p>Schema-validity assessment has two aspects:
<olist><item id="c-lsv"><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>Synthesizing 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
<clauseref ref="c-lsv"/> above, the determination of local
schema-validity</termdef>.</p>
<p>Throughout this specification, <termdef id="key-va" term="assessment"> the word <term>assessment</term> is used to refer
to the overall 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/xml-infoset/#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 <termref def="key-schemaDoc">schema documents</termref>.</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 XML interchange format for schemas is provided.</p>
    <issue id="CC" role="1.1">
     <p><loc href="http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2003Jun/0090.html">2003-06-13 minutes (Component cleanup)</loc> (W3C-member-only link)</p>
     <p>Some aspects of the abstract components used to organise this
specification have proved clumsy and/or susceptible to improvement.  The way in
which components and their properties are referenced in constraints and
validation rules is sometimes irritatingly verbose.  Wherever possible these
problems should be addressed.</p>
     <resolution>
      <p>Changes to the component structure which do not produce
    substantially different functionality (i.e. change behavior only in
    edge cases) [are consistent with our overall goals].  Such changes might be made in order to make the
    component structure easier to understand, reason about, document,
    or talk about.  This class is not, however, restricted to changes
    which do not affect the information-theoretic information content
    of the component structure.  That is, it may contain changes
    that go beyond renaming or other changes which do not affect
    information content.</p>
      <p>These changes will be disruptive to (some) implementors, but (MSM
    suggested) not to all users, and probably not to any (or: many)
    users.</p>
      <p>The editor intends under this heading to make the presentation of
components much more systematic, because auto-generated from an XML-notated
explicit definition of components and properties, for example:</p>
      <p><![CDATA[<component name="Attribute Declaration" base="Component"
           abstract="false" abbrev="ad">
  <property name="type definition" valueType="component" arity="singleton"
            type="Simple Type Definition" required="true"/>
  . . .]]></p>
      <p>The editor also intends to introduce a number of 'micro-components',
replacing all values with complicated value types, e.g. replacing "A pair consisting of a value and one of <pt>default</pt>, <pt>fixed</pt>." with a
Value Contstraint micro-component.</p>
     </resolution>
    </issue>
<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 components</termref></termdef>.  There are 13 kinds of
component in all, falling into three groups.  The primary components,
which &may;
(type definitions) or &must; (element and attribute declarations) have names,
are as follows:</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, which &must; have names, are as follows:</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:</p>
<ulist>
<item><p>Annotations</p></item>
<item><p>Model groups</p></item>
<item><p>Particles</p></item>
<item><p>Wildcards</p></item>
 <item><p>Attribute Uses</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.xm; <phrase diff="add" dg="modals">and in some cases &must;</phrase>
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 name, also as
defined by <bibref ref="ref-xml-namespaces"/></termdef>.  The <termref def="key-targetNS">target
namespace</termref> 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 name of, for example, the element
information items it &will.xm; <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 XML representation of components, 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 <phrase diff="del" dg="may">may <termref def="key-vn">validate</termref></phrase><phrase diff="add" dg="may">is <termref def="key-vn">validated</termref></phrase> with
respect to an attribute declaration, a list of element information
items <phrase diff="del" dg="may">may <termref def="key-vn">validate</termref></phrase> 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.  The subsections below first 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>
	    <issue id="RQ-120i" role="1.1">
	      <p><loc href="&reqs;#term-&derived;" target="reqs">RQ-120 (term-&derived;)</loc></p>
      <p>There is an inconsistency in the use of the word 'derived' and related
words between parts 1 and 2 of version 1.0:  Sometimes it refers only to types
defined by
restriction and/or extension, but other times includes lists and unions as
well.  This terminological problem, and the underlying conceptual issue, should
be addressed.</p>
      <resolution>
       <p><loc href="http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2004May/0007.html">http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2004May/0007.html</loc>, <loc href="http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2004May/0009.html">http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2004May/0009.html</loc> (W3C-member-only links)</p>
       <p>In anticipation of a change in this area, the editor has replaced all
occurrences of '&derived;' and related words with one of two entity references:
&amp;&derived;; for restriction and extension only, and &amp;constructedDiff; for
restriction, extension, list and union.  The former is defined to be
'derived' for now, the latter a diff-marked replacement of 'derived'
by 'constructed'.</p>
      </resolution>
	      </issue>
<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"><phrase diff="del" dg="rq17">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></phrase>
   <phrase diff="add" dg="rq17">A type defined by appropriate use of facets or
declarations so as to validate a subset of
what another type definition validates, with consistent PSVI outcomes, is a
<term>restriction</term> of the other type</phrase></termdef>.
<phrase diff="del" dg="rq17">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.</phrase></p>
 <!--* <ednote>
  <edtext>What are we doing with these issue pointers? [Tentative answer:
    keep for now, delete when phase-2 wording is accepted. Actually, 
    for now, we should probably say 'there is draft wording here ...'
    But I have not yet done that.]</edtext>
 </ednote> *-->
	    <issue id="RQ-17i" role="1.1">
	      <p><loc href="&reqs;#restrictn-rules" target="reqs">RQ-17 (restrictn-rules)</loc></p>
      <p>Version 1.0 made clear that the <emph>intention</emph>
for derivation by restriction was that restrictions validated a subset of what their
base validated.  However, the constructive rules for what constituted valid content model
restrictions for complex type definition not only failed to enforce this
completely correctly, but also ruled out various cases which evidently should
have been allowed.  The Working Group has decided to shift to a much higher
level statement of what constitutes a valid restriction, appealing directly to
the subset requirement, in order to address these problems.</p>
      <resolution>
       <p>A major change in definition/presentation, with only modest changes
in consequences for schemas and validity, will be made, by
<emph>defining</emph> restriction for complex type definitions in terms of the desired result, that is that
all members of a restricted type are members of its base type.  In the
normative part of the spec. this will be done by appeal to local validity.</p>
       <p>"Clarifying: R restricts B: any EII that is locally valid [per R]
&must; also be locally valid [per B], with side conditions on properties on terms
you appeal to [to] get same child allowed by two content models."
[<loc href="http://www.w3.org/XML/Group/2004/05/xml-schema-ftf-minutes.html">F2F
2004-03-12, section Subsumption</loc> (W3C-member-only link)]</p>
       <p>A non-normative appendix will provide summarys of and references to two published
algorithms for enforcing the constraint as newly defined.</p>
      </resolution>
	      </issue>
<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 complex
type definition, the <term>ur-type 
definition</term>, whose
name is <phrase diff="del" dg="rq17"><pt>anyType</pt></phrase><phrase diff="add" dg="rq17"><pt>rootType</pt></phrase> in the XML Schema namespace, is present in each <termref def="key-schema">XML Schema</termref>, serving as the root of the type
definition hierarchy for that schema</termdef>.  
</p>
 <p diff="add" dg="rq17"><termdef id="key-anyType" term="definition of anyType">A further 
special complex type definition, whose name is <pt>anyType</pt> in the XML Schema 
namespace, is also present in each <termref def="key-schema">XML Schema</termref>.
The <term>definition of anyType</term> serves as default type
definition for element declarations whose XML representation does not specify 
one</termdef>.  <!--* why is the termdef closed inside the full stop?
                      HST: Because I always do it that way :-) *-->
</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 the values of attributes and the 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 type definitions, this is  <termdef id="key-simpleUrType" term="simple ur-type definition">the <term>simple
ur-type definition</term>, a special restriction of the
<termref def="key-urType">ur-type
definition</termref>, whose name is <local>anySimpleType</local> in the XML Schema namespace</termdef>.   The <termref def="key-simpleUrType">simple ur-type definition</termref> 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 mapping from lexical space to value space is
unspecified for items whose type definition is the
<termref def="key-simpleUrType">simple ur-type definition</termref>. 
Accordingly this specification does not constrain processors' behaviour in
areas where this mapping is implicated, for example checking such items against
enumerations, constructing default attributes or elements whose declared type
definition is the
<termref def="key-simpleUrType">simple ur-type definition</termref>, checking
identity constraints involving such items.</p>
        <note>
         <p>The Working Group expects to return to this area in a future
version of this specification.</p>
        </note>
        <p>Simple types &may.xm;
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.  Such list and union simple type definitions are also restrictions of the <termref def="key-simpleUrType">simple ur-type
definition</termref>.</p>
     <p>For detailed information on simple type definitions, see <specref ref="Simple_Type_Definitions"/> and &XSP2;.  The latter also defines an extensive inventory of
pre-defined simple types.</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.xm;
require the &i-children; to contain neither element nor character
information items (that is, to be empty), <phrase diff="add" dg="modals">or</phrase> to be a string which belongs to a particular
simple type<phrase diff="add" dg="modals">,</phrase> 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 other than the
<termref def="key-urType">ur-type definition</termref> 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>
      
      
</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>
For detailed information on complex type definitions, see <specref ref="Complex_Type_Definitions"/>.</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
top-level 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>
For detailed information on element declarations, see <specref ref="cElement_Declarations"/>.</p>
</div4>
<div4 id="Element_Equivalence_Class">
<head>Element Substitution Group</head>
<p>In XML<phrase diff="del" dg="fpwd"> 1.0</phrase>, 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 top-level element declaration can serve as the defining member, or
head, for an element substitution group.  Other top-level 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 other 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="cElement_Declarations"/>).</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>
For detailed information on attribute declarations, see <specref ref="cAttribute_Declarations"/>.</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>
For detailed information on notation declarations, see <specref ref="cNotation_Declarations"/>.</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.</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>
For detailed information on model groups, see <specref ref="Model_Groups"/>.</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 models</termref> 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 models</termref> to the <termref def="key-vn">validation</termref> of both mixed and element-only content. </p>
</note></p>
     <p>
For detailed information on particles, see <specref ref="cParticles"/>.</p>
</div4>
      <div4 id="Attribute_Use">
       <head>Attribute Use</head>
       <p>An attribute use plays a role similar to that of a particle, but for
attribute declarations:  an attribute declaration within a complex type definition
is embedded within an attribute use, which specifies whether the declaration
requires or merely allows its attribute, and whether it has a default or fixed value.</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 name, independently
of their local names.</p>
     <p>
For detailed information on wildcards, see <specref ref="Wildcards"/>.</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>
For detailed information on &constraint; definitions, see <specref ref="c&Constraint;_Definitions"/>.</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>
For detailed information on model group definitions, see <specref ref="cModel_Group_Definitions"/>.</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>
For detailed information on attribute group definitions, see <specref ref="cAttribute_Group_Definitions"/>.</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>
For detailed information on annotations, see <specref ref="cAnnotations"/>.</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 focused 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>Schema Component Constraint</label>
          <def>
            <p><termdef id="gloss-cos" term="Schema Component Constraint">Constraints on the schema components themselves, i.e.
conditions components &must; satisfy to be components at all.  Located in the
sixth sub-section of the per-component sections of <specref ref="components"/>
and tabulated in <specref ref="outcome-cos"/></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 beyond those which are expressed
in <specref ref="normative-schemaSchema"/>.  Located in the
third sub-section of the per-component sections of <specref ref="components"/>
and tabulated in <specref ref="outcome-src"/></termdef>.</p>
        </def>
       </gitem>
        <gitem>
          <label>Validation Rules</label>
          <def>
            <p><termdef id="gloss-cvc" term="Validation
Rules">Contributions to <termref def="key-vn">validation</termref> associated
with schema components.  Located in the
fourth sub-section of the per-component sections of <specref ref="components"/>
and tabulated in <specref ref="validation_failures"/></termdef>.</p>
          </def>
        </gitem>
       <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>.
Located in the
fifth sub-section of the per-component sections of <specref ref="components"/>
and tabulated in <specref ref="PSVI_contributions"/></termdef>.</p>
          </def>
        </gitem>
      </glist>
        <p>The last of these, schema information set
          contributions, are not as new as they might at first seem.  XML<phrase diff="del" dg="fpwd"> 1.0</phrase>
          validation augments the XML<phrase diff="del" dg="fpwd"> 1.0</phrase> 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<phrase diff="del" dg="fpwd"> 1.0</phrase> <phrase diff="del" dg="fpwd">left</phrase><phrase diff="add" dg="fpwd">leaves</phrase> implicit.</p>

    </div2>

<div2 id="concepts-conformance">
<head>Conformance</head>

<note diff="add" dg="rq144">
<p>The Working Group expects to revise this discussion of conformance in
future.  A sketch of relevant work can be found in <specref ref="impl-def-list"/>
and <specref ref="var_terminology"/>.</p>
</note>

<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">Schema Component
Constraints</termref>, <termref def="gloss-cvc">Validation Rules</termref>,
and <termref def="gloss-sic">Schema Information
Set Contributions</termref> contained in this specification</termdef>.</p>

<p><termdef id="key-interchange" term="schema-document aware"><termref def="key-minimallyConforming">Minimally conforming</termref> 
processors which accept schemas represented in the form of XML documents as 
described in <specref ref="layer2"/> are additionally said to 
<phrase diff="del" dg="rq144">provide <term>conformance to the XML 
Representation of Schemas</term></phrase><phrase diff="add" dg="rq144">be
<term>schema-document aware</term></phrase>.</termdef>
Such processors &must;, when processing schema documents, completely and
correctly implement all <termref def="gloss-src">Schema Representation
Constraints</termref> in this specification, and &must; adhere exactly to the
specifications in <specref ref="components"/> for mapping the contents of
such documents to <termref def="key-component">schema
components</termref> for use in 
<termref def="key-vn">validation</termref> and <termref def="key-va">assessment</termref>.</p>
<p diff="add" dg="rq144"><termdef id="key-XML-unaware" term="non-schema-document-aware">A 
<termref def="key-minimallyConforming">minimally conforming</termref>
processor which is not <termref def="key-interchange"/> is
said to be a <term>non-schema-document-aware</term> processor.</termdef></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 <phrase diff="del" dg="rq144">in 
<termref def="key-interchange">conformance to the 
XML Representation of Schemas</termref></phrase><phrase diff="add" dg="rq144"><termref def="key-interchange"/></phrase>.</p>
</note>
<p><termdef id="key-fullyConforming" term="Web-aware"><phrase diff="del" dg="rq144"><term>Fully conforming</term></phrase><phrase diff="add" dg="rq144"><term>Web-aware</term></phrase>
processors are network-enabled processors which are not only both 
<termref def="key-minimallyConforming">minimally conforming</termref> and 
<termref def="key-interchange"><phrase diff="del" dg="rq144">in conformance 
to the XML Representation of Schemas</phrase><phrase diff="add" dg="rq144">schema-document aware</phrase></termref>, but which additionally 
&must; be capable of accessing schema documents from the World Wide Web 
<phrase diff="del" dg="rq144">according to</phrase><phrase diff="add" dg="rq144">as described in</phrase>
<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.xm;) have <termref def="key-compName">names</termref>.
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>
        Therefore <termdef id="key-symbolSpace" term="symbol space">this specification introduces the term
<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 name <code>http://www.w3.org/2001/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>
 <issue id="RQ-153i" role="1.1">
  <p><loc href="&reqs;#xsd-1.1-namespace" target="reqs">RQ-153 (xsd-1.1-namespace)</loc></p>
  <p>This specification must choose either to use the same namespace as XML
Schema 1.0, or to use a different namespace, or to use more than one namespace. An explicit decision should be made.</p>
 </issue>
 <p>&XSP1; also defines several attributes for direct use in any XML documents.  These attributes are in a different namespace,
which has the namespace name <code>http://www.w3.org/2001/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.  All schema processors have appropriate attribute
declarations for these attributes built in, see <specref ref="xsi.type"/>,
<specref ref="xsi.nil"/>, <specref ref="xsi.schemaLocation"/> and <specref ref="xsi.noNamespaceSchemaLocation"/>.</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 <termref def="gloss-QName">QName</termref>;  see <specref ref="src-qname"/> for
the means by which the <termref def="gloss-QName">QName</termref> is
associated with a type definition.
</p>
</div3>
<div3 id="xsi_nil">
<head>xsi:nil</head>
<p>&XSP1; introduces a mechanism for signaling that an element
&must.x.s; be accepted as <termref def="key-vn">valid</termref> when
it has no content despite a content type which does not require or
even necessarily allow empty content.  An element <phrase diff="del" dg="may">may be</phrase><phrase diff="add" dg="may">can be</phrase> 
<termref def="key-vn">valid</termref> without
content if it has the attribute <code>xsi:nil</code> with the value
<code>true</code>.  An element so labeled &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 &can.xm; 
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 XML
documents (preferably of MIME type
<code>application/xml</code> or <code>text/xml</code>, but see <clauseref ref="c-vxd"/> of <specref ref="src-include"/>), conforming to the specifications in <specref ref="layer2"/>. 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>
   <div2 id="scIntro">
    <head>Introduction</head>
    <p>The following sections provide full details on the composition of all schema components, together
with their XML representations and their contributions to <termref def="key-va">assessment</termref>.  Each section is devoted to a single component, with separate subsections for
     <olist>
      <item>
       <p>properties:  their values and significance</p>
      </item>
      <item>
       <p>XML representation and the mapping to properties</p>
      </item>
      <item>
       <p>constraints on representation</p>
      </item>
      <item>
       <p>validation rules</p>
      </item>
      <item>
       <p>&PSVI; contributions</p>
      </item>
      <item>
       <p>constraints on the components themselves</p>
      </item>
     </olist>
The sub-sections immediately below introduce conventions and terminology used throughout the component sections.</p>
   <div3>
    <head>Components and Properties</head>
    <p>Components are defined in terms of their
properties, and each property in turn is defined by giving its range,
that is the values it &may.xm; have.  This can be understood as
defining a schema as a labeled directed graph, where the root is a schema,
every other vertex is a schema
component or a literal (string, boolean, number) and every labeled edge is 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> 
<phrase diff="del" dg="fpwd">may not</phrase><phrase diff="add" dg="fpwd">&mustnot;</phrase> 
exist, so in some cases re-entrant chains of properties 
<phrase diff="del" dg="modals">&must;</phrase><phrase diff="add" dg="modals">will</phrase> 
exist.  Equality of components for the purposes of this
specification is always defined as equality of names (including target
namespaces) within symbol spaces.</p>
	  <issue id="RQ-125i" role="1.1">
	    <p><loc href="&reqs;#id-anon-types" target="reqs">RQ-125 (id-anon-types)</loc>,
            <loc href="&reqs;#scd-origin-inheritance" target="reqs">RQ-134 (scd-origin-inheritance)</loc>
            </p>
    <p>Version 1.0 was deliberately reticent in stating identity conditions for
components.  With hindsight this was a mistake, and will be corrected.</p>
    <resolution>
     <p>"[We agree] to close phase 1 discussion of RQ-125 by adopting this
proposal: Add {scope} property to type definition components which will either be the enclosing element declaration or "global", by analogy with element declarations {scope}." [<loc href="http://www.w3.org/XML/Group/2004/05/xml-schema-ftf-minutes.html">F2F
2004-03-12, section RQ-125</loc> (W3C-member-only link)]</p>
     <p>This change will solve the anonymous type equality problem by giving an
unequivocal answer to the "who am I?" question for such types by way of the
answer "Your identity is determined by your scope's identity".</p>
    </resolution>
	    </issue>
    <note>
    <p>A schema and its components as defined in this chapter are an idealization 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 below of language such as "properties . . . having . . .
components as values".</p>
   </note>
   <p><termdef id="key-null" term="absent">Throughout this specification, the
term <term>absent</term> is used as a distinguished property value denoting
absence</termdef>.<phrase diff="add" dg="fpwd">  Again this should not be interpreting as
constraining implementations, as for instance between using a <pt>null</pt>
value for such properties or not representing them at all.</phrase></p>
   <p>Any property not
identified as optional is <phrase diff="del" dg="rq144">required to be 
present</phrase><phrase diff="add" dg="rq144">defined as always present</phrase>; 
optional properties which are
not present are taken to have <termref def="key-null">absent</termref> as their value.  Any
property identified as a having a set, subset or list value &may; have an empty value 
unless this is explicitly
ruled out:  this is <emph>not</emph> the same as <termref def="key-null">absent</termref>.  
Any property value identified as a 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 characters identified as 
<xtermref href="http://www.w3.org/TR/REC-xml/#charsets">legal XML characters</xtermref>
in <bibref ref="ref-xml"/>.</p></div3>
   <div3>
    <head>XML Representations of 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, this specification provides 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 &must; be in the XML Schema namespace, that is their <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.element">namespace name</xpropref> &must; be <code>http://www.w3.org/2001/XMLSchema</code>.  Although a common way of creating the XML Infosets which are or contain <termref def="key-schemaDoc">schema documents</termref> 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>Two aspects of the XML representations of components presented in the
following sections are constant across them all:
    <olist>
     <item>
      <p>All of them allow attributes qualified with namespace names other than
the XML Schema namespace itself: these appear as annotations in the
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-targeted information.</p>
     </item>
    </olist>
   </p>
   </div3>
    <div3>
    <head>The Mapping between XML Representations and 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"/>.</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>
     <p>In discussing the mapping from XML representations to schema
components below, the value of a component property is often determined by the
value of an attribute information item, one of the &i-attributes; of an element
information item.  Since schema documents are constrained by the
<specref ref="normative-schemaSchema"/>, there is always a simple type
definition associated with any such attribute information item.  <termdef id="key-vv" term="actual value">The
phrase <term>actual value</term> is used to refer to the member of the value space of the
simple type definition associated with an attribute information item which corresponds to
its &i-value;</termdef>.  This will often be a string, but &can.xm; also be an
integer, a boolean, a URI reference, etc.  This term is also occasionally used with respect to element or attribute information items in a document being <termref def="key-va">validated</termref>.</p>
   <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 <phrase diff="del" dg="may">may</phrase><phrase diff="add" dg="may">will in some cases</phrase> 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>Forward reference to named definitions and declarations
<emph>is</emph> allowed, both within and between <termref def="key-schemaDoc">schema documents</termref>. By the time the
component corresponding to an XML representation which contains a
forward reference is actually needed for <termref def="key-vn">validation</termref><phrase diff="add" dg="may">, it
is possible that</phrase> an appropriately-named component &will.xm;
have become available to discharge the reference: see <specref ref="composition"/> for details.</p>
   </div3>
   <div3>
    <head>White Space Normalization during Validation</head>
    <p>Throughout this specification, <termdef id="key-iv" term="initial value">the
<term>initial value</term> of some
attribute information item is the value of the
<xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">normalized
value</xpropref> property of that item.  Similarly, the <term>initial value</term> of an element information item is 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">The
<term>normalized value</term> of an element or
attribute information item is an &r-value; whose white space, if any, has been
normalized according to the value of the <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#rf-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> (line feed) 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 <local>replace</local>,
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>If the simple type definition used in an item's <termref def="key-vn">validation</termref> is the <termref def="key-simpleUrType">simple ur-type definition</termref>, the <termref def="key-nv">normalized value</termref> &must; be determined as in the <local>preserve</local> case above.</p>
   <p>There are three alternative validation rules which <phrase diff="del" dg="may">may</phrase><phrase diff="add" dg="may">help</phrase> supply the necessary background for the
above:  <specref ref="cvc-attribute"/> (<clauseref ref="c-sva"/>), <specref ref="cvc-type"/> (<clauseref ref="c-sv1"/>) or <specref ref="cvc-complex-type"/> (<clauseref ref="c-sv2"/>).</p>
   <p>These three levels of normalization correspond to the processing mandated
in XML<phrase diff="del" dg="fpwd"> 1.0</phrase> 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 <local>replace</local> and <local>collapse</local> 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, <phrase diff="del" dg="may">the above definition of &i-value; may mean</phrase><phrase diff="add" dg="may">it is possible that</phrase>
<emph>further</emph> normalization <phrase diff="del" dg="may">takes</phrase><phrase diff="add" dg="may">will
take</phrase> 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>
   </div3>
   </div2>
   <div2 id="cAttribute_Declarations">
    <head>Attribute Declarations</head>
    <p>Attribute declarations provide for:</p>
    <ulist>
     <item><p>Local <termref def="key-vn">validation</termref> of attribute information item values using a simple type definition;</p></item>
     <item><p>Specifying default or fixed values for attribute information items.</p></item>
    </ulist>
 <note role="example">
<eg xml:space="preserve"><![CDATA[<xs:attribute name="age" type="xs:positiveInteger" use="required"/>]]>
</eg>
<p>The XML representation of an attribute declaration.</p>
</note>
    <div3 id="Attribute_Declaration_details">
     <head>The Attribute Declaration Schema Component</head>
     <issue id="RQ-129i" role="1.1">
      <p><loc href="&reqs;#eliminate-canonical" target="reqs">RQ-129 (eliminate-canonical)</loc></p>
      <p>In a few places part 1 of version 1.0 relied on the ability to
determine a (canonical) lexical form for any simple typed value, e.g. in the
construction of default attribute information items.  But not all simple types
<emph>have</emph> such a canonical form.  The dependence on canonical forms,
which part 2 will no longer normatively require, will be removed.</p>
      <resolution>
       <p><loc href="http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2004Mar/0072.html">minutes from XML Schema WG call 2004-03-19</loc> (W3C-member-only link)</p>
       <p>Modify the component structure to record / retain a lexical form.
   (There was some speculation in the WG about whether the existing 
   value property should or should not be repurposed, or a new property
   added; the WG did NOT decide this now, preferring to leave it to
   the editor as part of the plumbing and deal with it as part of
   Phase 2.)</p>
       <p>If the component comes from a schema document, then the lexical
   form in the component should be that appearing in the schema
   document.</p>
       <p>Otherwise (i.e. if the component is born binary), the lexical
   form in the component should be any appropriate one.</p>
      </resolution>
     </issue>
    <p>The attribute declaration schema component has the following
properties:</p>
    <compdef name="Attribute Declaration" abbrev="ad"/>
<p>The <propref comp="ad" prop="name"/> property &must; match the local part of the names of attributes being <termref def="key-vn">validated</termref>.</p>
<p>The value of the attribute &must; conform to the supplied <propref comp="ad" prop="type definition"/>.</p>
    <p>A &non-absent; value of the <propref comp="ad" prop="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 comp="ad" prop="target namespace"/> <termref def="key-vn">validate</termref> unqualified (unprefixed) items.</p>
    <p>A <propref comp="ad" prop="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 comp="ad" prop="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><propref comp="ad" prop="value constraint"/> reproduces the functions of XML<phrase diff="del" dg="fpwd"> 1.0</phrase> 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; equal the supplied
constraint value, and if absent receives the supplied value as for
<pt>default</pt>.  Note that it is <emph>values</emph> that are supplied and/or
checked, not strings.</p>
    <p>See <specref ref="cAnnotations"/> for information on the role of the
<propref comp="ad" prop="annotations"/> property.</p>
<note><p>A more complete and formal presentation of the semantics of <propref comp="ad" prop="name"/>, <propref comp="ad" prop="target namespace"/> and <propref comp="ad" prop="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 attributes with names such as <code>xmlns</code> or <code>xmlns:xsl</code> from
ordinary attributes, identifying them as <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.element">namespace attributes</xpropref>.  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> 
</div3>
    <div3 id="declare-attribute">
<head>XML Representation of Attribute Declaration Schema
Components</head>
	  <issue id="RQ-121i" role="1.1">
	    <p><loc href="&reqs;#prohibited-and-fixed" target="reqs">RQ-121 (prohibited-and-fixed)</loc></p>
    <p>Neither the REC prose nor the sForS rule out XML representations of
attribute declarations containing both use='prohibited' and fixed='...'.  It
will be made clear that 'prohibited' wins, and what this means.</p>
    <resolution>
     <p>"[M]ake [it] easier to
learn from the spec [that] 'prohibited wins' and the construct is not an
error" [<loc href="http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2004Mar/0133.html">telcom minutes, RQ-121</loc> (W3C-member-only link)]</p>
    </resolution>
	    </issue>
<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.xm; 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 comp="ad" prop="name">The &v-value; of the <code>name</code> &i-attribute;</propmap>
  <propmap comp="ad" prop="target namespace">The &v-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 comp="ad" prop="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 &v-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 comp="ad" prop="scope"><pt>global</pt>.</propmap>
 <propmap comp="ad" prop="value constraint">If there is a <code>default</code> or a <code>fixed</code>
&i-attribute;, then a pair consisting of the &v-value; (with respect to the
<propref comp="ad" prop="type definition"/>) of that &i-attribute; and
either <pt>default</pt> or <pt>fixed</pt>, as appropriate, otherwise <termref def="key-null">absent</termref>.</propmap>
 <propmap comp="ad" prop="annotations">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
attribute use with properties as follows (unless <code>use='prohibited'</code>, in which case the item
corresponds to nothing at all):</p>
 <reprcomp ref="AU_details" abstract="Attribute Use">
  <propmap comp="au" prop="required"><pt>true</pt> if the <code>use</code>
&i-attribute; is present with &v-value; <code>required</code>, otherwise
<pt>false</pt>.</propmap>
  <propmap comp="au" prop="attribute declaration">See the Attribute Declaration mapping
immediately below.</propmap>
  <propmap comp="au" prop="value constraint">If there is a <code>default</code> or a <code>fixed</code>
&i-attribute;, then a pair consisting of the &v-value; (with respect to the
<propref comp="ad" prop="type definition"/> of the <propref comp="au" prop="attribute declaration"/>) of that &i-attribute; and
either <pt>default</pt> or <pt>fixed</pt>, as appropriate, otherwise <termref def="key-null">absent</termref>.</propmap>
 </reprcomp>
 <reprcomp ref="Attribute_Declaration_details" abstract="Attribute Declaration">
  <propmap comp="ad" prop="name">The &v-value; of the <code>name</code> &i-attribute;</propmap>
  <propmap comp="ad" prop="target namespace">If <code>form</code> is present and its
&v-value; is <code>qualified</code>, or if <code>form</code> is absent and the
&v-value; of <code>attributeFormDefault</code> on the <eltref ref="schema"/>
ancestor is <code>qualified</code>, then the &v-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 comp="ad" prop="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 &v-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 comp="ad" prop="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 an <eltref ref="attributeGroup"/> definition), <termref def="key-null">absent</termref>.</propmap>
  <propmap comp="ad" prop="value constraint"><termref def="key-null">absent</termref>.</propmap>
 <propmap comp="ad" prop="annotations">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
attribute use with properties as follows (unless <code>use='prohibited'</code>, in which case the item
corresponds to nothing at all):</p>
 <reprcomp ref="AU_details" abstract="Attribute Use">
  <propmap comp="au" prop="required"><pt>true</pt> if the <code>use</code>
&i-attribute; is present with &v-value; <code>required</code>, otherwise
<pt>false</pt>.</propmap>
  <propmap comp="au" prop="attribute declaration">The (top-level) attribute declaration <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>ref</code> &i-attribute;</propmap>
  <propmap comp="au" prop="value constraint">If there is a <code>default</code> or a <code>fixed</code>
&i-attribute;, then a pair consisting of the &v-value; (with respect to the
<propref comp="ad" prop="type definition"/> of the <propref comp="au" prop="attribute declaration"/>) of that &i-attribute; and
either <pt>default</pt> or <pt>fixed</pt>, as appropriate, otherwise <termref def="key-null">absent</termref>.</propmap>
 </reprcomp>
 </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 <termref def="key-simpleUrType">simple ur-type definition</termref>, which imposes no constraints at all.</p>
 <p>Attribute information items <termref def="key-vn">validated</termref> by a top-level declaration &must; be qualified with the
<propref comp="ad" prop="target namespace"/> of that declaration (if this is <termref def="key-null">absent</termref>, the item &must; be unqualified).  Control over whether attribute information items
<termref def="key-vn">validated</termref> by a local declaration &must; be similarly 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 comp="ad" prop="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 reside in symbol spaces local to the type definition which contains
them.</p>
    </div3>
    <div3>
     <head>Constraints on XML Representations of Attribute Declarations</head>
 <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 schema for schemas,
   <olist role="and.apply.xm">
    <item>
     <p><code>default</code> and <code>fixed</code> &mustnot; both be present.</p>
    </item>
    <item>
     <p>If <code>default</code> and <code>use</code> are both present,
<code>use</code> &must; have the &v-value; <code>optional</code>.</p>
    </item>
    <item>
     <p>If the item's parent is not <eltref ref="schema"/>, then
      <olist role="and.mxm">
       <item>
     <p>One of <code>ref</code> or <code>name</code> &is.xm; present, but not both.</p>
    </item>
       <item>
        <p>If <code>ref</code> is present, then all of <eltref ref="simpleType"/>,
<code>form</code> and <code>type</code> &are.xm; absent.</p>
       </item>
      </olist>
     </p>
    </item>
    <item>
     <p><code>type</code> and <eltref ref="simpleType"/>
&mustnot; 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>
     <head>Attribute Declaration Validation Rules</head>
   <constraintnote type="cvc" id="cvc-attribute">
     <head>Attribute Locally Valid</head>
     <p>For an attribute information item to be locally <termref def="key-vn">valid</termref> 
with respect to an attribute declaration 
      <olist role="and.mxm">
       <item id="c-a1">
        <p>The declaration &isnot.xmnb; <termref def="key-null">absent</termref> 
(see <specref ref="conformance-missing"/> for
how this can fail to be the case).</p>
       </item>
       <item id="c-a2">
        <p>Its <propref comp="ad" prop="type definition"/> &isnot.xmnb; absent.</p>
       </item>
       <item id="c-sva">
        <p>The item's &i-value; &is.xm; locally <termref def="key-vn">valid</termref> 
with respect to that <propref comp="ad" prop="type definition"/> 
as per <specref ref="cvc-simple-type"/>.</p>
       </item>
       <item>
        <p>The item's &v-value; 
<phrase diff="del" dg="modals">&must; match</phrase><phrase diff="add" dg="modals">matches</phrase>
 the value of the <propref comp="ad" prop="value constraint"/>, if it is
present and <pt>fixed</pt>.</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><termdef id="key-dd" term="context-determined declaration">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.  Such
declarations are called the <term>context-determined declarations</term></termdef>. 
See <clauseref ref="c-ctma"/> (in <specref ref="cvc-complex-type"/>) for
attribute declarations, <clauseref ref="c-cdde"/> (in <specref ref="cvc-particle"/>) for element
declarations.</p>
  <p>For an attribute information item's schema-validity to have been assessed
      <olist role="and.mxm">
       <item>
        <p>A &non-absent; attribute declaration
&is.xm; known for it, namely
         <olist role="orval">
          <item>
           <p>A declaration which has been established as its <termref def="key-dd">context-determined declaration</termref>;</p>
          </item>
          <item id="c-adbyr">
           <p>A declaration resolved to by 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 name</xpropref> as defined by <specref ref="cvc-resolve-instance"/>, provided its <termref def="key-dd">context-determined declaration</termref> is
not <pt>skip</pt>.</p>
          </item>
         </olist>
        </p>
       </item>
       <item>
        <p>Its <termref def="key-vn">validity</termref> with respect to that
declaration 
&has.xmh; 
been evaluated as per <specref ref="cvc-attribute"/>.</p>
       </item>
       <item>
        <p>Both <clauseref ref="c-a1"/> and <clauseref ref="c-a2"/> of <specref ref="cvc-attribute"/> &are.xm; satisfied.</p>
       </item>
      </olist>
     </p>
<p><termdef id="key-svaa" term="strictly assessed" role="local">For attributes, there is no
difference between assessment and strict assessment, so if the above holds, the attribute information item has been <term>strictly assessed</term></termdef>.</p> 
    </constraintnote>
    </div3>
    <div3>
     <head>Attribute Declaration Information Set Contributions</head>
    <constraintnote id="sic-a-outcome" type="sic">
     <head>Assessment Outcome (Attribute)</head>
	    <issue id="RQ-143i" role="1.1">
	      <p><loc href="&reqs;#AssessmentOfAtts" target="reqs">RQ-143 (AssessmentOfAtts)</loc></p>
      <p>An attribute with no type declaration cannot be 'assessed', as defined
by (Schema-Validity Assessment (Attribute)), so it will never have any PSVI
properties, whereas it would be natural for it to have [validation attempted] =
none and [validity] = notKnown.  This will be fixed.</p>
      <resolution>
       <p>It is likely that the current backward-chaining approach to defining
schema-validity assessment will be reworked, in which case this will get fixed as
part of that.</p>
      </resolution>
	      </issue>
     <p>If the schema-validity of an attribute information item has been assessed
as per <specref ref="cvc-assess-attr"/>, then in the &PSVI; it has properties as follows:</p>
     <proplist role="psvi" item="attribute">
       <propdef name="validation context" id="a-validation_context">The nearest ancestor element information
item with a <propref role="psvi" ref="e-schema_information"/> property.</propdef>
       <propdef name="validity" id="a-validity">
        <olist role="Caseval">
       <item>
        <p role="if">it was <termref def="key-svaa">strictly assessed</termref></p>
        <p role="then">
         <olist role="caseval">
          <item>
           <p role="if">it was
<termref def="key-vn">valid</termref> as defined by <specref ref="cvc-attribute"/></p>
           <p role="then"><pt>valid</pt>;</p>
          </item>
          <item>
           <p role="otherwise"><pt>invalid</pt>.</p>
          </item>
         </olist> 
        </p>
       </item>
       <item>
        <p role="otherwise"><pt>notKnown</pt>.</p>
       </item>
      </olist>
       </propdef>
       <propdef name="validation attempted" id="a-validation_attempted">
       <olist role="Caseval">
       <item>
        <p role="if">it was <termref def="key-svaa">strictly assessed</termref></p>
        <p role="then"><pt>full</pt>;</p>
       </item>
       <item>
        <p role="otherwise"><pt>none</pt>.</p>
       </item>
      </olist></propdef>
       <propdef name="schema specified" id="a-schema_specified"><pt>infoset</pt>.  See <specref ref="sic-attrDefault"/> for the other possible value.</propdef>
      </proplist>
    </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
property:</p>
     <proplist role="psvi" item="attribute">
      <propdef id="a-schema_error_code" name="schema error code">
       <olist role="Caseval">
        <item>
         <p role="if">the item is not <termref def="key-vn">valid</termref></p>
         <p role="then">a list.  Applications wishing to provide
information as to the reason(s) for the <termref def="key-vn">validation</termref> failure are encouraged to record one or more
error codes (see <specref ref="outcomes"/>) herein.</p>
        </item>
        <item>
         <p role="otherwise"><termref def="key-null">absent</termref>.</p>
        </item>
       </olist>
      </propdef>
     </proplist>
    </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 attribute
information item &may;, at processor option, have a property:</p>
     <proplist role="psvi" item="attribute">
      <propdef id="a-declaration" name="attribute declaration">
       An <termref def="key-iso">item isomorphic</termref> to the declaration component itself.
      </propdef>
     </proplist>
    </constraintnote>
    <constraintnote type="sic" id="sic-attrType">
     <head>Attribute Validated by Type</head>
     <p>If <clauseref ref="c-sva"/> of <specref ref="cvc-attribute"/> applies with
respect to an attribute information item, in the &PSVI; the attribute
information item has a property:</p>
     <proplist role="psvi" item="attribute">
      <propdef id="a-schema_normalized_value" name="schema normalized value">
       The &i-value; of the item as <termref def="key-vn">validated</termref>.
      </propdef>
     </proplist>
     <p>Furthermore, the item has one of the following alternative sets of properties:</p>
     <p>Either</p>
    <proplist role="psvi" item="attribute">
      <propdef id="a-type_definition" name="type definition">An <termref def="key-iso">item isomorphic</termref> to the relevant attribute declaration's
<propref comp="ad" prop="type definition"/> component.</propdef>
     <propdef name="member type definition" id="a-member_type_definition">If
and only if that type definition has <propref comp="std" prop="variety"/> <pt>union</pt>, then an
<termref def="key-iso">item isomorphic</termref> to that member of its <propref comp="std" prop="member type definitions"/> which actually <termref def="key-vn">validated</termref> the attribute item's <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">normalized value</xpropref>.</propdef>
     </proplist>     
      <p>or</p>
    <proplist role="psvi" item="attribute">
      <propdef id="a-type_definition_type" name="type definition
type">
<pt>simple</pt>.</propdef>
       <propdef id="a-type_definition_namespace" name="type definition namespace">The <propref comp="std" prop="target namespace"/> of the <termref def="key-typeDefn">type definition</termref>.</propdef>
        <propdef name="type definition anonymous" id="a-type_definition_anonymous"><pt>true</pt> if the <propref comp="std" prop="name"/> of the <termref def="key-typeDefn">type definition</termref> is <termref def="key-null">absent</termref>, otherwise <pt>false</pt>.</propdef>
        <propdef name="type definition name" id="a-type_definition_name">The <propref comp="std" prop="name"/> of the <termref def="key-typeDefn">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.</propdef>
       </proplist>
        <p>If the <termref def="key-typeDefn">type definition</termref> has <propref comp="std" prop="variety"/> <pt>union</pt>, then calling
         <termdef id="a-key-amt" term="actual member type definition" role="local"> that
member of the <propref comp="std" prop="member type definitions"/> which actually
<termref def="key-vn">validated</termref> the attribute item's &i-value; the
<term>actual member type definition</term></termdef>, there are three additional properties:</p>
    <proplist role="psvi" item="attribute">
     <propdef name="member type definition namespace" id="a-member_type_definition_namespace">The <propref comp="std" prop="target namespace"/> of the <termref def="a-key-amt">actual
member type definition</termref>.</propdef>
     <propdef name="member type definition anonymous" id="a-member_type_definition_anonymous"><pt>true</pt> if the <propref comp="std" prop="name"/> of the <termref def="a-key-amt">actual member type definition</termref> is <termref def="key-null">absent</termref>, otherwise <pt>false</pt>.</propdef>
     <propdef name="member type definition name" id="a-member_type_definition_name">The <propref comp="std" prop="name"/> of the <termref def="a-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.</propdef>
         </proplist>
     <p>The first (<termref def="key-iso">item isomorphic</termref>) 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 comp="ad" prop="value constraint"/>, the
item has a property:</p>
     <proplist role="psvi" item="attribute">
      <propdef id="a-schema_default" name="schema default">
       The <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical lexical representation</xtermref> of
the declaration's <propref comp="ad" prop="value constraint"/> value.
      </propdef>
     </proplist>
     <p>If the attribute information item was not <termref def="key-svaa">strictly assessed</termref>, then instead of the values specified above,
      <olist>
       <item>
        <p>The item's <propref ref="a-schema_normalized_value" role="psvi"/>
property has
the &r-value; of the item as its value;</p>
       </item>
       <item>
        <p>The <propref ref="a-type_definition" role="psvi"/> and
<propref ref="a-member_type_definition" role="psvi"/> properties, or their
alternatives, are based on the <termref def="simple-ur-type-itself">simple ur-type definition</termref>.</p>
       </item>
      </olist>
     </p>   
    </constraintnote>
    </div3>
    <div3 id="coss-attribute">
     <head>Constraints on Attribute Declaration Schema Components</head>
  <p>All attribute declarations (see <specref ref="cAttribute_Declarations"/>) &must; satisfy the following constraints.</p>
  <constraintnote type="cos" id="a-props-correct">
   <head>Attribute Declaration Properties Correct</head>
   <olist role="And.mxm">
    <item>
     <p>The values of the properties of an attribute declaration &are.xm; 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 comp="ad" prop="value constraint"/>, the 
<xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical lexical representation</xtermref>
of its value &is.xm; <termref def="key-vn">valid</termref> with respect to the 
<propref comp="ad" prop="type definition"/> as
defined in <specref ref="cvc-simple-type"/>.
     </p>
    </item>
    <item>
     <p>If the <propref comp="ad" prop="type definition"/> is or is &constructedDiff; 
from <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref> then there 
<phrase diff="del" dg="modals">&mustnot; be a</phrase><phrase diff="add" dg="modals">is no</phrase>
<propref comp="ad" prop="value constraint"/>.</p>
    </item>
   </olist>
  </constraintnote>
  <constraintnote type="cos" id="no-xmlns">
   <head><code>xmlns</code> Not Allowed</head>
   <p>The <propref comp="ad" prop="name"/> of an attribute declaration &mustnot; match <code>xmlns</code>.</p>
<note>
<p>The <propref comp="ad" prop="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 comp="ad" prop="target namespace"/> of an attribute declaration,
whether local or top-level, &mustnot; match <code>http://www.w3.org/2001/XMLSchema-instance</code>
(unless it is one of the four built-in declarations given in the next section).</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
<phrase diff="del" dg="modals"><emph>must</emph> not</phrase><phrase diff="add" dg="modals">&mustnot;</phrase> 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:nil</code>, which would be
seriously misleading, as they would have no effect.</p>
</note>
  </constraintnote>
    </div3>
    <div3>
     <head>Built-in Attribute Declarations</head>
     <p>There are four attribute declarations present in every
schema by definition:</p>
    <schemaComp id="xsi.type">
     <head>Attribute Declaration for the 'type' attribute</head>
     <pvlist>
      <pvpair comp="ad" prop="name"><code>type</code></pvpair>
      <pvpair comp="ad" prop="target namespace"><code>http://www.w3.org/2001/XMLSchema-instance</code></pvpair>
      <pvpair comp="ad" prop="type definition">The built-in <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#QName">QName</xtermref> simple
type definition</pvpair>
      <pvpair comp="ad" prop="scope"><pt>global</pt></pvpair>
      <pvpair comp="ad" prop="value constraint"><termref def="key-null">absent</termref></pvpair>
      <pvpair comp="ad" prop="annotations"><termref def="key-null">absent</termref></pvpair>
     </pvlist>
    </schemaComp>
     <schemaComp id="xsi.nil">
     <head>Attribute Declaration for the 'nil' attribute</head>
      <pvlist>
      <pvpair comp="ad" prop="name"><code>nil</code></pvpair>
      <pvpair comp="ad" prop="target namespace"><code>http://www.w3.org/2001/XMLSchema-instance</code></pvpair>
      <pvpair comp="ad" prop="type definition">The built-in <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#boolean">boolean</xtermref> simple
type definition</pvpair>
      <pvpair comp="ad" prop="scope"><pt>global</pt></pvpair>
      <pvpair comp="ad" prop="value constraint"><termref def="key-null">absent</termref></pvpair>
      <pvpair comp="ad" prop="annotations"><termref def="key-null">absent</termref></pvpair>
     </pvlist>
     </schemaComp>
     <schemaComp id="xsi.schemaLocation">
     <head>Attribute Declaration for the 'schemaLocation' attribute</head>
      <pvlist>
      <pvpair comp="ad" prop="name"><code>schemaLocation</code></pvpair>
      <pvpair comp="ad" prop="target namespace"><code>http://www.w3.org/2001/XMLSchema-instance</code></pvpair>
      <pvpair comp="ad" prop="type definition">An anonymous simple type definition, as follows:
       <pvlist>
        <pvpair comp="std" prop="name"><termref def="key-null">absent</termref></pvpair>
        <pvpair comp="std" prop="target namespace"><code>http://www.w3.org/2001/XMLSchema-instance</code></pvpair>
        <pvpair comp="std" prop="base type definition">The built in <termref def="simple-ur-type-itself">simple ur-type definition</termref></pvpair>
        <pvpair comp="std" prop="facets"><termref def="key-null">absent</termref></pvpair>
        <pvpair comp="std" prop="variety"><pt>list</pt></pvpair>
        <pvpair comp="std" prop="item type definition">The built-in <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#anyURI">anyURI</xtermref> simple
type definition</pvpair>
        <pvpair comp="std" prop="annotations"><termref def="key-null">absent</termref></pvpair>
       </pvlist>
      </pvpair>
      <pvpair comp="ad" prop="scope"><pt>global</pt></pvpair>
      <pvpair comp="ad" prop="value constraint"><termref def="key-null">absent</termref></pvpair>
      <pvpair comp="ad" prop="annotations"><termref def="key-null">absent</termref></pvpair>
     </pvlist>
     </schemaComp>
     <schemaComp id="xsi.noNamespaceSchemaLocation">
     <head>Attribute Declaration for the 'noNamespaceSchemaLocation' attribute</head>
      <pvlist>
      <pvpair comp="ad" prop="name"><code>noNamespaceSchemaLocation</code></pvpair>
      <pvpair comp="ad" prop="target namespace"><code>http://www.w3.org/2001/XMLSchema-instance</code></pvpair>
      <pvpair comp="ad" prop="type definition">The built-in <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#anyURI">anyURI</xtermref> simple
type definition</pvpair>
      <pvpair comp="ad" prop="scope"><pt>global</pt></pvpair>
      <pvpair comp="ad" prop="value constraint"><termref def="key-null">absent</termref></pvpair>
      <pvpair comp="ad" prop="annotations"><termref def="key-null">absent</termref></pvpair>
     </pvlist>
     </schemaComp>
    </div3>
   </div2>
   <div2 id="cElement_Declarations">
    <head>Element Declarations</head>
       <p>Element declarations provide for:</p>
    <ulist>
     <item><p>Local <termref def="key-vn">validation</termref> of element information item values using a type definition;</p></item>
     <item><p>Specifying default or fixed values for an element information items;</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>
    <note role="example">
     <eg xml:space="preserve">&lt;xs:element name="PurchaseOrder" type="PurchaseOrderType"/&gt;

&lt;xs:element name="gift"&gt;
 &lt;xs:complexType&gt;
  &lt;xs:sequence>
   &lt;xs:element name="birthday" type="xs:date"/&gt;
   &lt;xs:element ref="PurchaseOrder"/>
  &lt;/xs:sequence>
 &lt;/xs:complexType&gt;
&lt;/xs:element&gt;
</eg>
     <p>XML representations of several different types of element declaration</p>
    </note>
    <div3 id="Element_Declaration_details">
     <head>The Element Declaration Schema Component</head>
<p>The element declaration schema component has the following
properties:</p>

    <compdef name="Element Declaration" abbrev="ed"/>   
<p>The <propref comp="ed" prop="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 comp="ed" prop="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 comp="ed" prop="scope"/> property.  This property is <termref def="key-null">absent</termref> in the case of  declarations within named model groups:  their scope is determined when they are used in the construction of complex type definitions.</p>
    <p>A &non-absent; value of the <propref comp="ed" prop="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 comp="ed" prop="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 comp="ed" prop="type definition"/>.  For such an
item, schema information set contributions appropriate to the <propref comp="ed" prop="type definition"/> are added to the
corresponding element information item in the &PSVI;.
</p>
<p>If <propref comp="ed" prop="nillable"/> is <pt>true</pt>, then an
element <phrase diff="del" dg="ep08a">&will.xm;</phrase><phrase diff="add" dg="ep08a">can</phrase> 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>nil</code> from namespace
<code>http://www.w3.org/2001/XMLSchema-instance</code> and value <code>true</code> (see
<specref ref="xsi_nil"/>) even if it has no text or element content
despite a <propref comp="ctd" prop="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 comp="ed" prop="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
canonical form of the supplied
constraint value becomes the <propref role="psvi" ref="e-schema_normalized_value"/> 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 its value &must; match the supplied constraint value.</p>
     <note>
      <p>The provision of defaults for elements goes beyond what is possible in
XML<phrase diff="del" dg="fpwd"> 1.0</phrase> DTDs, and does not exactly correspond to defaults for attributes.  In
particular, an element with a non-empty <propref comp="ed" prop="value constraint"/> whose simple
type definition includes the empty string in its lexical space will
nonetheless never receive that value, because the <propref comp="ed" prop="value constraint"/> will override it.</p>
     </note>
<p><propref comp="s" prop="&constraint; definitions"/> express constraints establishing uniquenesses and reference relationships among the values of related elements and
attributes.  See <specref ref="c&Constraint;_Definitions"/>.</p>
<p>Element declarations are potential members of the substitution group, if any, identified
by <propref comp="ed" prop="substitution group affiliation"/>.  Potential membership is transitive but not symmetric;  an element
declaration is a potential member of any group of which its <propref comp="ed" prop="substitution group affiliation"/> is a potential member.  
Actual membership &may.xm;
be blocked by the effects of <propref comp="ed" prop="substitution group exclusions"/> or <propref comp="ed" prop="disallowed substitutions"/>, see below.</p>
<p>An empty <propref comp="ed" prop="substitution group exclusions"/> allows a declaration to be nominated as
the <propref comp="ed" prop="substitution group affiliation"/> of other element declarations having the same <propref comp="ed" prop="type definition"/> or
types &derived; therefrom.  The explicit
values of <propref comp="ed" prop="substitution group exclusions"/> rule out element declarations having types which
are <pt>extension</pt>s or <pt>restriction</pt>s respectively of <propref comp="ed" prop="type definition"/>.  If
both values are specified, then the declaration &mustnot; be nominated as the
<propref comp="ed" prop="substitution group affiliation"/> of any other declaration.</p>

<p>The supplied values for <propref comp="ed" prop="disallowed substitutions"/> 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 comp="ed" prop="disallowed substitutions"/> is empty, then all &derived; types and substitution group members are allowed.</p>
<p>Element declarations for which <propref comp="ed" prop="abstract"/> is <pt>true</pt> can appear in
content models only when substitution is allowed;
such declarations 
<phrase diff="del" dg="fpwd">may not</phrase><phrase diff="add" dg="fpwd">&mustnot;</phrase> 
themselves ever be used to <termref def="key-vn">validate</termref> element content.</p>
     <p>See <specref ref="cAnnotations"/> for information on the role of the
<propref comp="ed" prop="annotations"/> property.</p>
    </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.xm; 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 comp="ed" prop="name">The &v-value; of the <code>name</code> &i-attribute;.</propmap>
  <propmap comp="ed" prop="target namespace">The &v-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 comp="ed" prop="scope"><pt>global</pt>.</propmap>
  <propmap comp="ed" prop="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 &v-value; of the <code>type</code> &i-attribute;, otherwise the <propref comp="ed" prop="type definition"/> of the element declaration <termref def="src-resolve">resolved</termref> to by the &v-value; of the <code>substitutionGroup</code> &i-attribute;, if present, otherwise the
<termref def="ur-type-itself" diff="del" dg="rq17">ur-type
definition</termref><termref def="any-type-itself" diff="add" dg="rq17">definition of anyType</termref>.</propmap>
  <propmap comp="ed" prop="nillable">The &v-value; of the <code>nillable</code>
&i-attribute;, if present, otherwise <pt>false</pt>.</propmap>
  <propmap comp="ed" prop="value constraint">If there is a <code>default</code> or a <code>fixed</code>
&i-attribute;, then a pair consisting of the &v-value; (with respect to the
<propref comp="ed" prop="type definition"/>, if it is a simple type definition, or the
<propref comp="ed" prop="type definition"/>'s <propref comp="ctd" prop="content type"/>, if that is a
simple type definition, or else with respect to the built-in <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#string">string</xtermref> simple type definition) of that &i-attribute; and
either <pt>default</pt> or <pt>fixed</pt>, as appropriate, otherwise <termref def="key-null">absent</termref>.</propmap>
  <propmap comp="ed" prop="&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 comp="ed" prop="substitution group affiliation">The element declaration <termref def="src-resolve">resolved</termref> to by the
&v-value; of the
<code>substitutionGroup</code> &i-attribute;, if present, otherwise <termref def="key-null">absent</termref>.</propmap>
  <propmap comp="ed" prop="disallowed substitutions">A set depending on the &v-value; of the
<code>block</code> &i-attribute;, if present, otherwise on the &v-value; of the
<code>blockDefault</code> &i-attribute; of the ancestor <eltref ref="schema"/> element
information item, if present, otherwise on the empty string.  Call this the <local>EBV</local> (for effective block value).  Then the value of this property is
 <olist role="caseval">
  <item>
   <p role="if">the <local>EBV</local> is the empty string</p>
   <p role="then">the empty set;</p>
  </item>
  <item>
   <p role="if">the <local>EBV</local> is <code>#all</code></p>
   <p role="then"><code>{</code><pt>extension</pt>, <pt>restriction</pt>, <pt>substitution</pt><code>}</code>;</p>
  </item>
  <item>
   <p role="otherwise">a set with members drawn from the set above, each being present or
absent depending on whether the &v-value; (which is a list) contains an
equivalently named item.
   <note>
       <p>Although the <code>blockDefault</code> &i-attribute; of
<eltref ref="schema"/> &may.xm; include values other than
<pt>extension</pt>, <pt>restriction</pt> or <pt>substitution</pt>,
those values are ignored in the determination of <propref comp="ed" prop="disallowed substitutions"/> for element declarations (they
<emph>are</emph> used elsewhere).</p>
      </note>
   </p>
  </item>
 </olist>
  </propmap>
  <propmap comp="ed" prop="substitution group exclusions">As for <propref comp="ed" prop="disallowed substitutions"/> above, but using the
<code>final</code> and <code>finalDefault</code> &i-attributes; in place of the
<code>block</code> and <code>blockDefault</code>
&i-attributes; and with the
relevant set being <code>{</code><pt>extension</pt>, <pt>restriction</pt><code>}</code>.</propmap>
  <propmap comp="ed" prop="abstract">The &v-value; of the <code>abstract</code>
&i-attribute;, if present, otherwise <pt>false</pt>.</propmap>
  <propmap comp="ed" prop="annotations">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 comp="p" prop="min occurs">The &v-value; of the <code>minOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap comp="p" prop="max occurs"><pt>unbounded</pt>, if the <code>maxOccurs</code>
&i-attribute; equals <pt>unbounded</pt>, otherwise the &v-value; of the <code>maxOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap comp="p" prop="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 comp="ed" prop="target namespace"/> and <propref comp="ed" prop="scope"/> properties, which are as below:</p>
 <reprcomp abstract="Element Declaration" ref="Element_Declaration_details">
  <propmap comp="ed" prop="target namespace">If <code>form</code> is present and its
&v-value; is <code>qualified</code>, or if <code>form</code> is absent and the
&v-value; of <code>elementFormDefault</code> on the <eltref ref="schema"/>
ancestor is <code>qualified</code>, then the &v-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 comp="ed" prop="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 named <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 comp="p" prop="min occurs">The &v-value; of the <code>minOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap comp="p" prop="max occurs"><pt>unbounded</pt>, if the <code>maxOccurs</code>
&i-attribute; equals <pt>unbounded</pt>, otherwise the &v-value; of the <code>maxOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap comp="p" prop="term">The (top-level) element declaration <termref def="src-resolve">resolved</termref> to by the
&v-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 information items <termref def="key-vn">validated</termref> by a top-level declaration &must; be qualified with the
<propref comp="ed" prop="target namespace"/> of that declaration (if this is <termref def="key-null">absent</termref>, the item &must; be unqualified).  Control over whether element information items <termref def="key-vn">validated</termref> by a local declaration &must; be similarly 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 comp="ed" prop="target namespace"/>.</p>
<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 with the same name as a
top-level element.  As with attribute names, the names of locally-scoped
element declarations with no <propref comp="ed" prop="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" diff="del" dg="rq17">ur-type definition</termref><termref def="key-anyType" diff="add" dg="rq17">definition of anyType</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 (nearly) the most general, validating any combination of text and element content and allowing any attributes, and providing for recursive validation where possible.</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">&lt;xs:element name="unconstrained"/&gt;

&lt;xs:element name="emptyElt"&gt;
 &lt;xs:complexType&gt;
  &lt;xs:attribute ...&gt;. . .&lt;/xs:attribute&gt;
 &lt;/xs:complexType&gt;
&lt;/xs:element&gt;

&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>The first example above declares an element whose type, by default, is 
<phrase diff="del" dg="rq17">the</phrase>
<termref def="key-urType" diff="del" dg="rq17">ur-type
definition</termref><!--* <termref def="key-anyType" diff="add" dg="rq17">definition
of anyType</termref>*--><termref def="key-anyType" diff="add" dg="rq17">anyType</termref>.  
<!--* NOT "whose type is the definition of anyType", unless you want me 
    * to recite "The name of the song is called ..." at every occasion. *-->
<!--* MSM notes that we're on our way to a spec in which the word 'ur-' 
    * does not occur.  I'm resisting the temptation to stop working on RQ-17
    * and do it now. Maybe later, as dessert. *-->
The second uses an embedded anonymous complex
type definition.</p>
<p>The last two examples illustrate the use of local element declarations.  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<phrase diff="del" dg="fpwd"> 1.0</phrase>.</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:sequence>
      <xs:element ref="annotation" minOccurs="0"/>
     </xs:sequence>
     <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:sequence>
      <xs:element ref="annotation" minOccurs="0"/>
     </xs:sequence>
     <xs:attribute name="value" type="xs:duration"/>
    </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 a previous version of the schema for datatypes.  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>
</div3>
    <div3>
     <head>Constraints on XML Representations of Element Declarations</head>
 <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:
   <olist role="and.mxm">
    <item>
     <p><code>default</code> and <code>fixed</code> 
<phrase diff="del" dg="modals">&mustnot; both be</phrase><phrase diff="add" dg="modals">are not
both</phrase> present.</p>
    </item>
    <item>
     <p>If the item's parent is not <eltref ref="schema"/>, then
      <olist role="and.ixm">
       <item>
     <p>One of <code>ref</code> or <code>name</code> &is.xm; 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>nillable</code>, <code>default</code>,
<code>fixed</code>, <code>form</code>, <code>block</code> and <code>type</code> 
&are.xm; absent,
i.e. only <code>minOccurs</code>, <code>maxOccurs</code>, <code>id</code> 
<phrase diff="add" dg="modals">and <eltref ref="annotation"/></phrase> are
allowed <phrase diff="del" dg="modals">in addition 
to</phrase><phrase diff="add" dg="modals">to appear together with</phrase> 
<code>ref</code><phrase diff="del" dg="modals">, along with <eltref ref="annotation"/></phrase>.</p>
       </item>
      </olist>
     </p>
    </item>
    <item>
     <p diff="del" dg="modals"><code>type</code> and either <eltref ref="simpleType"/> or <eltref ref="complexType"/> are mutually exclusive.</p>
     <p diff="add" dg="modals"><phrase diff="del" dg="ep08a">Either a
<code>type</code> attribute occurs, or the <eltref ref="element"/>
element has a <eltref ref="simpleType"/> or <eltref ref="complexType"/> child, but not both.</phrase><phrase diff="add" dg="ep08a">The <eltref ref="element"/> element does not have both a
<eltref ref="simpleType"/> or <eltref ref="complexType"/> child and a
type attribute.</phrase></p>
    </item>
    <item>
     <p>The corresponding particle and/or element declarations 
<phrase diff="del" dg="modals">&must;</phrase> satisfy the conditions set
out in <specref ref="coss-element"/> and <specref ref="coss-particle"/>.</p>
    </item>
   </olist>
  </p>
 </constraintnote>
    </div3>
    <div3 id="eldec_vr">
     <head>Element Declaration Validation Rules</head>
     <constraintnote type="cvc" id="cvc-elt">
      <head>Element Locally Valid (Element)</head>
      <p>For an element information item to be locally <termref def="key-vn">valid</termref> with respect to an element
       declaration
       <olist role="and.mxm">
	<item id="c-ea">
	 <p>The declaration &isnot.xmnb; <termref def="key-null">absent</termref>.</p>
	</item>
	<item>
	 <p>Its <propref comp="ed" prop="abstract"/> &is.xm;
	  <pt>false</pt>.</p>
	</item>
	<item>	 
	 <olist role="Case.old" diff="del" dg="modals">
	  <item>
	   <p role="if"><propref comp="ed" prop="nillable"/> is
	    <pt>false</pt></p>
	   <p role="then">there &must; be 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 
	     name</xpropref> is identical to
	    <code>http://www.w3.org/2001/XMLSchema-instance</code> and whose <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">local 
	     name</xpropref> is <code>nil</code>.</p>
	  </item>
	  <item id="del-c-nl">
	   <p role="if"><propref comp="ed" prop="nillable"/> is
	    <pt>true</pt> and there is such an attribute information
	    item and its &v-value; is <code>true</code>
	   </p>
	   <p role="then">
	    <olist role="and.old">
	     <item>
	      <p>The element information item &must; have no character
	       or element information item &i-children;.</p>
	     </item>
	     <item>
	      <p>There &must; be no <pt>fixed</pt> <propref comp="ed" prop="value constraint"/>.</p>
	     </item>
	    </olist></p>
	  </item>
	 </olist>
	 <olist role="Ortest" diff="add" dg="modals">
	  <item>
	   <p><propref comp="ed" prop="nillable"/> is <pt>false</pt>,
	    and 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 
	     name</xpropref> is identical to
	    <code>http://www.w3.org/2001/XMLSchema-instance</code> and whose <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">local 
	     name</xpropref> is <code>nil</code>.</p>
	  </item>
	  <item id="c-nl">
	   <!--* added after agreement between SG and MSM *-->
	   <p><propref comp="ed" prop="nillable"/> is <pt>true</pt>
	    and 
	    <olist role="ortest">
	     <item>
	      <p>There is no such attribute information item.</p>
	     </item>
	     <item>
	      <p>There is such an attribute information item,
	       and its &v-value; is <code>false</code>.</p>
	     </item>
	     <item>
	      <p>There is such an attribute information item,
	       and its &v-value; is <code>true</code>, and 
	       <olist role="andtest">
		<item>
		 <p>The element information item has no character or
		  element information item &i-children;.</p>
		</item>
		<item>
		 <p>There is no <pt>fixed</pt> <propref comp="ed" prop="value constraint"/>.</p>
		</item>
	       </olist></p>
	     </item>
	    </olist></p>
	  </item>
	  <item id="c-nl_ter" diff="add" dg="abandoned">
	   <p><propref comp="ed" prop="nillable"/> is <pt>true</pt>
	    and there is such an attribute information item and its
	    &v-value; is <code>true</code> and
	    <olist role="andtest">
	     <item>
	      <p>The element information item has no character or
	       element information item &i-children;.</p>
	     </item>
	     <item>
	      <p>There is no <pt>fixed</pt> <propref comp="ed" prop="value constraint"/>.</p>
	     </item>
	    </olist></p>
	  </item>
	  <item diff="add" dg="abandoned">
	   <p><propref comp="ed" prop="nillable"/> is <pt>true</pt>
	    and there is such an attribute information item and its
	    &v-value; is <code>false</code>.</p>
	  </item>
	  <item diff="add" dg="abandoned">
	   <p><propref comp="ed" prop="nillable"/> is <pt>true</pt>
	    and there is no such attribute information item.</p>
	  </item>
	 </olist>
	</item>
	<item>
	 <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 
	   name</xpropref> is identical to
	  <code>http://www.w3.org/2001/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 role="and.ixm">
	   <item>
	    <p>The &i-value; of that attribute information item
	     &is.xm; <termref def="key-vn">valid</termref> with
	     respect to the built-in <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#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 name</termref> (as defined
	     in <specref ref="src-qname"/>), of the &v-value; of that
	     attribute information item <phrase diff="del" dg="modals">&must;</phrase> resolve to a type
	     definition, as defined in <specref ref="cvc-resolve-instance"/> &mdash; <termdef id="key-ltd" term="local type definition" role="local">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.xm; validly &derived; from the
	     <propref comp="ed" prop="type
	      definition"/> given the union of the <propref comp="ed" prop="disallowed
	      substitutions"/> and the <propref comp="ed" prop="type
	      definition"/>'s <propref comp="ctd" prop="prohibited
	      substitutions"/>, as defined in <specref ref="cos-ct-&derived;-ok"/> (if it is a complex type
	     definition), or given <propref comp="ed" prop="disallowed
	      substitutions"/> 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" role="local">The phrase <term>actual type definition</term>
	   occurs below.  If the above three clauses are satisfied,
	   this &must; be understood as referring to the <termref def="key-ltd">local type definition</termref>, otherwise
	   to the <propref comp="ed" prop="type
	    definition"/></termdef>.
	 </p>
	</item>
	<item>
	 <olist role="Case.ixm">
	  <item>
	   <p role="if">the declaration has a <propref comp="ed" prop="value constraint"/>, <phrase diff="add" dg="modals">and</phrase> the item has neither element nor
	    character &i-children;<phrase diff="add" dg="modals">,</phrase> and <clauseref ref="c-nl"/> has
	    not applied</p>
	   <p role="then">
	    <olist role="and.ixm">
	     <item>
	      <p>If the <termref def="key-atd">actual type
		definition</termref> is a <termref def="key-ltd">local
		type definition</termref> then the <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical 
		lexical representation</xtermref> of the 
                <propref comp="ed" prop="value constraint"/> 
                value &is.xm; a valid default for the
	       <termref def="key-atd">actual type definition</termref>
	       as defined in <specref ref="cos-valid-default"/>.
	      </p>
	     </item>
	     <item>
	      <p>The element information item with the <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical 
		lexical representation</xtermref> of the <propref comp="ed" prop="value constraint"/> value used as its
	       &i-value; &is.xm; <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>
	    </olist>
	   </p>
	  </item>
	  <item>
	   <p role="if">the declaration has no <propref comp="ed" prop="value constraint"/><phrase diff="add" dg="modals">,</phrase> or the item has either element or
	    character &i-children;<phrase diff="add" dg="modals">,</phrase> or <clauseref ref="c-nl"/> has
	    applied</p>
	   <p role="then"><olist role="and.ixm">
	     <item>
	      <p>The element information item &is.xm; <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>If there is a <pt>fixed</pt> <propref comp="ed" prop="value constraint"/> and
	       <clauseref ref="c-nl"/> has not applied,
	       <olist role="and.ixm">
		<item>
		 <p>The element information item &has.xmh; no element
		  information item &i-children;.</p>
		</item>
		<item>
		 <olist role="Case.mxm">
		  <item>
		   <p role="if">the <propref comp="ctd" prop="content type"/> of the <termref def="key-atd">actual type
		     definition</termref> is <pt>mixed</pt></p>
		   <p role="then">the <termref def="key-iv">initial
		     value</termref> of the item <phrase diff="del" dg="modals">&must; match</phrase><phrase diff="add" dg="modals">matches</phrase> the
		    <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical 
		     lexical representation</xtermref> of the 
                     <propref comp="ed" prop="value constraint"/> value.</p>
		  </item>
		  <item>
		   <p role="if">the 
                     <propref comp="ctd" prop="content type"/> 
                     of the <termref def="key-atd">actual type
		     definition</termref> is a simple type
		    definition</p>
		   <p role="then">the &v-value; of the item <phrase diff="del" dg="modals">&must;
		     match</phrase><phrase diff="add" dg="modals">matches</phrase> the <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical 
		     lexical representation</xtermref> of the <propref comp="ed" prop="value
		     constraint"/> value.</p>
		  </item>
		 </olist>
		</item>
	       </olist>
	      </p>
	     </item>
	    </olist></p>
	  </item>
	 </olist>
	</item>
       
	<item>
	 <p>The element information item &is.xm; <termref def="key-vn">valid</termref> with respect to each of the
	  <propref comp="s" prop="&constraint;
	   definitions"/> as per <specref ref="cvc-&constraint;"/>.</p>
	</item>
	<item>
	 <p>If the element information item is the <termref def="key-vr">validation root</termref>, <phrase diff="add" dg="modals">then</phrase> it &is.xm; <termref def="key-vn">valid</termref> per <specref ref="cvc-id"/>.</p>
	</item>
      </olist>      
     </p>
    </constraintnote>
    <constraintnote type="cvc" id="cvc-type">
     <head>Element Locally Valid (Type)</head>
     <p>For an element information item to be locally <termref def="key-vn">valid</termref> with respect to a type definition
      <olist role="and.mxm">
       <item id="c-ct">
        <p>The type definition &isnot.xmnb; <termref def="key-null">absent</termref>;</p>
       </item>
       <item>
        <p>
        It &doesnot.xmn; have
<propref comp="ctd" prop="abstract"/> with value <pt>true</pt>.</p>
       </item>
       <item>
        <olist role="Case.ixm">
         <item>
        <p role="if">the type definition is a simple type
definition</p>
        <p role="then">
         <olist role="and.ixm">
          <item><p>The element information item's &i-attributes; &are.xm; empty,
excepting those whose <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">namespace name</xpropref> is identical to <code>http://www.w3.org/2001/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>nil</code>, <code>schemaLocation</code> or <code>noNamespaceSchemaLocation</code>.</p>
          </item>
          <item>
           <p>The element information item &has.xmh; no element information item &i-children;.</p>
          </item>
          <item id="c-sv1">
           <p>If <clauseref ref="c-nl"/> of <specref ref="cvc-elt"/> did not apply, then the &i-value; &is.xm; <termref def="key-vn">valid</termref> with respect to the type definition as defined by <specref ref="cvc-simple-type"/>.</p>
          </item>
         </olist>
        </p>
       </item>
         <item>
          <p role="if">the type definition is a complex type definition</p>
          <p role="then">the element information item &is.xm; <termref def="key-vn">valid</termref> with respect to the type definition as per <specref ref="cvc-complex-type"/>;</p>
         </item>
        </olist>
       </item>
      </olist>
     </p>
    </constraintnote>
     <constraintnote type="cvc" id="cvc-id">
  <head>Validation Root Valid (ID/IDREF)</head>
      <p>For an element information item which is the <termref def="key-vr">validation root</termref> to be <termref def="key-vn">valid</termref>
       <olist role="and.mxm">
        <item>
         <p>There &is.xm; no <local>ID/IDREF binding</local> in the item's
<propref ref="e-ii_table" role="psvi"/> whose <propref role="psvi" ref="iib-binding"/> is the
empty set.</p>
        </item>
        <item id="c-uba">
         <p>There &is.xm; no <local>ID/IDREF binding</local> in the item's <propref ref="e-ii_table" role="psvi"/> whose <propref role="psvi" ref="iib-binding"/> has more
than one member.</p>
        </item>
       </olist>
      </p>
      <p>See <specref ref="sic-id"/> for the definition of <local>ID/IDREF binding</local>.</p>
      <note>
       <p>The first clause above applies when there is a reference to an
undefined ID.  The second applies when there is a multiply-defined ID.  They
are separated out to ensure that distinct error codes (see <specref ref="outcomes"/>) are associated with these two cases.</p>
      </note>
      <note>
       <p>Although this rule applies at the <termref def="key-vr">validation root</termref>, in practice processors,
particularly streaming processors, <phrase diff="del" dg="may">&may;</phrase><phrase diff="add" dg="may">will
perhaps</phrase> wish to detect and signal the <clauseref ref="c-uba"/> case as it arises.</p>
      </note>
      <note>
       <p>This reconstruction of <bibref ref="ref-xml"/>'s <code>ID/IDREF</code>
functionality is imperfect in that if the <termref def="key-vr">validation
root</termref> is not the document element of an XML document, the results will
not necessarily be the same as those a validating parser would give were the
document to have a DTD with equivalent declarations.</p>
      </note>
 </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>So for an element information item's schema-validity to be assessed      
      <olist role="and.mxm">
       <item id="c-xd">
        <p><olist role="Or.ixm">
       <item id="c-ed">        
      <olist role="And.ixm">
       <item>
        <p>A <phrase diff="del" dg="modals">non-<termref def="key-null">absent</termref></phrase><phrase diff="add" dg="modals"><termref def="key-null">non-absent</termref></phrase>
element declaration &is.xm; known for it, because
        <olist role="ortest">
         <item>
          <p>A declaration was stipulated by the processor (see <specref ref="validation_outcome"/>).</p>
         </item>
         <item>
          <p>A declaration has been established as its <termref def="key-dd">context-determined declaration</termref>.</p>
         </item>
         <item>
          <olist role="And.ixm">
           <item>
            <p>Its <termref def="key-dd">context-determined declaration</termref> is
not <pt>skip</pt>.</p>
           </item>
           <item>
            <p>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 name</xpropref> resolve to an element declaration as defined by <specref ref="cvc-resolve-instance"/>.</p>
           </item>
          </olist>          
         </item>
        </olist></p>        
       </item>
       <item>
        <p>Its <termref def="key-vn">validity</termref> with respect
to that declaration <phrase diff="del" dg="modals">&must;
have</phrase><phrase diff="add" dg="modals">has</phrase> been
evaluated as per <specref ref="cvc-elt"/>.</p>
       </item>
       <item>
        <p>If that evaluation involved the evaluation of <specref ref="cvc-type"/>, <clauseref ref="c-ct"/> thereof &is.xm; satisfied.</p>
       </item>
      </olist>        
       </item>
            <item id="c-td">
        <olist role="And.ixm">
       <item>
<p>A &non-absent; type definition is known for
it because 
 <olist role="ortest">
  <item>
   <p>A type definition was stipulated by the processor
(see <specref ref="validation_outcome"/>).</p>
  </item>
  <item>
   <olist role="And.ixm">
    <item>
     <p>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 name</xpropref> is identical to <code>http://www.w3.org/2001/XMLSchema-instance</code> and whose <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">local name</xpropref> is <code>type</code>.</p>
    </item>
    <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/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#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 name</termref> (as defined in <specref ref="src-qname"/>), of the &v-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" role="local">call this type definition the <term>local type definition</term></termdef>.</p></item>
    <item>
        <p>If there is also a processor-stipulated type definition, the <termref def="key-ltd1">local type definition</termref> &is.xm;
validly &derived; from that type definition given its <propref comp="ctd" prop="prohibited substitutions"/>,
as defined in <specref ref="cos-ct-&derived;-ok"/> (if it is a complex type
definition), or given the empty set, as defined in <specref ref="cos-st-&derived;-ok"/> (if it is a simple type definition).</p>
       </item>
   </olist>
  </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>        
       </item>
      </olist>
        </p>
       </item>
       <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>
        <p><termdef id="key-sva" term="strictly assessed" role="local">If either case of
<clauseref ref="c-xd"/> above holds, 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 <clauseref ref="c-ed"/> nor
<clauseref ref="c-td"/> above are satisfied, <termdef id="key-lva" term="laxly assessed">an element information item's schema validity
&may; be <term>laxly assessed</term> if <phrase diff="add" dg="modals">and only if</phrase> its <termref def="key-dd">context-determined declaration</termref> is not
<pt>skip</pt> by <termref def="key-vn">validating</termref> with
respect to the <termref def="ur-type-itself" diff="del" dg="rq17">ur-type definition</termref><termref def="any-type-itself" diff="add" dg="rq17">definition of anyType</termref> as per <specref ref="cvc-type"/></termdef>.</p>     
     <note>
      <p>In general if <clauseref ref="c-ed"/> above holds 
<clauseref ref="c-td"/> does not, and vice versa.  When an
<code>xsi:type</code> &i-attribute; is involved, however, <clauseref ref="c-td"/> takes precedence,
as is made clear in <specref ref="cvc-elt"/>.</p>
     </note>
    </constraintnote>
    <note><p>The <propref comp="ed" prop="name"/> and <propref comp="ed" prop="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>
    </div3>
    <div3>
     <head>Element Declaration Information Set Contributions</head>
    <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:</p>
     <proplist role="psvi" item="element">
       <propdef name="validation context" id="e-validation_context">The nearest ancestor element information
item with a <propref role="psvi" ref="e-schema_information"/> property (or this element item itself if it has such a property).</propdef>
       <propdef name="validity" id="e-validity">
        <olist role="Caseval">
       <item>
        <p role="if">it was <termref def="key-sva">strictly
assessed</termref></p>
        <p role="then">
        <olist role="caseval">
         <item>
          <p role="if">
          <olist role="andtest">
           <item>
            <olist role="Ortest">
             <item>
              <p><clauseref ref="c-ed"/> of <specref ref="cvc-assess-elt"/>
applied and the item was
<termref def="key-vn">valid</termref> as defined by <specref ref="cvc-elt"/>;</p>
             </item>
             <item>
              <p><clauseref ref="c-td"/> of <specref ref="cvc-assess-elt"/>
applied and the item was
<termref def="key-vn">valid</termref> as defined by <specref ref="cvc-type"/>.</p>
             </item>
            </olist>            
           </item>
            <item>
             <p>Neither its &i-children; nor its
&i-attributes; contains an information item (element or attribute respectively) whose  <xpropref role="psviAnon">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-determined declaration</termref> of
<pt>mustFind</pt> whose  <xpropref role="psviAnon">validity</xpropref>
is <pt>notKnown</pt>.</p>
           </item>
          </olist>
          </p>
          <p role="then"><pt>valid</pt>;</p>
         </item>
         <item>
          <p role="otherwise"><pt>invalid.</pt>.</p>
         </item>
        </olist>
        </p>
       </item>
       <item>
        <p role="otherwise"><pt>notKnown</pt>.</p>
       </item>
      </olist>
        </propdef>
       <propdef name="validation attempted" id="e-validation_attempted">
       <olist role="Caseval">
       <item>
        <p role="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 role="psviAnon">validation attempted</xpropref> is not
<pt>full</pt></p>
        <p role="then"><pt>full</pt>;</p>
       </item>
        <item>
         <p role="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 role="psviAnon">validation attempted</xpropref> is not
<pt>none</pt></p>
         <p role="then"><pt>none</pt>;</p>
        </item>
        <item>
        <p role="otherwise"><pt>partial</pt>.</p>
       </item>
      </olist></propdef></proplist>
    </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 and/or <specref ref="cvc-type"/>
below, of an element information item has been assessed,
in the &PSVI; the item has a
property:</p>
     <proplist role="psvi" item="element">
      <propdef id="e-schema_error_code" name="schema error code">
       <olist role="Caseval">
        <item>
         <p role="if">the item is not <termref def="key-vn">valid</termref></p>
         <p role="then">a list.  Applications wishing to provide
information as to the reason(s) for the <termref def="key-vn">validation</termref> failure are encouraged to record one or more
error codes (see <specref ref="outcomes"/>) herein.</p>
        </item>
        <item>
         <p role="otherwise"><termref def="key-null">absent</termref>.</p>
        </item>
       </olist>
      </propdef>
     </proplist>
    </constraintnote>
    <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 
<phrase diff="del" dg="rq144">&must;</phrase><phrase diff="add" dg="rq144">&may;</phrase>, 
at processor option, have either:</p>
     <proplist role="psvi" item="element">
      <propdef id="e-declaration" name="element declaration">
       an <termref def="key-iso">item isomorphic</termref> to the declaration component itself
      </propdef>
     </proplist>
       <p>or</p>

     <proplist role="psvi" item="element">
      <propdef id="e-nil" name="nil"><pt>true</pt> if <clauseref ref="c-nl"/> of <specref ref="cvc-elt"/> above is satisfied,
otherwise <pt>false</pt>
      </propdef>
     </proplist>
    </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 a property:</p>
     <proplist role="psvi" item="element">
      <propdef id="e-schema_normalized_value" name="schema normalized
value">
      <olist role="Caseval">
         <item><p role="if"><clauseref ref="c-nl"/> of <specref ref="cvc-elt"/> and <specref ref="sic-eltDefault"/> above have
<emph>not</emph> applied and either the <termref def="key-typeDefn">type definition</termref> is a simple type definition or its <propref comp="ctd" prop="content type"/> is a simple type definition</p>
<p role="then">
the &i-value; of the item as <termref def="key-vn">validated</termref>.</p>
</item>
<item><p role="otherwise"><termref def="key-null">absent</termref>.</p>
</item>
</olist>
</propdef>
     </proplist>
     <p>Furthermore, the item has one of the following alternative sets of properties:</p>
     <p>Either</p>
    <proplist role="psvi" item="element">
      <propdef id="e-type_definition" name="type definition">An
<termref def="key-iso">item isomorphic</termref> to the <termref def="key-typeDefn">type definition</termref> component itself.</propdef>
     <propdef name="member type definition" id="e-member_type_definition">If
and only if that type definition is a
simple type definition with <propref comp="std" prop="variety"/> <pt>union</pt>, or
a complex type definition whose <propref comp="ctd" prop="content type"/> is a
simple type
definition with <propref comp="std" prop="variety"/> <pt>union</pt>, then an
<termref def="key-iso">item isomorphic</termref> to that member of the
union's <propref comp="std" prop="member type definitions"/> which actually <termref def="key-vn">validated</termref> the element item's &i-value;.</propdef>
     </proplist>
      <p>or</p>
    <proplist role="psvi" item="element">
      <propdef id="e-type_definition_type" name="type definition
type">
<pt>simple</pt> or <pt>complex</pt>, depending on the <termref def="key-typeDefn">type definition</termref>.</propdef>
       <propdef id="e-type_definition_namespace" name="type definition
namespace">The <xpropref role="anon">target namespace</xpropref> of the <termref def="key-typeDefn">type definition</termref>.</propdef>
        <propdef name="type definition anonymous" id="e-type_definition_anonymous"><pt>true</pt> if the <xpropref role="anon">name</xpropref> of the <termref def="key-typeDefn">type definition</termref> is <termref def="key-null">absent</termref>, otherwise <pt>false</pt>.</propdef>
        <propdef name="type definition name" id="e-type_definition_name">The <xpropref role="anon">name</xpropref> of the <termref def="key-typeDefn">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.</propdef>
       </proplist>
        <p>If the <termref def="key-typeDefn">type definition</termref> is a
simple type definition or its <propref comp="ctd" prop="content type"/> is a
simple type definition, and that type
definition has <propref comp="std" prop="variety"/> <pt>union</pt>, then calling
         <termdef id="key-amt" term="actual member type definition" role="local"> that
member of the <propref comp="std" prop="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:</p>
    <proplist role="psvi" item="element">
     <propdef name="member type definition namespace" id="e-member_type_definition_namespace">The <propref comp="std" prop="target namespace"/> of the <termref def="key-amt">actual
member type definition</termref>.</propdef>
     <propdef name="member type definition anonymous" id="e-member_type_definition_anonymous"><pt>true</pt> if the <propref comp="std" prop="name"/> of the <termref def="key-amt">actual member type definition</termref> is <termref def="key-null">absent</termref>, otherwise <pt>false</pt>.</propdef>
     <propdef name="member type definition name" id="e-member_type_definition_name">The <propref comp="std" prop="name"/> 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.</propdef>
         </proplist>
     <p>The first (<termref def="key-iso">item isomorphic</termref>) 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 comp="ed" prop="value constraint"/>, the item has a property:</p>
     <proplist role="psvi" item="element">
      <propdef id="e-schema_default" name="schema default">
       The <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical lexical representation</xtermref> of
the declaration's <propref comp="ed" prop="value constraint"/> value.</propdef>
     </proplist>
     <p>Note that if an element is <termref def="key-lva">laxly assessed</termref>, then the <propref ref="e-type_definition" role="psvi"/> and
<propref ref="e-member_type_definition" role="psvi"/> properties, or their
alternatives, are based on the <termref def="ur-type-itself" diff="del" dg="rq17">ur-type definition</termref><termref def="any-type-itself" diff="add" dg="rq17">definition of anyType</termref>.</p>
    </constraintnote>
    <constraintnote type="sic" id="sic-eltDefault">
     <head>Element Default Value</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
property:</p>
<proplist role="psvi" item="element">
<propdef id="e-schema_specified" name="schema specified">
<olist role="Caseval"><item>
<p role="if">the item is <termref def="key-vn">valid</termref> with respect to an element
declaration as per <specref ref="cvc-elt"/> and the <propref comp="ed" prop="value constraint"/> is present, but <clauseref ref="c-nl"/>
of <specref ref="cvc-elt"/> above is not satisfied and the item has no element or character information item &i-children;</p>
<p role="then">
<pt>schema</pt>.  Furthermore, the
&PSVI; has the <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical lexical representation</xtermref> of the <propref comp="ed" prop="value constraint"/> value as the
item's <propref role="psvi" ref="e-schema_normalized_value"/>
property.</p></item>
<item>
<p role="otherwise"><pt>infoset</pt>.</p></item></olist></propdef></proplist>
    </constraintnote>
    </div3>
    <div3 id="coss-element">
     <head>Constraints on Element Declaration Schema Components</head>
  <p>All element declarations (see <specref ref="cElement_Declarations"/>) &must; satisfy the following constraint.</p>
  <constraintnote type="cos" id="e-props-correct">
   <head>Element Declaration Properties Correct</head>
   <olist role="And.mxm">
    <item>
     <p>The values of the properties of an element declaration &are.xm; 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 comp="ed" prop="value constraint"/>, the <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical lexical representation</xtermref> of its value &is.xm;
<termref def="key-vn">valid</termref> with respect to the <propref comp="ed" prop="type definition"/> as defined in <specref ref="cos-valid-default"/>.</p>
    </item>
    <item>
     <p>If there is a &non-absent;
<propref comp="ed" prop="substitution group affiliation"/>, then <propref comp="ed" prop="scope"/> &is.xm; <pt>global</pt>.</p>
    </item>
    <item>
     <p>If there is a <propref comp="ed" prop="substitution group
affiliation"/>, the <propref comp="ed" prop="type definition"/> of the
element declaration &is.xm; validly &derived; from the <propref comp="ed" prop="type
definition"/> of the <propref comp="ed" prop="substitution group
affiliation"/>, given the value of the <propref comp="ed" prop="substitution group exclusions"/> of the <propref comp="ed" prop="substitution group affiliation"/>, as defined in <specref ref="cos-ct-&derived;-ok"/> (if the <propref comp="ed" prop="type
definition"/> is complex) or as defined in <specref ref="cos-st-&derived;-ok"/> (if the <propref comp="ed" prop="type
definition"/> is simple).
     </p>
    </item>
    <item>
     <p>If the <propref comp="ed" prop="type definition"/> or <propref comp="ed" prop="type definition"/>'s <propref comp="ctd" prop="content
type"/> is or is &constructedDiff; from <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref> then there 
<phrase diff="del" dg="modals">&mustnot; be a</phrase><phrase diff="add" dg="modals">is no</phrase> 
<propref comp="ed" prop="value constraint"/>.</p>
     <note>
      <p>The use of <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref> as a type
definition for elements goes beyond XML<phrase diff="del" dg="fpwd"> 1.0</phrase>, and &should.xs; be avoided if backwards
compatibility is desired.</p>
     </note>
    </item>
    <item>
     <p><phrase diff="del" dg="modals">Circular substitution groups are disallowed. 
</phrase><phrase diff="add" dg="modals">There are no circular substitution groups. </phrase>
That is, it
&isnot.xmnb; possible to return to an element declaration by repeatedly following
the <propref comp="ed" prop="substitution group affiliation"/> property.</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>For a string to be a valid default with respect to a type definition
    <olist role="case.mxm">
     <item>
      <p role="if">the type definition is a simple type definition</p>
      <p role="then">the string &is.xm;
<termref def="key-vn">valid</termref> with respect to that definition as defined by <specref ref="cvc-simple-type"/>.</p>
     </item>
     <item>
      <p role="if">the type definition is a complex type definition</p>
      <p role="then">
       <olist role="and.ixm">
        <item>
         <p>its <propref comp="ctd" prop="content type"/> &is.xm; a simple type definition
or <pt>mixed</pt>.</p>
        </item>
        <item>
         <olist role="Case.ixm">
          <item>
      <p role="if">the <propref comp="ctd" prop="content type"/> is a simple type definition</p>
      <p role="then">the string &is.xm;
<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 role="if">the  <propref comp="ctd" prop="content type"/> is <pt>mixed</pt></p>
      <p role="then">the <propref comp="ctd" prop="content type"/>'s particle &is.xm; <termref def="cd-emptiable">emptiable</termref> as defined by <specref ref="cos-group-emptiable"/>.</p>
     </item>
         </olist>
        </item>
       </olist>
      </p>
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote id="cos-equiv-&derived;-ok-rec" type="cos">
   <head>Substitution Group OK (Transitive)</head>
   <p>For an element declaration (call it <local>D</local>)  to be validly
substitutable for another element declaration (call it <local>C</local>)
subject to a blocking constraint (a subset of
{<pt>substitution</pt>, <pt>extension</pt>, <pt>restriction</pt>}, the value of
a <propref comp="ed" prop="disallowed substitutions"/>)
    <olist role="or.mxm">
     <item>
      <p><local>D</local> and <local>C</local> are the same element declaration.</p>
     </item>
     <item>
      <olist role="And.ixm">
     <item>
      <p>The blocking constraint does not contain <pt>substitution</pt>.</p>
     </item>
     <item>
      <p>There is a chain of <propref comp="ed" prop="substitution group affiliation"/>s from <local>D</local> to
<local>C</local>, that is, either <local>D</local>'s <propref comp="ed" prop="substitution group affiliation"/> is
<local>C</local>, or <local>D</local>'s <propref comp="ed" prop="substitution group affiliation"/>'s <propref comp="ed" prop="substitution group affiliation"/> is <local>C</local>, or . . .</p>
     </item>
     <item>
      <p>The set of all <propref comp="ctd" prop="derivation method"/>s
involved in the &derivation; of <local>D</local>'s <propref comp="ed" prop="type definition"/> from
<local>C</local>'s <propref comp="ed" prop="type definition"/> does not intersect with the union
of the blocking constraint, <local>C</local>'s <propref comp="ctd" prop="prohibited substitutions"/> (if <local>C</local>
is complex, otherwise the empty set) and the
<propref comp="ctd" prop="prohibited substitutions"/> (respectively the empty set) of any intermediate <propref comp="ed" prop="type definition"/>s
in the &derivation; of <local>D</local>'s <propref comp="ed" prop="type definition"/> from
<local>C</local>'s <propref comp="ed" prop="type definition"/>.</p>
     </item>
    </olist>
     </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 (call this <local>HEAD</local>)
in the <propref comp="s" prop="element declarations"/> of a schema defines a
<term>substitution group</term>, a subset of those <propref comp="s" prop="element declarations"/>, as follows:</termdef></p>
   <p>Define <local>P</local>, the potential substitution group for <local>HEAD</local>, as follows:</p>
   <olist>
     <item>
      <p>The element declaration itself is in <local>P</local>;</p>
     </item>
     <item>
      <p><local>P</local> is closed with respect to <propref comp="ed" prop="substitution group affiliation"/>, that
is, if any element declaration in the <propref comp="s" prop="element declarations"/> 
has a <propref comp="ed" prop="substitution group affiliation"/> in <local>P</local>, then that element is also in <local>P</local> itself.</p>
     </item>
    </olist>
   <p><local>HEAD</local>'s actual <termref def="key-eq">substitution
group</termref> is then the set consisting of each member of <local>P</local>
such that <olist role="and.ixm">
    <item>
     <p>Its <propref comp="ed" prop="abstract"/> is <pt>false</pt>.</p>
    </item>
    <item>
     <p>It is validly substitutable for <local>HEAD</local> subject to
<local>HEAD</local>'s <propref comp="ed" prop="disallowed substitutions"/> as the
blocking constraint, as defined in <specref ref="cos-equiv-&derived;-ok-rec"/>.</p>
    </item>
   </olist></p>
  </constraintnote>
    </div3>
   </div2>
   <div2 id="Complex_Type_Definitions">
    <head>Complex Type Definitions</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, or else
constraining the character information item &i-children; to conform to a
specified simple type definition.</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 <termref def="gloss-sic">&raw-PSVI; contributions</termref> 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>
</ulist>
	<issue id="RQ-36i" role="1.1">
	  <p><loc href="&reqs;#wildcards" target="reqs">RQ-7 (wildcards)</loc>,
             <loc href="&reqs;#local-references" target="reqs">RQ-36
(local-references)</loc>, <loc href="&reqs;#ElementDeclarationsConsistent" target="reqs">RQ-146 (ElementDeclarationsConsistent)</loc></p>
  <p>Although extremely useful, wildcards have proved to interact in
unfortunate ways with the Unique Particle Attribution and Element Declarations
Consistent constraints, and this has limited their utility, particularly for
use in allowing for extension and anticipating subsequent versions.  The
interpretation of wildcards will be changed to address these problems, without
compromising backward compatibility.</p>
  <resolution><p>As part of an overall reworking of the interpretation of local
declarations and of the Unique Particle Attribution and Element Declarations
Consistent constraints, we will change the interpretation of wildcards to
allow them to reference local declarations and subordinate them to explicit
declarations, thereby fixing the main conflicts.</p>
   <p>The so-called <loc href="http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2004Apr/0091.html">landscape summary</loc> (W3C-member-only link) covers
this along with related issues.</p>
  </resolution>
	  </issue>
<note role="example">
 <eg xml:space="preserve"><![CDATA[<xs:complexType name="PurchaseOrderType">
  <xs:sequence>
   <xs:element name="shipTo" type="USAddress"/>
   <xs:element name="billTo" type="USAddress"/>
   <xs:element ref="comment" minOccurs="0"/>
   <xs:element name="items"  type="Items"/>
  </xs:sequence>
  <xs:attribute name="orderDate" type="xs:date"/>
 </xs:complexType>
]]></eg>
 <p>The XML representation of a complex type definition.</p>
</note>
<div3 id="Complex_Type_Definition_details">
 <head>The Complex Type Definition Schema Component</head>
 <p>A complex type definition schema component has the following
properties:</p>

  <compdef name="Complex Type Definition" abbrev="ctd"/>
	  <issue id="RQ-131i" role="1.1">
	    <p><loc href="&reqs;#scd-ordering-annotation" target="reqs">RQ-131
(scd-ordering-annotation)</loc>, <loc href="&reqs;#scd-lost-annotation" target="reqs">RQ-130 (scd-lost-annotation)</loc>, <loc href="&reqs;#annotation-psvi" target="reqs">RQ-19 (annotation-psvi)</loc></p>
    <p>Version 1.0 was inconsistent in providing for multiple sources of
annotation, particularly where components corresponded to multiple nested
elements in schema documents (e.g. Complex Type Definitions <emph>vis a
vis</emph> <code>xs:complexType</code>, <code>xs:complexContent</code> and
<code>xs:restriction</code>).  This will change so that all components can have
multiple annotations, and annotations will be handled consistently across all
kinds of components.</p>
    <p>Also applies anywhere else {annotations}
plural appears -- everywhere, in fact?</p>
    <resolution>
   <olist>
    <item>
     <p>All components have an {annotations} property;</p>
    </item>
    <item>
     <p>It contains a sequence of annotations;</p>
    </item>
    <item>
     <p>Namely all annotations "scoped" by this component, but not "scoped"
   by any other component "further down".</p>
    </item>
    <item>
     <p>The order of annotations within {annotations} is
   implementation-determined.</p>
    </item>
   </olist>
     <p>Note that when point 3 above mentions "annotations 'scoped' by . . ."
this means &lt;annotation> elements <emph>and</emph> out-of-band attributes.</p>
   <p>[<loc href="http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2004Mar/0169.html">Agendum 4.1 SCD-related requirements</loc> (W3C-member-only link)]</p>
  </resolution>
	    </issue>
<p>Complex type definitions are identified by their <propref comp="ctd" prop="name"/> and <propref comp="ctd" prop="target namespace"/>.  Except
for anonymous complex type definitions (those with no <propref comp="ctd" prop="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 comp="ctd" prop="name"/>s and <propref comp="ctd" prop="target namespace"/>s
are provided for reference from
instances (see <specref ref="xsi_type"/>), and for use in the XML
representation of schema components
(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 comp="ctd" prop="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="cElement_Declarations"/>. </p>
</note>
   <p>As described in <specref ref="Type_&Derivation;"/>, each complex type is &derived; from a
<propref comp="ctd" prop="base type definition"/> which is itself either a <specref ref="Simple_Type_Definition"/> or a <specref ref="Complex_Type_Definition"/>.  <propref comp="ctd" prop="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 comp="ctd" prop="final"/> can be used as a
<propref comp="ctd" prop="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 <termdef id="key-ct-final" term="final">the complex type is said to be
<term>final</term>, because no
further &derivations; are possible</termdef>.  Finality is <emph>not</emph>
inherited, that is, a type definition &derived; by restriction from a type
definition which is final for extension is not itself, in the absence of any
explicit <code>final</code> attribute of its own, final for anything.</p>

<p>Complex types for which <propref comp="ctd" prop="abstract"/> is <pt>true</pt> &mustnot; be used as the
<propref comp="ed" prop="type definition"/> for the <termref def="key-vn">validation</termref> of element information items.  It follows that they &mustnot; be referenced from an
<specref ref="xsi_type"/> attribute in an instance document.  Abstract complex types can be
used as <propref comp="ctd" prop="base type definition"/>s, or even as the <propref comp="ed" prop="type definition"/>s of element declarations, provided in every case a concrete &derived; type definition is used for <termref def="key-vn">validation</termref>, either via <specref ref="xsi_type"/> or the operation of a substitution group.</p>

<p><propref comp="ctd" prop="attribute uses"/> are a set of attribute uses.  See <specref ref="cvc-complex-type"/>
and <specref ref="cvc-attribute"/> for details of attribute <termref def="key-vn">validation</termref>.</p>
<p><propref comp="ctd" prop="attribute wildcard"/>s provide a more flexible specification for <termref def="key-vn">validation</termref> of
attributes not explicitly included in <propref comp="ctd" prop="attribute uses"/>.
Informally, the specific values
of <propref comp="ctd" prop="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 names 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 name: &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 comp="ctd" prop="content type"/> determines the <termref def="key-vn">validation</termref> of &i-children; of element information items.  Informally:
<ulist>
<item>
<p>A <propref comp="ctd" prop="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 comp="ctd" prop="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 comp="ctd" prop="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 comp="ctd" prop="content type"/> <termref def="key-vn">validates</termref> elements whose element &i-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 comp="ctd" prop="prohibited substitutions"/> 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 a complex type definition &derived; by <pt>extension</pt> or
<pt>restriction</pt> from this definition, or element items in
a substitution group whose type definition is similarly &derived;:
If <propref comp="ctd" prop="prohibited substitutions"/> is empty,
then all such substitutions are allowed, otherwise, the &derivation; method(s) it
names are disallowed.
</p>
 <p>See <specref ref="cAnnotations"/> for information on the role of the
<propref comp="ctd" prop="annotations"/> property.</p>
</div3>
    <div3 id="declare-type">
<head>XML Representation of Complex Type Definitions</head>
<p>The XML representation for a complex type definition schema component is a
<eltref ref="complexType"/> element information item.</p>
 <p>The XML representation for complex type definitions with
a simple type definition <propref comp="ctd" prop="content type"/> is significantly different
from that of those with other <propref comp="ctd" prop="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 apply:</p>
 <reprcomp abstract="Complex Type Definition" ref="Complex_Type_Definition_details">
  <propmap comp="ctd" prop="name">The &v-value; of the <code>name</code> &i-attribute; if present, otherwise <termref def="key-null">absent</termref>.</propmap>
  <propmap comp="ctd" prop="target namespace">The &v-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 comp="ctd" prop="abstract">The &v-value; of the <code>abstract</code>
&i-attribute;, if present, otherwise <pt>false</pt>.</propmap>
<propmap comp="ctd" prop="prohibited substitutions">A set corresponding to the &v-value; of the
<code>block</code> &i-attribute;, if present, otherwise on the &v-value; of the
<code>blockDefault</code> &i-attribute; of the ancestor <eltref ref="schema"/> element
information item, if present, otherwise on the empty string.  Call this the <local>EBV</local> (for effective block value).  Then the value of this property is
 <olist role="caseval">
  <item>
   <p role="if">the <local>EBV</local> is the empty string</p>
   <p role="then">the empty set;</p>
  </item>
  <item>
   <p role="if">the <local>EBV</local> is <code>#all</code></p>
   <p role="then"><code>{</code><pt>extension</pt>, <pt>restriction</pt><code>}</code>;</p>
  </item>
  <item>
   <p role="otherwise">a set with members drawn from the set above, each being present or
absent depending on whether the &v-value; (which is a list) contains an
equivalently named item.
   <note>
       <p>Although the <code>blockDefault</code> &i-attribute; of <eltref ref="schema"/> &may.xm; include values other than <pt>restriction</pt> or<pt>extension</pt>, those values are ignored in the determination of <propref comp="ctd" prop="prohibited substitutions"/> for complex type definitions (they <emph>are</emph> used elsewhere).</p>
      </note>
   </p>
  </item>
 </olist>
</propmap>
<propmap comp="ctd" prop="final">As for <propref comp="ctd" prop="prohibited substitutions"/> above, but using the
<code>final</code> and <code>finalDefault</code> &i-attributes; in place of the
<code>block</code> and <code>blockDefault</code>
&i-attributes;.</propmap>
  <propmap comp="ctd" prop="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 <eltref ref="restriction" inside="simpleContent"/> and <eltref ref="extension" inside="simpleContent"/> &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 comp="ctd" prop="base type definition">The type definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>base</code> &i-attribute;</propmap>
  <propmap comp="ctd" prop="&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 comp="ctd" prop="attribute uses">A union of sets of attribute uses as follows 
 <olist>
  <item id="c-add1">
   <p>The set of attribute uses corresponding to the <eltref ref="attribute"/> &i-children;, if any.</p>
  </item>
  <item id="c-add2">
   <p>The <propref comp="agd" prop="attribute uses"/> of the
attribute groups <termref def="src-resolve">resolved</termref> to by the &v-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
&v-value; of the <code>base</code> &i-attribute; is a complex type definition, the
<propref comp="ctd" prop="attribute uses"/> of that type definition, unless
the <eltref ref="restriction" inside="simpleContent"/> alternative is chosen, in which case some members of
that type definition's <propref comp="ctd" prop="attribute uses"/> 
<phrase diff="del" dg="fpwd">may not</phrase><phrase diff="add" dg="fpwd">&mustnot;</phrase> 
be
included, namely those whose
<propref comp="au" prop="attribute declaration"/>'s
<propref comp="ad" prop="name"/> and <propref comp="ad" prop="target namespace"/> are the same as
<olist role="orval">
 <item>
  <p>the <propref comp="ad" prop="name"/> and <propref comp="ad" prop="target namespace"/> of the <propref comp="au" prop="attribute declaration"/> of an attribute use in the set per <clauseref ref="c-add1"/> or <clauseref ref="c-add2"/> above;</p>
 </item>
 <item>
  <p>what would have been the <propref comp="ad" prop="name"/> and <propref comp="ad" prop="target namespace"/> of the <propref comp="au" prop="attribute declaration"/> of an attribute use in the set per <clauseref ref="c-add1"/> above but for the &v-value; of the <code>use</code> &i-attribute; of the relevant <eltref ref="attribute"/> among the
&i-children; of <eltref ref="restriction" inside="simpleContent"/> being <pt>prohibited</pt>.</p>
 </item>
</olist></p>
  </item>
 </olist>
</propmap>
<propmap comp="ctd" prop="attribute wildcard">
 <olist>
  <item>
   <p><termdef id="key-law" term="local wildcard" role="local">Let the <term>local wildcard</term> be defined as</termdef>
 <olist role="caseval">
     <item>
      <p role="if">there is an <eltref ref="anyAttribute"/> present</p>
      <p role="then">a wildcard based
on the &v-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 role="otherwise"><termref def="key-null">absent</termref>.</p>
     </item>
    </olist></p>
  </item>
  <item>
   <p><termdef id="key-eaw" term="complete wildcard" role="local">Let the <term>complete wildcard</term> be defined as</termdef>
 <olist role="caseval">
  <item>
   <p role="if">there are no <eltref ref="attributeGroup" inside="simpleContent"/> &i-children; corresponding
to attribute groups with &non-absent; <propref comp="agd" prop="attribute wildcard"/>s</p>
   <p role="then">the <termref def="key-law">local wildcard</termref>.</p>
  </item>
  <item>
   <p role="if">there are one or more <eltref ref="attributeGroup" inside="simpleContent"/> &i-children; corresponding
to attribute groups with &non-absent; <propref comp="agd" prop="attribute wildcard"/>s</p>
   <p role="then">
    <olist role="caseval">
     <item id="c-awi1">
      <p role="if">there is an <eltref ref="anyAttribute"/> present</p>
      <p role="then">a wildcard whose <propref comp="w" prop="process contents"/> and
<propref comp="w" prop="annotations"/> are those of the <termref def="key-law">local
wildcard</termref>, and whose <propref comp="w" prop="namespace constraint"/> is the intensional intersection of the <propref comp="w" prop="namespace constraint"/> of the <termref def="key-law">local wildcard</termref>
and of the <propref comp="w" prop="namespace constraint"/>s of all the &non-absent; <propref comp="agd" prop="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>
     <item id="c-awi2">
   <p role="if">there is no <eltref ref="anyAttribute"/> present</p>
      <p role="then">a wildcard whose properties are as follows:
       <glist>
        <gitem>
         <label><propref comp="w" prop="process contents"/></label>
         <def>
          <p>The <propref comp="w" prop="process contents"/> of the first &non-absent; <propref comp="agd" prop="attribute wildcard"/> of an attribute group among the
attribute groups corresponding to the <eltref ref="attributeGroup" inside="simpleContent"/> &i-children;.</p>
         </def>
        </gitem>
        <gitem>
         <label><propref comp="w" prop="namespace constraint"/></label>
         <def>
          <p>The intensional intersection of the <propref comp="w" prop="namespace constraint"/>s of all the &non-absent; <propref comp="agd" prop="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>
         </def>
        </gitem>
        <gitem>
         <label><propref comp="w" prop="annotations"/></label>
         <def><p><termref def="key-null">absent</termref>.</p>
         </def>
        </gitem>
       </glist>
      </p>
  </item>
    </olist>
   </p>
  </item>  
 </olist>
</p>
  </item>
  <item>
   <p>The value is then determined by
 <olist role="caseval">
<item>
      <p role="if">the <eltref ref="restriction" inside="simpleContent"/> alternative is chosen</p>
      <p role="then">the <termref def="key-eaw">complete wildcard</termref>;</p>
     </item>
  <item>
   <p role="if">the <eltref ref="extension" inside="simpleContent"/> alternative is chosen</p>
   <p role="then">
    <olist>
     <item>
      <p><termdef id="key-baw" term="base wildcard" role="local">let the <term>base
wildcard</term> be defined as</termdef>
       <olist role="caseval">
     <item>
      <p role="if">the type definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>base</code> &i-attribute; is a complex type definition
with an <propref comp="ctd" prop="attribute wildcard"/></p>
      <p role="then">that <propref comp="ctd" prop="attribute wildcard"/>.</p>
     </item>
     <item>
      <p role="otherwise"><termref def="key-null">absent</termref>.</p>
     </item>
    </olist>
      </p>
     </item>
     <item>
      <p>The value is then determined by
    <olist role="caseval">
     <item>
      <p role="if">the <termref def="key-baw">base wildcard</termref> is &non-absent;</p>
      <p role="then">
       <olist role="caseval">
        <item>
         <p role="if">the <termref def="key-eaw">complete wildcard</termref> is <termref def="key-null">absent</termref></p>
         <p role="then">the <termref def="key-baw">base wildcard</termref>.</p>
        </item>
        <item id="c-awu">
         <p role="otherwise">a wildcard whose <propref comp="w" prop="process contents"/> and
<propref comp="w" prop="annotations"/> are those of the <termref def="key-eaw">complete
wildcard</termref>, and whose <propref comp="w" prop="namespace constraint"/> is the
intensional union of the <propref comp="w" prop="namespace constraint"/> of the <termref def="key-eaw">complete wildcard</termref>
and of the <termref def="key-baw">base wildcard</termref>, as defined in <specref ref="cos-aw-union"/>.</p>
        </item>
       </olist>
      </p>
     </item>     
     <item>
      <p role="otherwise">(the <termref def="key-baw">base
wildcard</termref> is <termref def="key-null">absent</termref>) the <termref def="key-eaw">complete
wildcard</termref></p>
     </item>
    </olist></p>
     </item>
    </olist>
   </p>
  </item>
 </olist></p>
  </item>
 </olist>
</propmap>
<propmap comp="ctd" prop="content type">
 <olist role="caseval">
  <item><p role="if">the type definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>base</code> &i-attribute; is a complex type definition whose own <propref comp="ctd" prop="content type"/> is a
simple type definition and the <eltref ref="restriction" inside="simpleContent"/> alternative is chosen</p>
   <p role="then">starting from either
         <olist>
          <item id="std1cl">
           <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 id="std2cl">
           <p>otherwise (<eltref ref="restriction" inside="simpleContent"/> has no <eltref ref="simpleType"/> among its
&i-children;), the simple type definition which is the <propref comp="ctd" prop="content type"/> of the type definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>base</code> &i-attribute;</p>
          </item>
         </olist>
a simple type definition which restricts the simple type definition identified in
<clauseref ref="std1cl"/> or <clauseref ref="std2cl"/> 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 role="if">the type definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>base</code> &i-attribute; is a complex type definition
whose own <propref comp="ctd" prop="content type"/> is <pt>mixed</pt> and a particle which
is <termref def="cd-emptiable">emptiable</termref>, as defined in <specref ref="cos-group-emptiable"/> and the <eltref ref="restriction" inside="simpleContent"/> alternative is chosen</p>
   <p role="then">starting from
         the simple type definition corresponding to the <eltref ref="simpleType"/> among
the &i-children; of <eltref ref="restriction" inside="simpleContent"/> (which
&must; be present)
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 role="if">the type definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>base</code> &i-attribute; is a complex type definition
(whose own <propref comp="ctd" prop="content type"/> &must; be a
simple type definition, see below) and the <eltref ref="extension" inside="simpleContent"/> alternative is chosen</p>
   <p role="then">
the <propref comp="ctd" prop="content type"/> of that complex type definition;</p>
  </item>
  <item>
   <p role="otherwise">(the type definition <termref def="src-resolve">resolved</termref> to by the
&v-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 
&must.x.s;
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 comp="ctd" prop="base type definition">The type definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>base</code> &i-attribute;</propmap>
  <propmap comp="ctd" prop="&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 comp="ctd" prop="attribute uses">A union of sets of attribute uses as follows: 
 <olist>
  <item id="c-ad1">
   <p>The set of attribute uses corresponding to the <eltref ref="attribute"/> &i-children;, if any.</p>
  </item>
  <item id="c-ad2">
   <p>The <propref comp="agd" prop="attribute uses"/> of the
attribute groups <termref def="src-resolve">resolved</termref> to by the &v-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 comp="ctd" prop="attribute uses"/> of the type definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>base</code> &i-attribute;, unless
the <eltref ref="restriction" inside="complexContent"/> alternative
is chosen, in which case some members of
that type definition's <propref comp="ctd" prop="attribute uses"/> &mustnot; be
included, namely those whose
<propref comp="au" prop="attribute declaration"/>'s
<propref comp="ad" prop="name"/> and <propref comp="ad" prop="target namespace"/> are the same as
<olist role="orval">
 <item>
  <p>The <propref comp="ad" prop="name"/> and <propref comp="ad" prop="target namespace"/> of the <propref comp="au" prop="attribute declaration"/> of an attribute use in the set per <clauseref ref="c-ad1"/> or <clauseref ref="c-ad2"/> above;</p>
 </item>
 <item>
  <p>what would have been the <propref comp="ad" prop="name"/> and <propref comp="ad" prop="target namespace"/> of the <propref comp="au" prop="attribute declaration"/> of an attribute use in the set per <clauseref ref="c-ad1"/> above but for the &v-value; of the <code>use</code> &i-attribute; of the relevant <eltref ref="attribute"/> among the
&i-children; of <eltref ref="restriction" inside="complexContent"/> being <pt>prohibited</pt>.</p>
 </item>
</olist></p>
  </item>
 </olist>
</propmap>
<propmap comp="ctd" prop="attribute wildcard">As above for the <eltref ref="simpleContent"/> alternative.</propmap>
<propmap comp="ctd" prop="content type">
 <olist>
  <item>
   <p><termdef id="key-efm" term="effective mixed" role="local">Let the
<term>effective mixed</term> be </termdef>
 <olist role="caseval">
       <item>
        <p role="if">the <code>mixed</code> &i-attribute; is present on <eltref ref="complexContent"/></p>
        <p role="then">its &v-value;;</p>
       </item>
       <item>
        <p role="if">the <code>mixed</code> &i-attribute; is present on
<eltref ref="complexType"/></p>
        <p role="then">its &v-value;;</p>
       </item>
       <item>
        <p role="otherwise"><code>false</code>.</p>
       </item>
      </olist></p>
  </item>
  <item>
   <p>
<termdef id="key-exg" term="effective content" role="local">Let the <term>effective
content</term> be </termdef><olist role="caseval">
  <item id="c-cme"><p role="if"> 
<olist role="ortest">
 <item>
  <p>There is no <eltref ref="group"/>, <eltref ref="all"/>, <eltref ref="choice"/> or <eltref ref="sequence"/> among the &i-children;;</p>
 </item>
 <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>
 <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 &v-value; <code>0</code>;</p>
          </item>
</olist>
</p>
   <p role="then">
    <olist role="caseval">
     <item>
      <p role="if">the <termref def="key-efm">effective mixed</termref> is <code>true</code></p>
      <p role="then">A particle whose properties are as follows:
       <glist>
        <gitem>
         <label><propref comp="p" prop="min occurs"/></label>
         <def>
          <p><code>1</code></p>
         </def>
        </gitem>
        <gitem>
         <label><propref comp="p" prop="max occurs"/></label>
         <def>
          <p><code>1</code></p>
         </def>
        </gitem>
        <gitem>
         <label><propref comp="p" prop="term"/></label>
         <def>
          <p>A model group whose <propref comp="mg" prop="compositor"/> is
<pt>sequence</pt> and whose <propref comp="mg" prop="particles"/> is empty.</p>
         </def>
        </gitem>
       </glist>.</p></item>
     <item>
     <p role="otherwise"><pt>empty</pt></p></item>
    </olist></p>
  </item>
                             <item>
                              <p role="otherwise">the particle corresponding to
the <eltref ref="all"/>, <eltref ref="choice"/>, <eltref ref="group"/> or
<eltref ref="sequence"/> among the &i-children;.</p>
                             </item>
   </olist></p>
  </item>
  <item>
   <p>
 Then the value of the property is
 <olist role="caseval">
  <item><p role="if">the <eltref ref="restriction" inside="complexContent"/> alternative is chosen</p>
  <p role="then">
   <olist role="caseval">
    <item>
     <p role="if">the <termref def="key-exg">effective content</termref> is
<pt>empty</pt> </p>
     <p role="then"><pt>empty</pt>;</p>
    </item>
    <item id="c-ctrp">
   <p role="otherwise">a pair consisting of 
    <olist>
     <item id="c-mve">
      <p><pt>mixed</pt> if the <termref def="key-efm">effective mixed</termref> is <code>true</code>, otherwise <pt>elementOnly</pt></p>
     </item>
     <item>
      <p>The <termref def="key-exg">effective content</termref>.</p>
     </item>
    </olist>
   </p>
  </item>
   </olist>
  </p>
  </item>
  <item><p role="if">the <eltref ref="extension" inside="complexContent"/> alternative is chosen</p>
   <p role="then">
    <olist role="caseval">
        <item>
         <p role="if">the <termref def="key-exg">effective
content</termref> is <pt>empty</pt></p>
         <p role="then">the
<propref comp="ctd" prop="content type"/> of the type definition <termref def="src-resolve">resolved</termref> to
by the &v-value; of the <code>base</code> &i-attribute;</p>
        </item>
     <item>
         <p role="if">the type definition <termref def="src-resolve">resolved</termref> to
by the &v-value; of the <code>base</code> &i-attribute; has a <propref comp="ctd" prop="content type"/> of <pt>empty</pt></p>
      <p role="then">a pair as per <clauseref ref="c-ctrp"/> above;</p>
        </item>
     <item>
         <p role="otherwise">a pair of <pt>mixed</pt> or <pt>elementOnly</pt> (determined as per
<clauseref ref="c-mve"/> above) and a particle whose properties are as follows:
       <glist>
        <gitem>
         <label><propref comp="p" prop="min occurs"/></label>
         <def>
          <p><code>1</code></p>
         </def>
        </gitem>
        <gitem>
         <label><propref comp="p" prop="max occurs"/></label>
         <def>
          <p><code>1</code></p>
         </def>
        </gitem>
        <gitem>
         <label><propref comp="p" prop="term"/></label>
         <def>
          <p>A model group whose <propref comp="mg" prop="compositor"/> is
<pt>sequence</pt> and whose <propref comp="mg" prop="particles"/> are the particle of
the <propref comp="ctd" prop="content type"/> of the type definition <termref def="src-resolve">resolved</termref> to
by the &v-value; of the <code>base</code> &i-attribute; followed by the
<termref def="key-exg">effective content</termref>.</p>
         </def>
        </gitem>
       </glist></p>
        </item>
       </olist>
   </p>
</item>
 </olist></p>
  </item>
 </olist>
</propmap>
</reprcomp>
</reprdef>
 <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>
     <note>
      <p>The <emph>only</emph> substantive function of the value <pt>prohibited</pt> for the
<code>use</code> attribute of an <eltref ref="attribute"/> is in establishing
the correspondence between a complex type defined by restriction and its XML
representation.  It serves to prevent
inheritance of an identically named attribute use from the <propref comp="ctd" prop="base type definition"/>.  Such an <eltref ref="attribute"/> does not correspond to any component, and hence there is no interaction with either explicit or inherited wildcards in the operation of <specref ref="formal-complex-type"/> or <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.</p>
 <note role="example">
    <eg xml:space="preserve"><![CDATA[<xs:complexType name="length1">
 <xs:simpleContent>
  <xs:extension base="xs:nonNegativeInteger">
   <xs:attribute name="unit" type="xs:NMTOKEN"/>
  </xs:extension>
 </xs:simpleContent>
</xs:complexType>

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

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

<xs:complexType name="length2">
 <xs:complexContent>
  <xs:restriction base="]]>
     <phrase diff="del" dg="rq17">xs:anyType</phrase>
     <phrase diff="add" dg="rq17">xs:rootType</phrase>
     <![CDATA[">
   <xs:sequence>
    <xs:element name="size" type="xs:nonNegativeInteger"/>
    <xs:element name="unit" type="xs:NMTOKEN"/>
   </xs:sequence>
  </xs:restriction>
 </xs:complexContent>
</xs:complexType>

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

  <depth>
   <size>25</size><unit>cm</unit>
  </depth>

<xs:complexType name="length3">
 <xs:sequence>
  <xs:element name="size" type="xs:nonNegativeInteger"/>
  <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="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:number"/>
</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>
</div3>
    <div3>
      <head>Constraints on XML Representations of Complex Type Definitions</head>
      <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, 
   <olist role="and.apply.xm">
    <item>
     <p>If the <eltref ref="complexContent"/> alternative is chosen, the type definition <termref def="src-resolve">resolved</termref> to
by the &v-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, 
      <olist role="and.mxm">
       <item>
        <p>The type definition <termref def="src-resolve">resolved</termref> to
by the &v-value; of the <code>base</code> &i-attribute; &is.xm;
      <olist role="orval">
       <item>
        <p>a complex type
definition whose <propref comp="ctd" prop="content type"/> is a simple type definition;</p>
       </item>
       <item id="cl-esc">
        <p>only if the
<eltref ref="restriction" inside="simpleContent"/> alternative is also chosen, a complex type
definition whose <propref comp="ctd" prop="content type"/> is <pt>mixed</pt> and a particle
which is
  <termref def="cd-emptiable">emptiable</termref>, as defined in <specref ref="cos-group-emptiable"/>;</p>
       </item>
       <item>
        <p>only if the
<eltref ref="extension" inside="simpleContent"/> alternative is also chosen, a simple type definition.</p>
       </item>
      </olist></p>
       </item>
       <item>
        <p>If <clauseref ref="cl-esc"/> above is satisfied, then there &is.xm; a
<eltref ref="simpleType"/> among the &i-children; of <eltref ref="restriction" inside="simpleContent"/>.</p>
       </item>
      </olist>
     </p>            
     <note>
      <p>Although not explicitly ruled out either here or in <specref ref="normative-schemaSchema"/>, specifying <code>&lt;xs:complexType . . .mixed='true'</code> when the <eltref ref="simpleContent"/> alternative is chosen has no effect on the corresponding component, and &should.xs; be avoided.  This may be ruled out in a subsequent version of this specification.</p>
     </note>
    </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 <clauseref ref="c-awi1"/> or <clauseref ref="c-awi2"/> in the correspondence specification above for <propref comp="ctd" prop="attribute wildcard"/> is satisfied, the intensional intersection &must; be expressible, as defined in <specref ref="cos-aw-intersect"/>.</p>
    </item>
   </olist>
  </p>
 </constraintnote>
     </div3>
    <div3 id="formal-complex-type">
    <head>Complex Type Definition Validation Rules</head>
    <constraintnote type="cvc" id="cvc-complex-type">
     <head>Element Locally Valid (Complex Type)</head>
     <p>For an element information item to be locally <termref def="key-vn">valid</termref> with respect to a complex type definition
      <olist role="and.mxm">
       <!--* <item> ALV ALV ALV *-->
       <item diff="del" dg="rq17">
        <p><propref comp="ctd" prop="abstract"/> is <pt>false</pt>.</p>
       </item>
       <item>
        <p>If <clauseref ref="c-nl"/> of <specref ref="cvc-elt"/> did not
apply, then <olist role="case.ixm">
         <item>
        <p role="if">the <propref comp="ctd" prop="content type"/> is <pt>empty</pt></p>
          <p role="then">the element
information item has no character or element information item &i-children;.</p>
       </item>
       <item id="c-sv2">
        <p role="if">the <propref comp="ctd" prop="content type"/> is a simple
type definition</p>
        <p role="then">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 role="if">the <propref comp="ctd" prop="content type"/> is <pt>element-only</pt></p>
        <p role="then">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 role="if">the <propref comp="ctd" prop="content type"/> is <pt>element-only</pt> or
<pt>mixed</pt></p>
        <p role="then">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 comp="ctd" prop="content type"/>'s particle, as defined in <specref ref="cvc-particle"/>.</p>
       </item>
        </olist></p>
       </item>
       <item id="c-aam">
        <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 name</xpropref> is identical to <code>http://www.w3.org/2001/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>nil</code>, <code>schemaLocation</code> or <code>noNamespaceSchemaLocation</code>,
         <olist role="case.ixm">
          <item id="c-ctma">
           <p role="if">there is among the <propref comp="ctd" prop="attribute uses"/> an
attribute use with an <propref comp="au" prop="attribute declaration"/> whose
<propref comp="ad" prop="name"/> matches the attribute information item's <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">local name</xpropref> and whose <propref comp="ad" prop="target namespace"/> is identical to the attribute information item's <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">namespace name</xpropref> (where an <termref def="key-null">absent</termref> <propref comp="ad" prop="target namespace"/> is taken to be identical to a <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">namespace name</xpropref> with no value)</p>           
           <p role="then">the attribute information &is.xm; <termref def="key-vn">valid</termref> with respect to that attribute use as per <specref ref="cvc-au"/>.  In this case the <propref comp="au" prop="attribute declaration"/> of that attribute use 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>
          <item id="c-avaw">
           <p role="otherwise">
            <olist role="and.ixm">
             <item>
              <p>There &is.xm; an <propref comp="ctd" prop="attribute wildcard"/>.</p>
             </item>
             <item>
              <p>The
attribute information item &is.xm; <termref def="key-vn">valid</termref> with respect to it as defined in <specref ref="cvc-wildcard"/>.</p>
             </item>
            </olist>
           </p>
          </item>
         </olist>
        </p>
       </item>
       <item>
        <p>The <propref comp="au" prop="attribute declaration"/> of each attribute use in the <propref comp="ctd" prop="attribute uses"/> whose
<propref comp="au" prop="required"/> is <pt>true</pt> matches one of the attribute information items in the element information item's &i-attributes; as per <clauseref ref="c-ctma"/> above.</p>
       </item>
       <item>
              <p>Let <termdef id="key-ida" term="wild IDs" role="local">the <term>wild
IDs</term> be the set of all
attribute information item to which <clauseref ref="c-avaw"/> applied and whose <termref def="key-vn">validation</termref> resulted in
a <termref def="key-dd">context-determined declaration</termref> of
<pt>mustFind</pt> or no <termref def="key-dd">context-determined
declaration</termref> at all, and whose <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 name</xpropref> resolve (as defined by <specref ref="cvc-resolve-instance"/>) to an attribute declaration whose <propref comp="ad" prop="type definition"/> is or is &constructedDiff; from <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref></termdef>. Then
               <olist role="and.ixm">
                <item>
                 <p>There &is.xm; no more than one item in <termref def="key-ida">wild IDs</termref>.</p>
                </item>
                <item>
                 <p>If <termref def="key-ida">wild IDs</termref> is
non-empty, there <phrase diff="del" dg="modals">&mustnot; be
any</phrase><phrase diff="add" dg="modals">are no</phrase> attribute
uses among the <propref comp="ctd" prop="attribute uses"/>
whose <propref comp="au" prop="attribute declaration"/>'s <propref comp="ad" prop="type definition"/> is or is &constructedDiff; from
<xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref>.</p>
                </item>
               </olist>
               <note>
                <p>This clause serves to ensure that even via attribute
wildcards no element has more than one attribute of type ID, and that even when
an element legitimately lacks a declared attribute of type ID, a
wildcard-validated attribute &mustnot; supply it.  That is, if an element has a
type whose attribute declarations include one of type ID, it either has that
attribute or no attribute of type ID.</p>
               </note>
              </p>
             </item>
      </olist>
     </p>
     <note>
      <p>When an <propref comp="ctd" prop="attribute wildcard"/> is present, this does
<emph>not</emph> introduce any ambiguity with respect to how attribute
information items for
which an attribute use is present amongst the <propref comp="ctd" prop="attribute uses"/> whose name and target namespace match are <termref def="key-va">assessed</termref>.  In such cases the attribute use <emph>always</emph> takes precedence, and the <termref def="key-va">assessment</termref> of such items stands or falls entirely on the basis of the attribute use and its <propref comp="au" prop="attribute declaration"/>.  This follows from the details of <clauseref ref="c-aam"/>.</p>
     </note>
    </constraintnote>
    </div3>
     <div3>
     <head>Complex Type Definition Information Set Contributions</head>
     <constraintnote type="sic" id="sic-attrDefault">
     <head>Attribute Default Value</head>
     <p>For each attribute use in the <propref comp="ctd" prop="attribute uses"/> whose
<propref comp="au" prop="required"/> is <pt>false</pt> and whose <propref comp="au" prop="value constraint"/> is not <termref def="key-null">absent</termref> but whose <propref comp="au" prop="attribute declaration"/> does not match one of the attribute information items in the element information item's &i-attributes; as per <clauseref ref="c-ctma"/> of <specref ref="cvc-complex-type"/> above, the &PSVI; has an attribute information item whose properties are as below added to the
&i-attributes; of the element information item.</p>
      <issue id="RQ-22i" role="1.1">
       <p><loc href="&reqs;#norm-default" target="reqs">RQ-22 (norm-default)</loc></p>
       <p>Constructed default attribute information items in the PSVI did not have a [normalized
value] property, only a [schema normalized value], making them incompatible
with ordinary attribute infoitems.  On balance, it seems sensible to correct this.</p>
       <resolution><p>Add a [normalized value] property to the constructed attribute infoitem which arises when a default value is applied.</p></resolution>
      </issue>
      <glist>
       <gitem>
        <label><xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">local name</xpropref></label>
        <def>
<p>The <propref comp="au" prop="attribute declaration"/>'s <propref comp="ad" prop="name"/>.</p>
        </def>
       </gitem>
       <gitem>
        <label><xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">namespace name</xpropref></label>
        <def>
<p>The <propref comp="au" prop="attribute declaration"/>'s <propref comp="ad" prop="target namespace"/>.</p>
        </def>
       </gitem>
       <gitem>
        <label><propref ref="a-schema_normalized_value" role="psvi"/></label>
        <def>
         <p>The <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical lexical representation</xtermref> of the <termref def="key-evc">effective value constraint</termref> value.</p>
        </def>
       </gitem>
       <gitem>
        <label><propref ref="a-schema_default" role="psvi"/></label>
        <def>
         <p>The <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical lexical representation</xtermref> of the <termref def="key-evc">effective value constraint</termref> value.</p>
        </def>
       </gitem>
       <gitem>
        <label><propref ref="a-validation_context" role="psvi"/></label>
        <def><p>The nearest ancestor element information item with a
<propref role="psvi" ref="e-schema_information"/> property.</p></def>
       </gitem>
       <gitem>
        <label><propref ref="a-validity" role="psvi"/></label>
        <def>
         <p><pt>valid</pt>.</p>
        </def>
       </gitem>
       <gitem>
        <label><propref ref="a-validation_attempted" role="psvi"/></label>
        <def><p><pt>full</pt>.</p></def>
       </gitem>
       <gitem>
        <label><propref ref="a-schema_specified" role="psvi"/></label>
        <def><p><pt>schema</pt>.</p></def>
       </gitem>
      </glist>
      <p>The added items 
&must.x.s; 
also either have <propref role="psvi" ref="a-type_definition"/> (and <propref role="psvi" ref="a-member_type_definition"/> if appropriate) properties, or their lighter-weight alternatives, as specified in <specref ref="sic-attrType"/>.</p>
    </constraintnote>
</div3>
 <div3 id="coss-ct">
  <head>Constraints on Complex Type Definition Schema Components</head>
  <p>All complex type definitions (see <specref ref="Complex_Type_Definitions"/>) &must; satisfy the following constraints.</p>
  <constraintnote type="cos" id="ct-props-correct">
   <head>Complex Type Definition Properties Correct</head>
   <olist role="And.mxm">
    <item>
     <p>The values of the properties of a complex type definition &are.xm; 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 comp="ctd" prop="base type definition"/> is a simple type
definition, the <propref comp="ctd" prop="derivation method"/> &is.xm; <pt>extension</pt>.</p>
    </item>
    <item><p><phrase diff="del" dg="modals">Circular definitions are disallowed, 
except for the <termref def="ur-type-itself">ur-type 
definition</termref></phrase><phrase diff="add" dg="modals">There are no circular 
definitions, except for that of <pt>rootType</pt></phrase>.  That is, it &is.xm; 
possible to reach the <phrase diff="del" dg="rq17"><termref def="ur-type-itself">ur-type 
definition</termref></phrase><phrase diff="add" dg="rq17">definition of 
<pt>rootType</pt></phrase> by repeatedly following the 
<propref comp="ctd" prop="base type definition"/>.</p></item>
    <item>
     <p><phrase diff="del" dg="modals">Two</phrase><phrase diff="add" dg="modals">No two</phrase> 
distinct attribute declarations in the 
<propref comp="ctd" prop="attribute uses"/> <phrase diff="del" dg="modals">&mustnot;</phrase> 
have identical <propref comp="ad" prop="name"/>s and 
<propref comp="ad" prop="target namespace"/>s.</p>
    </item>
    <item>
     <p><phrase diff="del" dg="modals">Two</phrase><phrase diff="add" dg="modals">No two</phrase> 
distinct attribute declarations in the <propref comp="ctd" prop="attribute uses"/> 
<phrase diff="del" dg="modals">&mustnot;</phrase> have 
<propref comp="ad" prop="type definition"/>s which are or are &constructedDiff; from 
<xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref>.</p>
    </item>
   </olist>
  </constraintnote>
  <constraintnote type="cos" id="cos-ct-extends">
     <head>&Derivation; Valid (Extension)</head>
     <p>If the <propref comp="ctd" prop="derivation method"/> is <pt>extension</pt>, 
      <olist role="case.mxm">
       <item>
        <p role="if">the <propref comp="ctd" prop="base type definition"/> is a complex type
definition</p>
        <p role="then">
         <olist role="and.ixm">
          <item>
           <p>The <propref comp="ctd" prop="final"/> of the <propref comp="ctd" prop="base type definition"/> &doesnot.xmn; contain <pt>extension</pt>.</p>
          </item>
          <item id="c-cte">
           <p>Its <propref comp="ctd" prop="attribute uses"/> &is.xm; a subset
of the <propref comp="ctd" prop="attribute uses"/> of the complex type
definition itself<phrase diff="del" dg="modals">, that is</phrase><phrase diff="add" dg="modals">.
That is</phrase>, for every attribute use in the
<propref comp="ctd" prop="attribute uses"/> of the
<propref comp="ctd" prop="base type definition"/>, 
there &is.xm; an attribute use in the 
<propref comp="ctd" prop="attribute uses"/> of the complex
type definition itself whose <propref comp="au" prop="attribute declaration"/> 
has the same <propref comp="ad" prop="name"/>,
<propref comp="ad" prop="target namespace"/> and
<propref comp="ad" prop="type definition"/> as its attribute declaration.</p>
          </item>
          <item>
           <p>If it has an <propref comp="ctd" prop="attribute wildcard"/>, 
<phrase diff="add" dg="modals">then</phrase> the complex type definition 
<phrase diff="del" dg="modals">&must; also 
have</phrase><phrase diff="add" dg="modals">also has</phrase>
one, and the base type definition's 
<propref comp="ctd" prop="attribute wildcard"/>'s 
<propref comp="w" prop="namespace constraint"/> &is.xm; 
a subset of the complex type definition's 
<propref comp="ctd" prop="attribute wildcard"/>'s 
<propref comp="w" prop="namespace constraint"/>, 
as defined by <specref ref="cos-ns-subset"/>.</p>
          </item>
          <item>
           <p>
            <olist role="Or.ixm">
             <item>
              <p>The <propref comp="ctd" prop="content type"/> of
the <propref comp="ctd" prop="base type definition"/> and the
<propref comp="ctd" prop="content type"/> of the complex type definition itself &are.xm; the
same simple type definition.</p>
             </item>
             <item><p>The
<propref comp="ctd" prop="content type"/> of both the <propref comp="ctd" prop="base type definition"/> and the complex type definition itself
&is.xm; <pt>empty</pt>.</p></item>
             <item>
              <olist role="And.ixm">
               <item>
                <p>The
<propref comp="ctd" prop="content type"/> of the complex type
definition itself <phrase diff="del" dg="modals">&must;
specify</phrase><phrase diff="add" dg="modals">specifies</phrase> a
particle.</p>
               </item>
               <item>
                <olist role="Or.ixm">
                 <item>
                  <p>The
<propref comp="ctd" prop="content type"/> of the <propref comp="ctd" prop="base type definition"/>
&is.xm; <pt>empty</pt>.</p>
                 </item>
                 <item>
                  <p>
                   <olist role="And.ixm">
                    <item>
                     <p>Both
<propref comp="ctd" prop="content type"/>s &are.xm; <pt>mixed</pt> or both &are.xm;
<pt>element-only</pt>.</p>
                    </item>
                    <item>
                     <p>The particle of the complex type
definition &is.xm; a <termref def="cd-model-extension">valid
extension</termref> of the <propref comp="ctd" prop="base type definition"/>'s particle,
as defined in <specref ref="cos-particle-extend"/>.</p>
                    </item>
                   </olist>
                  </p>
                  </item>
                </olist>
               </item>
              </olist>
             </item>
            </olist>
           </p>
           </item>
          <item>
           <p>It <phrase diff="del" dg="modals">&must; in principle 
be</phrase><phrase diff="add" dg="modals">is in principle</phrase> 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 comp="ctd" prop="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 role="if">the <propref comp="ctd" prop="base type definition"/> is a simple type
definition</p>
        <p role="then">
         <olist role="and.ixm">
         <item>
          <p>The <propref comp="ctd" prop="content type"/> &is.xm; the same simple type
definition.</p>
         </item>
         <item>
           <p>The <propref comp="std" prop="final"/> of the <propref comp="ctd" prop="base type definition"/> &doesnot.xmn; contain <pt>extension</pt>.</p>
          </item>
        </olist>
        </p>        
       </item>
      </olist>
      <termdef id="cd-ct-extension" term="valid extension">If this
constraint <specref ref="cos-ct-extends"/> holds of a complex type definition, it is a <term>valid
extension</term> of its <propref comp="ctd" prop="base type definition"/></termdef>.
     </p>
    </constraintnote>

<constraintnote type="cos" id="&derivation;-ok-restriction">
<head>&Derivation; Valid (Restriction, Complex)</head>
<p>If the <propref comp="ctd" prop="derivation method"/> is <pt>restriction</pt>
<olist role="and.mxm">
<item>
<!--* MSM begins a long campaign to eliminate places that seem to imply
    * modal logic must be used.  It suffices, here, that the base type
    * definition lack 'restriction' as an element of its final set.
    * It need not be logically necessary, factuality suffices. 
    *-->
<p>The <propref comp="ctd" prop="base type definition"/> 
<!--* !!! rq17 and modals both want this baby changed !!! *-->
<!--* !!! Since rq17 has already gone out, MSM changed 
    * the diff group to modals, so as to include it also
    * in the modals proposal.
    *-->
<phrase diff="del" dg="modals">&must; be</phrase><phrase diff="add" dg="modals">is</phrase> 
a complex type definition whose <propref comp="ctd" prop="final"/> does not 
contain <pt>restriction</pt>.</p>
</item>
<item id="c-rad" diff="del" dg="rq17">
<p>For each attribute use (call this <local>R</local>) in the <propref comp="ctd" prop="attribute uses"/>
<olist role="case.ixm">
<item>
<p role="if">there is an attribute use in the
<propref comp="ctd" prop="attribute uses"/> of the <propref comp="ctd" prop="base type definition"/> (call this <local>B</local>) whose <propref comp="au" prop="attribute declaration"/> has the same <propref comp="ad" prop="name"/> and <propref comp="ad" prop="target namespace"/></p>
<p role="then">
<olist role="and.ixm">
<item>
<p><olist role="or.ixm">
<item>
<p><local>B</local>'s <propref comp="au" prop="required"/> is <pt>false</pt>.</p>
</item>
<item>
<p><local>R</local>'s <propref comp="au" prop="required"/> is <pt>true</pt>.</p>
</item>
</olist></p>
</item>
<item>
<p><local>R</local>'s <propref comp="au" prop="attribute
declaration"/>'s <propref comp="ad" prop="type definition"/> &is.xm;
validly &derived; from <local>B</local>'s <propref comp="ad" prop="type definition"/> given the empty set as defined in
<specref ref="cos-st-&derived;-ok"/>.</p>
</item>
<item>
<p><termdef id="del-key-evc" term="effective base value constraint" role="local">Let the
<term>effective value constraint</term> of an attribute use be
its <propref comp="au" prop="value constraint"/>, if present, otherwise
its <propref comp="au" prop="attribute declaration"/>'s <propref comp="ad" prop="value constraint"/>
</termdef>.  Then <olist role="or.ixm">
<item>
<p><local>B</local>'s <termref def="key-evc">effective value
constraint</termref> is <termref def="key-null">absent</termref> or <pt>default</pt>.</p>
</item>
<item>
<p><local>R</local>'s <termref def="key-evc">effective value
constraint</termref> is
<pt>fixed</pt> with the same string as <local>B</local>'s.</p>
</item>
</olist>
</p>
</item>
</olist>
</p>
</item>
<item>
<p role="otherwise">the <propref comp="ctd" prop="base type
definition"/> <phrase diff="del" dg="modals">&must;
have</phrase><phrase diff="add" dg="modals">has</phrase> an <propref comp="ctd" prop="attribute wildcard"/> and the <propref comp="ad" prop="target namespace"/> of <phrase diff="del" dg="modals">the </phrase><local>R</local>'s <propref comp="au" prop="attribute declaration"/> &is.xm; <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 id="c-rad2" diff="del" dg="rq17">
<p>For each attribute use in the <propref comp="ctd" prop="attribute uses"/> of
the <propref comp="ctd" prop="base type definition"/> whose <propref comp="au" prop="required"/> is
<pt>true</pt>, there &is.xm; an attribute use with an <propref comp="au" prop="attribute declaration"/> with the same <propref comp="ad" prop="name"/> and <propref comp="ad" prop="target namespace"/> as its <propref comp="au" prop="attribute declaration"/> in the
<propref comp="ctd" prop="attribute uses"/> of the complex type definition
itself whose <propref comp="au" prop="required"/> is
<pt>true</pt>.</p>
</item>
<item id="c-raw" diff="del" dg="rq17">
<p>If there is an <propref comp="ctd" prop="attribute wildcard"/>, 
<olist role="and.ixm">
<item>
<p>The
<propref comp="ctd" prop="base type definition"/> 
<phrase diff="del" dg="modals">&must; also have</phrase><phrase diff="add" dg="modals">also
has</phrase> one.</p>
</item>
<item>
<p>The complex
type definition's <propref comp="ctd" prop="attribute wildcard"/>'s <propref comp="w" prop="namespace constraint"/> &is.xm; a subset of the <propref comp="ctd" prop="base type definition"/>'s <propref comp="ctd" prop="attribute wildcard"/>'s <propref comp="w" prop="namespace constraint"/>, as defined by <specref ref="cos-ns-subset"/>.</p>
</item>
<item>
<p>Unless the <propref comp="ctd" prop="base type definition"/> is the <termref def="ur-type-itself">ur-type definition</termref>, the complex
type definition's <propref comp="ctd" prop="attribute wildcard"/>'s <propref comp="w" prop="process contents"/> &is.xm; identical
to or stronger than the <propref comp="ctd" prop="base type definition"/>'s <propref comp="ctd" prop="attribute wildcard"/>'s <propref comp="w" prop="process contents"/>, where
<pt>strict</pt> is stronger than <pt>lax</pt> is stronger than <pt>skip</pt>.</p>
</item>
</olist>
</p>
</item>
<item diff="del" dg="rq17">
<olist role="Or.ixm">
<item>
<p>The <propref comp="ctd" prop="base type definition"/> &is.xm; the <termref def="ur-type-itself">ur-type definition</termref>.</p>
</item>
<item>
<olist role="And.ixm">
<item><p>The <propref comp="ctd" prop="content type"/> of the complex type definition
&is.xm; a simple type definition</p></item>
<item><olist role="Or.ixm">
<item>
<p>The <propref comp="ctd" prop="content type"/> of the <propref comp="ctd" prop="base type definition"/> &is.xm; a simple type
definition from which
the <propref comp="ctd" prop="content type"/> is  validly &derived; given the empty set as defined in
<specref ref="cos-st-&derived;-ok"/>.</p>
</item>
<item>
<p>The <propref comp="ctd" prop="base type definition"/> &is.xm; <pt>mixed</pt>
and <phrase diff="del" dg="modals">have</phrase><phrase diff="add" dg="modals">has</phrase> a particle which is <termref def="cd-emptiable">emptiable</termref> as defined in <specref ref="cos-group-emptiable"/>.</p>
</item>
</olist></item>
</olist>
</item>
<item>
<olist role="And.ixm">
<item><p>The <propref comp="ctd" prop="content type"/> of the complex type itself
&is.xm; <pt>empty</pt>
</p></item>
<item><olist role="Or.ixm">
<item>
<p>The <propref comp="ctd" prop="content type"/> of the <propref comp="ctd" prop="base type definition"/> <phrase diff="del" dg="modals">&must; 
also be</phrase><phrase diff="add" dg="modals">is also</phrase>
<pt>empty</pt>.</p>
</item>
<item>
<p>The <propref comp="ctd" prop="content type"/> of the <propref comp="ctd" prop="base type definition"/> &is.xm; <pt>elementOnly</pt>
or <pt>mixed</pt> and 
<phrase diff="del" dg="modals">have</phrase><phrase diff="add" dg="modals">has</phrase> 
a particle which is <termref def="cd-emptiable">emptiable</termref> as defined in <specref ref="cos-group-emptiable"/>.</p>
</item>
</olist></item>
</olist>
</item>
<item>
<olist role="And.ixm">
<item>

<olist role="Or.ixm">
<item><p>The <propref comp="ctd" prop="content type"/> of the complex type
definition itself &is.xm; <pt>element-only</pt></p></item>
<item><p>The <propref comp="ctd" prop="content type"/> of the complex
type definition itself and of the
<propref comp="ctd" prop="base type definition"/> &is.xm; <pt>mixed</pt></p></item>

</olist></item>
<item><p>The particle of the complex type definition itself
&is.xm; a <termref def="cd-model-restriction">valid restriction</termref> of the particle of the <propref comp="ctd" prop="content type"/> of the <propref comp="ctd" prop="base type definition"/> as defined in <specref ref="cos-particle-restrict"/>.</p></item>
</olist>
</item>         
</olist>
<note>
<p>Attempts to &derive; complex type definitions whose <propref comp="ctd" prop="content type"/> is <pt>element-only</pt> by restricting
a <propref comp="ctd" prop="base type definition"/> whose <propref comp="ctd" prop="content type"/>
is <pt>empty</pt> are not ruled out by this clause.  However if the complex
type definition itself has a non-pointless particle it will fail to satisfy
<specref ref="cos-particle-restrict"/>.  On the other hand some type
definitions with pointless <pt>element-only</pt> content, for example an empty
<eltref ref="sequence"/>, will satisfy <specref ref="cos-particle-restrict"/>
with respect to an <pt>empty</pt> <propref comp="ctd" prop="base type definition"/>, and
so be valid restrictions.</p>
</note>
</item>
<item diff="add" dg="rq17"><p>The complex type definition
<termref def="cd-actual-restriction">actually restricts</termref> 
the <propref comp="ctd" prop="base type definition"/> as 
defined in <specref ref="cos-ct-restrict"/>.</p></item>
</olist>
<termdef id="del-cd-ct-restriction" term="valid restriction" diff="del" dg="rq17">
If this constraint <specref ref="&derivation;-ok-restriction"/> holds of a
complex type definition, it is a <term>valid restriction</term> of its
<propref comp="ctd" prop="base type definition"/></termdef>
<termdef id="cd-ct-restriction" term="valid restriction" diff="add" dg="rq17">
A complex type definition with <propref comp="ctd" prop="derivation method"/> 
<pt>restriction</pt> is a <term>valid restriction</term> of its
<propref comp="ctd" prop="base type definition"/> if and only if the
constraint <specref ref="&derivation;-ok-restriction"/> is satisfied</termdef>.
</p>
<!--* The added condition 'with {derivation method{ restriction' seems 
    * to be required to avoid extensions, for which the constraint 
    * vacuously holds, being valid restrictions of their base. 
    *-->
</constraintnote>

<note diff="add" dg="rq17">
  <p>In <xspecref href="http://www.w3.org/TR/xmlschema-1/#key-typeRestriction">the 
definition of <phrase role="local">restriction</phrase> in version 1.0 of this
specification</xspecref>, it says
   <display><quote>Members of a type, A, whose definition is a restriction of
the definition of another type, B, are always members of type B as well.</quote></display>
   However no definition of membership in a type was provided, and this
statement accordingly lacked force.  We can now restate the intended sense of
'restriction' as follows:</p>
</note>

<p diff="add" dg="rq17">A type definition <local>R</local> is a
valid
<termref def="key-typeRestriction">restriction</termref> of another
type definition <local>B</local> if and only if:
<olist role="and.mxm">
<item><p>All element information items which are 
<termref def="dt-avalid">abstractly valid</termref> against
<local>R</local> are <termref def="dt-avalid">abstractly valid</termref> 
against <local>B</local>.</p></item>
<item><p>When type definitions are assigned to children or attributes
of an element information item in the PSVI by both <local>R</local>
and <local>B</local>, those assigned by <local>R</local> are identical
to or derived by one or more restriction or subsetting steps from the corresponding 
ones assigned by <local>B</local>.</p></item>
<item><p>When element declarations are assigned to children or
attributes of an element information item in the PSVI by both
<local>R</local> and <local>B</local>, the corresponding ones assigned
by <local>R</local> appeal to at least the same identity
constraints, value constraints and disallowed substitutions as
those assigned by <local>B</local>, and may appeal to stronger 
ones.</p>
</item>
<item><p>Either <local>B</local> is the base type definition
of <local>R</local>, or else the base type definition of <local>R</local>
is a restriction of <local>B</local>.</p></item>
</olist></p>

<note diff="add" dg="rq17">
<p>It will be noted that valid restriction involves both a subset
relation on the set of elements valid against <local>R</local> and
those valid against <local>B</local>, and an derivation relation,
explicit in the type hierarchy, between the types assigned to
attributes and child elements by <local>R</local> and those assigned
to the same attributes and children by <local>B</local>.</p>
</note>

<!--* <ednote diff="add" dg="rq17">
<edtext>The term <quote>in-principle valid</quote> (used in text
briefly discussed by the WG in Brisbane) has been replaced above with
<quote>abstractly valid</quote>.  The WG 
may wish to express a preference for one term or the other (or for some
third term); the editors have not achieved consensus (or, for that 
matter, conviction).</edtext>
</ednote> *-->


<!--* HST is very uneasy with this definition, as it only works if the
	  assessment rules _require_ you to carry on with recursive
	  assessment after finding an error, but they don't -->
<!--* Touch&eacute;.  I still don't like the subjunctive, but 
    * it's currently the best we've got.
    *-->
<p diff="add" dg="rq17">
<termdef id="dt-avalid" term="abstractly valid">An attribute or 
element information item <local>I</local> is <term>abstractly valid</term>
with respect to a simple or complex type definition <local>D</local>
if and only if schema-validity assessment of <local>I</local> with
respect to <local>D</local> (as defined by <specref ref="cvc-assess-elt"/>
or <specref ref="cvc-assess-attr"/>) either results in a 
<xpropref role="psviAnon">validity</xpropref> property of <pt>valid</pt>, or 
would result in <xpropref role="psviAnon">validity</xpropref> of <pt>valid</pt>
if constraints on the abstractness of type definitions and element 
declarations were ignored</termdef>.</p>
<!--* 
results in errors raised by violations of constraints on the 
abstractness of type definitions, element declarations, or
attribute declarations, but no other errors.</termdef></p>
*-->

<!--* MSM is uneasy with the word 'actually' here, since it seems to 
    * want the constraint to be one that forbids vacuous restriction.
    * hmmm.
    *-->
<!--*   <p diff="add" dg="rq17">In practice the above definition cannot 
be directly understood as a Constraint on Components.  The following 
constraint is the operationally normative statement.</p> *-->

<!-- HST is not at all happy with an appeal to empty types as the
	  basis for including 'actually restricts'.  It has the same
	  'problem', so arguing that we use it to avoid the 'problem'
	  makes no sense.  About that which we can say nothing,
	  thereof we should remain silent. -->
<!--
For a variety of reasons, the description of
restriction just given is not suitable as a Constraint on Components.
In particular, if no elements at all are valid with respect to a type
<local>R</local>, then <local>R</local> satisfies the first constraint
for <emph>any possible</emph> base type <local>B</local>. It is not
necessarily easy, however, to detect type definitions which accept no
elements, however, and so the following constraint is the
operationally normative statement of valid restriction.-->

<p diff="add" dg="rq17">In practice, it is difficult to enforce
the definition above directly as a Constraint on Components, owing
to a number of corner cases which are difficult to detect or describe
concisely.
The following constraint is the operationally normative statement.</p> 

  <constraintnote id="cos-ct-restrict" type="cos" diff="add" dg="rq17">
   <head>Complex type definition actually restricts</head>
   <p><termdef id="cd-actual-restriction" term="actually restricts">A
complex type definition <local>R</local> (for <quote>restriction</quote>)
<term>actually
restricts</term> another type definition <local>B</local> (for
<quote>base</quote>) if and only if</termdef>
    <olist role="andtest">
     <item><p>Every element information item which is 
<termref def="loc-locallyValid">locally valid</termref> 
with respect to <local>R</local> is also 
<termref def="loc-locallyValid">locally valid</termref> 
with respect to <local>B</local>.</p></item>
     <item><p>If <local>R</local> and <local>B</local> have
<pt>elementOnly</pt> or <pt>mixed</pt> <propref comp="ctd" prop="content type"/>s, for all element information items <local>E</local> which are 
<termref def="loc-locallyValid">locally valid</termref> 
with respect to <local>R</local>, for all
        children <local>C</local> of <local>E</local>,
            <olist role="ortest">
             <item><p><local>Test[E,PR]</local> is not defined for <local>C</local>.</p></item>
             <item><olist role="andtest">
<item><p><local>Test[E,PB]</local> and <local>Test[E,PR]</local> are both defined for <local>C</local></p></item>
             <item><p><local>Test[E,PB]</local>(<local>C</local>) subsumes <local>Test[E,PR]</local>(<local>C</local>).</p></item>
</olist></item>             
            </olist>where <local>PR</local> is <local>R</local>'s <propref comp="ctd" prop="content type"/> Particle and <local>PB</local> is <local>B</local>'s <propref comp="ctd" prop="content type"/> Particle.
</p></item>
    </olist>
   </p>
   <p><termdef role="local" id="loc-locallyValid" term="locally valid">An 
element information item is <term>locally valid</term> with respect 
to a complex type definition if and only if it satisfies all but the last
clause of
<specref ref="cvc-complex-type"/> with respect to that definition</termdef>.</p>

<!--* 
   <p><termdef role="local" id="loc-locallyValid" term="abstractly locally valid">An 
element information item is <term>abstractly locally valid</term> with respect 
to a complex type definition if and only if it satisfies clauses 2, 3 and 4 of 
<specref ref="cvc-complex-type"/> with respect to that definition</termdef>.</p>
*-->
<!--* MSM is not happy with the wording of the following, but does not
    * have the energy to try to rewrite it now.  
    *-->
   <p>When the child sequence of an element information item <local>E</local> is 
<termref def="loc-locallyValid">locally valid</termref>
   against a type definition with 
<propref comp="ctd" prop="content type"/> Particle <local>P</local> 
there is a (partial) functional mapping from
the element information items in the child sequence to tests, where tests
are either Element
   Declarations, <termref def="key-urType">the ur-type</termref> or
<pt>empty</pt>, arising as follows:
    <glist>
     <gitem>
      <label>Element Declarations</label>
      <def>
       <p>Either explicitly present, or successfully located as a result of a
<pt>strict</pt> or <pt>lax</pt> Wildcard.</p>
      </def>
     </gitem>
     <gitem>
      <label><termref def="key-urType">the ur-type</termref></label>
      <def>
       <p>An undischarged <pt>lax</pt> Wildcard.</p>
      </def>
     </gitem>
     <gitem>
      <label><pt>empty</pt></label>
      <def>
       <p>a <pt>skip</pt> Wildcard.</p>
      </def>
     </gitem>
     <gitem>
      <label>(failure to map)</label>
      <def>
       <p>An undischarged <pt>strict</pt> Wildcard.</p>
      </def>
     </gitem>
    </glist>
    <termdef role="local" id="loc-Test" term="Test">Call this mapping <term>Test[E,P]</term>.</termdef></p>
   <p><termdef role="local" id="loc-testSub" term="subsumes">A test
<local>G</local> (for general) <term>subsumes</term> another test
<local>S</local> (for specific) if and only if </termdef>
    <olist role="ortest">
     <item>
      <p><local>G</local> is <pt>empty</pt>.</p>
     </item>
     <item>
      <p><local>G</local> is <termref def="key-urType">the ur-type</termref>
and <local>S</local> is not <pt>empty</pt>.</p>
     </item>
     <item>
      <p><local>G</local> and <local>S</local> are both Element Declarations
and
       <olist role="andtest">
        <item>
         <p>Either <local>G</local> has <propref comp="ed" prop="nillable"/> <pt>true</pt> or <local>S</local> has <propref comp="ed" prop="nillable"/> <pt>false</pt>.</p>
        </item>
        <item>
         <p>Either <local>G</local> has no <propref comp="ed" prop="value constraint"/>, or it is not <pt>fixed</pt>,
      or <local>S</local> has a <pt>fixed</pt> <propref comp="ed" prop="value constraint"/> with the same value.</p>
        </item>
        <item>
         <p><local>S</local>'s <propref comp="ed" prop="&constraint; definitions"/> are a superset of <local>G</local>'s.</p>
        </item>
        <item>
         <p><local>S</local> disallows a superset of the substitutions that <local>G</local> does.</p>
        </item>
        <item>
         <p><local>S</local>'s <propref comp="ed" prop="type definition"/> is validly &derived; given
{<pt>extension</pt>, <pt>list</pt>, <pt>union</pt>} from <local>G</local>'s <propref comp="ed" prop="type definition"/> as defined by
<specref ref="cos-ct-&derived;-ok"/> or <specref ref="cos-st-&derived;-ok"/>, as appropriate.</p>
        </item>
       </olist>
      </p>
     </item>
    </olist>
   </p>
   <note>
    <p><specref ref="subsumptionCheck"/> provides guidance to
implementors on how to implement this constraint.</p>
   </note>
  </constraintnote>

<!--* <ednote diff="add" dg="rq17">
<edtext>The editors have not found a term better than <quote>actually
restrict</quote> for use in the definition just given, but have not
yet learned to believe that there is none.  If the WG has suggestions,
the editors would be glad to hear a plausible alternative.</edtext>
</ednote> *-->

  <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>

<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>For a complex type definition (call it <local>D</local>, for
&derived;) to be validly &derived; from a type definition (call this
<local>B</local>, for base) given a subset of {<pt>extension</pt>,
<pt>restriction</pt>}
<olist role="and.mxm">
<item>
<p>If <local>B</local> and <local>D</local> are not the same type
definition, then the <propref comp="ctd" prop="derivation method"/> of
<local>D</local> &isnot.xmnb;
in the subset.</p>
</item>
<item>      
<p>
<olist role="Or.ixm">
<item id="c-tid">
<p><local>B</local> and <local>D</local> &are.xm; the same type
definition.</p>
</item>
<item>
<p><local>B</local> &is.xm; <local>D</local>'s <propref comp="ctd" prop="base type definition"/>.</p>
</item>
<item>
<p>
<olist role="And.ixm">
<item>
<p><local>D</local>'s <propref comp="ctd" prop="base type
definition"/> &isnot.xmnb; the <termref def="ur-type-itself">ur-type
definition</termref>.</p>
</item>
<item>
<p>
<olist role="Case.ixm">
<item>
<p role="if"><local>D</local>'s <propref comp="ctd" prop="base type
definition"/> is complex</p>
<p role="then">it &is.xm; validly &derived; from <local>B</local>
given the subset as defined by this constraint.</p>
</item>
<item>
<p role="if"><local>D</local>'s <propref comp="ctd" prop="base type
definition"/> is simple</p>
<p role="then">it &is.xm; validly &derived; from <local>B</local>
given the subset as defined in <specref ref="cos-st-&derived;-ok"/>.</p>
</item>
</olist>
</p>
</item>
</olist>
</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>
  <note id="no-identity">
   <p>The wording of <clauseref ref="c-tid"/> above appeals to a notion of component identity which
is only incompletely defined by this version of this specification.
In some cases, the wording of this specification does make clear the
rules for component identity.  These cases include:
    <ulist>
     <item>
      <p>When they are both top-level components with the same component type,
namespace name, and local name;</p>
     </item>
     <item>
      <p>When they are necessarily the same type definition (for example, when
the two types definitions in question are the type definitions associated with
two attribute or element declarations, which are discovered to be the same
declaration);</p>
     </item>
     <item>
      <p>When they are the same by construction (for example, when an element's
type definition defaults to being the same type definition as that of its
substitution-group head or when a complex type definition inherits an attribute
declaration from its base type definition).</p>
     </item>
    </ulist>
   </p>
   <p>In other cases <phrase diff="del" dg="ep08a">two</phrase> 
<phrase diff="add" dg="modals">it is possible
that</phrase> conforming implementations <phrase diff="del" dg="modals">may</phrase><phrase diff="add" dg="modals">will</phrase>
disagree as to whether components are identical.</p>
  </note>
 </div3>
    <div3>
     <head>Built-in Complex Type <phrase diff="del" dg="rq17">Definition</phrase><phrase diff="add" dg="rq17">Definitions</phrase></head>
     <p diff="add" dg="rq17">There is a <compref ref="ctd"/> corresponding to the root of the type
hierarchy present in every schema by definition:</p>
     <schemaComp id="ur-type-itself" diff="add" dg="rq17">
     <head>Complex Type Definition of the root of the type hierarchy (the ur-type)</head>
     <pvlist>
      <pvpair comp="ctd" prop="name">rootType</pvpair>
      <pvpair comp="ctd" prop="target namespace">http://www.w3.org/2001/XMLSchema</pvpair>
      <pvpair comp="ctd" prop="base type definition">Itself</pvpair>
      <pvpair comp="ctd" prop="&derivation; method"><pt>restriction</pt></pvpair>
      <pvpair comp="ctd" prop="content type">A pair consisting of <pt>mixed</pt> and a
particle with the following properties: 
       <pvlist>
        <pvpair comp="p" prop="min occurs">1</pvpair>
        <pvpair comp="p" prop="max occurs">1</pvpair>
        <pvpair comp="p" prop="term">a model group with
the following properties:
         <pvlist>
          <pvpair comp="mg" prop="compositor"><pt>sequence</pt></pvpair>
          <pvpair comp="mg" prop="particles">
           a list containing one particle with the following properties:
           <pvlist>
            <pvpair comp="p" prop="min occurs">0</pvpair>
            <pvpair comp="p" prop="max occurs"><pt>unbounded</pt></pvpair>
            <pvpair comp="p" prop="term">a wildcard with the following properties:
             <pvlist>
              <pvpair comp="w" prop="namespace constraint"><pt>any</pt></pvpair>
              <pvpair comp="w" prop="process contents"><pt>skip</pt></pvpair>
             </pvlist>
            </pvpair>
           </pvlist>
           </pvpair>
         </pvlist>
        </pvpair>
       </pvlist>
      </pvpair>
      <pvpair comp="ctd" prop="attribute uses">The empty set</pvpair>
        <pvpair comp="ctd" prop="attribute wildcard">
        a wildcard with the following properties::
             <pvlist>
              <pvpair comp="w" prop="namespace constraint"><pt>any</pt></pvpair>
              <pvpair comp="w" prop="process contents"><pt>skip</pt></pvpair>
             </pvlist></pvpair>
        <pvpair comp="ctd" prop="final">The empty set</pvpair>
        <pvpair comp="ctd" prop="prohibited substitutions">The empty set</pvpair>
        <pvpair comp="ctd" prop="abstract"><pt>false</pt></pvpair>
     </pvlist>
    </schemaComp>
    <p diff="add" dg="rq17">The <code>mixed</code> content specification together with the
<pt>skip</pt> wildcard  and attribute specification produce the defining
property for the root of the type hierarchy, namely that <emph>every</emph>  type
definition is (eventually) a restriction
of it:  its permissions and requirements are
the least restrictive possible.</p>
    <p>There is <phrase diff="add" dg="rq17">also </phrase>a complex type
definition <phrase diff="del" dg="rq17">nearly equivalent to the <termref def="key-urType">ur-type definition</termref></phrase><phrase diff="add" dg="rq17">for <termref def="key-anyType">anyType</termref></phrase> present in every
schema by definition.  It has the following properties:</p>
<!--* WARNING!!! The following schema-component definition occurs twice
    * in order to avoid IDREF validity problems when generating status quo text
    * without RQ-17.  If you edit, be sure you edit the right one!
    * N.B. After RQ-17 is adopted, we may wish to suppress the older
    * version. *-->
<!--* Edit this copy with id=any-type-itself if you are working in 
    * a world where RQ17 is adopted *-->
    <schemaComp id="any-type-itself" diff="add" dg="rq17">
     <head>Complex Type Definition of anyType</head>
     <pvlist>
      <pvpair comp="ctd" prop="name">anyType</pvpair>
      <pvpair comp="ctd" prop="target namespace">http://www.w3.org/2001/XMLSchema</pvpair>
      <pvpair comp="ctd" prop="base type definition">The built-in <termref def="ur-type-itself">root type definition</termref></pvpair>
      <pvpair comp="ctd" prop="&derivation; method"><pt>restriction</pt></pvpair>
      <pvpair comp="ctd" prop="content type">A pair consisting of <pt>mixed</pt> and a
particle with the following properties: 
       <pvlist>
        <pvpair comp="p" prop="min occurs">1</pvpair>
        <pvpair comp="p" prop="max occurs">1</pvpair>
        <pvpair comp="p" prop="term">a model group with
the following properties:
         <pvlist>
          <pvpair comp="mg" prop="compositor"><pt>sequence</pt></pvpair>
          <pvpair comp="mg" prop="particles">
           a list containing one particle with the following properties:
           <pvlist>
            <pvpair comp="p" prop="min occurs">0</pvpair>
            <pvpair comp="p" prop="max occurs"><pt>unbounded</pt></pvpair>
            <pvpair comp="p" prop="term">a wildcard with the following properties:
             <pvlist>
              <pvpair comp="w" prop="namespace constraint"><pt>any</pt></pvpair>
              <pvpair comp="w" prop="process contents"><pt>lax</pt></pvpair>
             </pvlist>
            </pvpair>
           </pvlist>
           </pvpair>
         </pvlist>
        </pvpair>
       </pvlist>
      </pvpair>
      <pvpair comp="ctd" prop="attribute uses">The empty set</pvpair>
        <pvpair comp="ctd" prop="attribute wildcard">
        a wildcard with the following properties::
             <pvlist>
              <pvpair comp="w" prop="namespace constraint"><pt>any</pt></pvpair>
              <pvpair comp="w" prop="process contents"><pt>lax</pt></pvpair>
             </pvlist></pvpair>
        <pvpair comp="ctd" prop="final">The empty set</pvpair>
        <pvpair comp="ctd" prop="prohibited substitutions">The empty set</pvpair>
        <pvpair comp="ctd" prop="abstract"><pt>false</pt></pvpair>
     </pvlist>
    </schemaComp>
<!--* Edit this copy with del-ur-type-itself if you are working in a world 
    * where RQ17 has been rejected *-->
    <schemaComp id="del-ur-type-itself" diff="del" dg="rq17aux">
     <head>Complex Type Definition of anyType</head>
     <pvlist>
      <pvpair comp="ctd" prop="name">anyType</pvpair>
      <pvpair comp="ctd" prop="target namespace">http://www.w3.org/2001/XMLSchema</pvpair>
      <pvpair comp="ctd" prop="base type definition">The built-in <termref def="ur-type-itself">root type definition</termref></pvpair>
      <pvpair comp="ctd" prop="&derivation; method"><pt>restriction</pt></pvpair>
      <pvpair comp="ctd" prop="content type">A pair consisting of <pt>mixed</pt> and a
particle with the following properties: 
       <pvlist>
        <pvpair comp="p" prop="min occurs">1</pvpair>
        <pvpair comp="p" prop="max occurs">1</pvpair>
        <pvpair comp="p" prop="term">a model group with
the following properties:
         <pvlist>
          <pvpair comp="mg" prop="compositor"><pt>sequence</pt></pvpair>
          <pvpair comp="mg" prop="particles">
           a list containing one particle with the following properties:
           <pvlist>
            <pvpair comp="p" prop="min occurs">0</pvpair>
            <pvpair comp="p" prop="max occurs"><pt>unbounded</pt></pvpair>
            <pvpair comp="p" prop="term">a wildcard with the following properties:
             <pvlist>
              <pvpair comp="w" prop="namespace constraint"><pt>any</pt></pvpair>
              <pvpair comp="w" prop="process contents"><pt>lax</pt></pvpair>
             </pvlist>
            </pvpair>
           </pvlist>
           </pvpair>
         </pvlist>
        </pvpair>
       </pvlist>
      </pvpair>
      <pvpair comp="ctd" prop="attribute uses">The empty set</pvpair>
        <pvpair comp="ctd" prop="attribute wildcard">
        a wildcard with the following properties::
             <pvlist>
              <pvpair comp="w" prop="namespace constraint"><pt>any</pt></pvpair>
              <pvpair comp="w" prop="process contents"><pt>lax</pt></pvpair>
             </pvlist></pvpair>
        <pvpair comp="ctd" prop="final">The empty set</pvpair>
        <pvpair comp="ctd" prop="prohibited substitutions">The empty set</pvpair>
        <pvpair comp="ctd" prop="abstract"><pt>false</pt></pvpair>
     </pvlist>
    </schemaComp>
     <note><p>This specification does not provide an inventory of built-in complex
type definitions for use in user schemas.  A preliminary library of complex type
definitions is available which includes both mathematical (e.g.
<code>rational</code>) and utility (e.g. <code>array</code>) type definitions. 
In particular, there is a <code>text</code> type definition which is recommended for use
as the type definition in element declarations intended for general text
content, as it makes sensible provision for various aspects of
internationalization.  For more details, see the schema document for the type
library at its namespace name: <loc href="http://www.w3.org/2001/03/XMLSchema/TypeLibrary.xsd">http://www.w3.org/2001/03/XMLSchema/TypeLibrary.xsd</loc>.</p></note>
    </div3>
   </div2>
   <div2 id="cAttributeUse">
    <head>AttributeUses</head>
    <p>An attribute use is a utility component which controls the occurrence and
defaulting behavior of attribute declarations.  It plays the same role for
attribute declarations in complex types that particles play for element declarations.</p>
    <note role="example">
     <eg xml:space="preserve"><![CDATA[<xs:complexType>
 . . .
 <xs:attribute ref="xml:lang" use="required"/>
 <xs:attribute ref="xml:space" default="preserve"/>
 <xs:attribute name="version" type="xs:number" fixed="1.0"/>
</xs:complexType>]]>
     </eg>
     <p>XML representations which all involve attribute uses, illustrating some of
the possibilities for controlling occurrence.</p>
    </note>
    <div3 id="AU_details">
     <head>The Attribute Use Schema Component</head>
<p>The attribute use schema component has the following properties:</p>

  <compdef name="Attribute Use" abbrev="au"/>
     <p><propref comp="au" prop="required"/> determines whether this use of an attribute
declaration requires an appropriate attribute information item to be present, or
merely allows it.</p>
     <p><propref comp="au" prop="attribute declaration"/> provides the attribute declaration itself,
which will in turn determine the simple type definition used.</p>
     <p><propref comp="au" prop="value constraint"/> allows for local specification of a
default or fixed value.  This &must; be consistent with that of the <propref comp="au" prop="attribute declaration"/>, in that if the <propref comp="au" prop="attribute declaration"/> specifies a fixed value, the only allowed <propref comp="au" prop="value constraint"/> is the same fixed value.</p>
    </div3>
    <div3>
     <head>XML Representation of Attribute Use Components</head>
     <p>Attribute uses correspond to all uses of <eltref ref="attribute"/> which
allow a <code>use</code> attribute.  These in turn correspond to
<emph>two</emph> components in each case, an attribute use and its <propref comp="au" prop="attribute declaration"/> (although note the latter is not new when the attribute use is a reference to a top-level attribute declaration).  The appropriate mapping is described in <specref ref="declare-attribute"/>.</p>
    </div3>
    <div3>
     <head>Constraints on XML Representations of Attribute Uses</head>
     <p>None as such.</p>
    </div3>
    <div3>
     <head>Attribute Use Validation Rules</head>
<constraintnote type="cvc" id="cvc-au">
 <head>Attribute Locally Valid (Use)</head>
 <p>For an attribute information item to be<termref def="key-vn">valid</termref> with respect to an attribute use its &i-value;  &must; match the <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-canonical-representation">canonical lexical representation</xtermref> of the attribute use's <propref comp="au" prop="value constraint"/> value, if it is present and 
  <pt>fixed</pt>.</p>
</constraintnote>
    </div3>
    <div3>
     <head>Attribute Use Information Set Contributions</head>
     <p>None as such.</p>
    </div3>
    <div3 id="coss-attruse">
     <head>Constraints on Attribute Use Schema Components</head>
  <p>All attribute uses (see <specref ref="cAttributeUse"/>) &must; satisfy the following constraints.</p>
<constraintnote type="cos" id="au-props-correct">
<head>Attribute Use Correct</head>
<olist role="And.mxm">
<item>
<p>The values of the properties of an attribute use &are.xm; as
described in the property tableau in
<specref ref="AU_details"/>, modulo the impact of <specref ref="conformance-missing"/>.</p>
</item>
<item>
<p>If the <propref comp="au" prop="attribute declaration"/> has a
<pt>fixed</pt> <propref comp="ad" prop="value constraint"/><phrase diff="del" dg="modals">, 
then if</phrase><phrase diff="add" dg="modals">and</phrase>
the attribute use itself has a <propref comp="au" prop="value
constraint"/>, <phrase diff="del" dg="modals">it &must; also 
be</phrase><phrase diff="add" dg="modals">then the 
<propref comp="au" prop="value constraint"/> on the attribute
use is also</phrase>
<pt>fixed</pt> and its value <phrase diff="del" dg="modals">&must;
match</phrase><phrase diff="add" dg="modals">matches</phrase> that 
of the <propref comp="au" prop="attribute declaration"/>'s
<propref comp="ad" prop="value constraint"/>.</p>
</item>
</olist>
</constraintnote> 
    </div3>
   </div2>
   <div2 id="cAttribute_Group_Definitions">
    <head>Attribute Group Definitions</head>
<p>A schema can name a group of attribute declarations so that they &can.xm; 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 comp="ctd" prop="attribute uses"/> and <propref comp="ctd" prop="attribute wildcard"/> of one or
more complex type definitions &may.xm; 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 XML
representation of schema components
(see <eltref ref="complexType"/> and <eltref ref="attributeGroup" inside="simpleContent"/>).
</p>
    <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>XML representations for attribute group definitions. The effect is as if the attribute
declarations in the group were present in the type definition.</p>
</note>
    <div3 id="Attribute_Group_Definition_details">
     <head>The Attribute Group Definition Schema Component</head>
    <p>The attribute group definition schema component has the
following properties:</p>

  <compdef name="Attribute Group Definition" abbrev="agd"/>

  <p>Attribute groups are identified by their <propref comp="agd" prop="name"/> and <propref comp="agd" prop="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 comp="agd" prop="attribute uses"/> is a set attribute uses, allowing
for local specification of occurrence and default or fixed values.</p>
<p><propref comp="agd" prop="attribute wildcard"/> provides for an attribute wildcard to be included in an
attribute group.
See above under <specref ref="Complex_Type_Definitions"/> for the
interpretation of
attribute wildcards during <termref def="key-vn">validation</termref>.</p>
     <p>See <specref ref="cAnnotations"/> for information on the role of the
<propref comp="agd" prop="annotations"/> property.</p>
    </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 comp="agd" prop="name">The &v-value; of the <code>name</code> &i-attribute;</propmap>
  <propmap comp="agd" prop="target namespace">The &v-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <code>schema</code>
element information item.</propmap>
  <propmap comp="agd" prop="attribute uses">The union of the set of attribute uses corresponding to the <eltref ref="attribute"/> &i-children;, if any, with the <propref comp="agd" prop="attribute uses"/> of the
attribute groups <termref def="src-resolve">resolved</termref> to by the &v-value;s of the <code>ref</code>
&i-attribute; of the <eltref ref="attributeGroup" inside="simpleContent"/> &i-children;, if any.</propmap>
<propmap comp="agd" prop="attribute wildcard">As for the <termref def="key-eaw">complete wildcard</termref> as described in <specref ref="declare-type"/>.</propmap>
<propmap comp="agd" prop="annotations">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 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>
 </div3>
    <div3>
     <head>Constraints on XML Representations of Attribute Group Definitions</head>
<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,
<olist role="and.apply.xm">
<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 <clauseref ref="c-awi1"/> or <clauseref ref="c-awi2"/> in the
correspondence specification in <specref ref="declare-type"/> for
<propref comp="ctd" prop="attribute wildcard"/>, as referenced above,
is satisfied, 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 &mustnot; be an <eltref ref="attributeGroup" inside="simpleContent"/> with <code>ref</code>
&i-attribute; which resolves to the component corresponding to this
<eltref ref="attributeGroup"/>.  Indirect circularity is also ruled
out.  That is, when  <specref ref="src-resolve"/> is applied to a
<termref def="gloss-QName">QName</termref> arising from any <eltref ref="attributeGroup" inside="simpleContent"/>s with a <code>ref</code>
&i-attribute; among the &i-children;, it &mustnot; be the case that a
<termref def="gloss-QName">QName</termref> is encountered at any depth
which resolves to the component corresponding to this <eltref ref="attributeGroup"/>.</p>
</item>
</olist>
</p>
</constraintnote>
    </div3>
    <div3>
     <head>Attribute Group Definition Validation Rules</head>
     <p>None as such.</p>
    </div3>
    <div3>
     <head>Attribute Group Definition Information Set
Contributions</head>
     <p>None as such.</p>
    </div3>
    <div3 id="coss-attrGroup">
     <head>Constraints on Attribute Group Definition Schema Components</head>
<p>All attribute group definitions (see <specref ref="cAttribute_Group_Definitions"/>) &must; satisfy the following constraint.</p>
<constraintnote type="cos" id="ag-props-correct">
<head>Attribute Group Definition Properties Correct</head>
<olist role="And.mxm">
<item>
<p>The values of the properties of an attribute group definition
&are.xm; 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><phrase diff="del" dg="modals">Two</phrase><phrase diff="add" dg="modals">No two</phrase> distinct members of the <propref comp="agd" prop="attribute
uses"/> <phrase diff="del" dg="modals">&mustnot;</phrase> have
<propref comp="au" prop="attribute declaration"/>s both of whose
<propref comp="ad" prop="name"/>s match and whose <propref comp="ad" prop="target namespace"/>s are identical.</p>
</item>
<item>
<p><phrase diff="del" dg="modals">Two</phrase><phrase diff="add" dg="modals">No two</phrase> 
distinct members of the <propref comp="agd" prop="attribute uses"/> 
<phrase diff="del" dg="modals">&mustnot;</phrase> have <propref comp="au" prop="attribute
declaration"/>s both of whose <propref comp="ad" prop="type definition"/>s are or are
&constructedDiff; from <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref>.</p>
</item>
</olist>
</constraintnote>
    </div3>
   </div2>
   <div2 id="cModel_Group_Definitions">
    <head>Model Group Definitions</head>
<p>A model group definition associates a name and optional annotations with a <compref ref="mg"/>.
By reference to the name, the entire model group can be incorporated by reference into a <propref comp="p" prop="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>
    <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:group ref="myModelGroup"/&gt;
 &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>
    <div3 id="Model_Group_Definition_details">
     <head>The Model Group Definition Schema Component</head>
    <p>The model group definition schema component has the following
properties:</p>

  <compdef name="Model Group Definition" abbrev="mgd"/>

<p>Model group definitions are identified by their <propref comp="mgd" prop="name"/> and <propref comp="mgd" prop="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 comp="p" prop="term"/> of
a particle &may.xm; correspond in whole or in part
to a model group from a model group definition.</p>
<p><propref comp="mgd" prop="model group"/> is the <compref ref="mg"/> for which the model group definition provides a name.</p>
<p>See <specref ref="cAnnotations"/> for information on the role of the
<propref comp="mgd" prop="annotations"/> property.</p>
    </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 comp="mgd" prop="name">The &v-value; of the
<code>name</code> &i-attribute;</propmap>

  <propmap comp="mgd" prop="target namespace">The &v-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <code>schema</code>
element information item.</propmap>
<propmap comp="mgd" prop="model group">A model group which is the <propref comp="p" prop="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 comp="mgd" prop="annotations">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 comp="p" prop="min occurs">The &v-value; of the <code>minOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap comp="p" prop="max occurs"><pt>unbounded</pt>, if the <code>maxOccurs</code>
&i-attribute; equals <pt>unbounded</pt>, otherwise the &v-value; of the <code>maxOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap comp="p" prop="term">The <propref comp="mgd" prop="model group"/> of the
model group definition <termref def="src-resolve">resolved</termref> to by the &v-value; of the <code>ref</code> &i-attribute;</propmap>
  </reprcomp>
</reprdef>
 <p>The name of this section is slightly misleading, in that the second, un-named,
case above (with a
<code>ref</code> and no <code>name</code>) is not really a named model
group at all, but a reference to one.  Also note that in the first (named)
case above no reference is made to <code>minOccurs</code> or
<code>maxOccurs</code>: this is because the schema for schemas does not allow
them on the child of <eltref ref="group"/> when it is named.  This in turn is
because the <propref comp="p" prop="min occurs"/> and <propref comp="p" prop="max occurs"/> of
the particles which <emph>refer</emph> to the definition are what count.</p>
 <p>Given the constraints on its appearance in content models, an
<eltref ref="all"/> 
&must.x.s; 
only occur as the only item in the
&i-children; of a named model group definition or a content model: see <specref ref="coss-modelGroup"/>.</p>
</div3>
    <div3>
     <head>Constraints on XML Representations of Model Group Definitions</head>
<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 corresponding model group definition, if any, &must; satisfy the conditions set
out in <specref ref="coss-modelGroup"/>.
  </p>
 </constraintnote>
    </div3>
    <div3>
     <head>Model Group Definition Validation Rules</head>
     <p>None as such.</p>
    </div3>
    <div3>
     <head>Model Group Definition Information Set Contributions</head>
     <p>None as such.</p>
    </div3>
    <div3 id="coss-groupDef">
     <head>Constraints on Model Group Definition Schema Components</head>
  <p>All model group definitions (see <specref ref="cModel_Group_Definitions"/>) &must; satisfy the following constraint.</p>
  <constraintnote type="cos" id="mgd-props-correct">
   <head>Model Group Definition Properties Correct</head>
   <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>
  </constraintnote>
 
    </div3>
   </div2>
   <div2 id="Model_Groups">
    <head>Model Groups</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_Definitions"/>), the sequence of element
information item &i-children; content &may.xm; be specified in
more detail with a model group.  Because the <propref comp="p" prop="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>
    <note role="example">
<eg xml:space="preserve"><![CDATA[<xs:all>
 <xs:element ref="cats"/>
 <xs:element ref="dogs"/>
</xs:all>

<xs:sequence>
 <xs:choice>
  <xs:element ref="left"/>
  <xs:element ref="right"/>
 </xs:choice>
 <xs:element ref="landmark"/>
</xs:sequence>
]]></eg>
<p>XML representations for the three kinds of model group, the third nested
inside the second.</p>
</note>
    <div3 id="Model_Group_details">
     <head>The Model Group Schema Component</head>
    <p>The model group schema component has the following
properties:</p>

  <compdef name="Model Group" abbrev="mg"/>
<p>specifies a sequential (<pt>sequence</pt>),
disjunctive (<pt>choice</pt>) or conjunctive (<pt>all</pt>) interpretation of
the <propref comp="mg" prop="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 comp="mg" prop="particles"/>;</p>
</item>
<item><p>(<pt>choice</pt>) corresponded to exactly one of the specified <propref comp="mg" prop="particles"/>;</p>
</item>
<item><p>(<pt>all</pt>) contain all and only exactly zero or one of each
element specified in <propref comp="mg" prop="particles"/>.  The elements can occur in any
order.  In this case, to reduce implementation complexity, <propref comp="mg" prop="particles"/> is restricted to contain local and top-level element
declarations only, with <propref comp="p" prop="min occurs"/><code>=0</code> or
<code>1</code>, <propref comp="p" prop="max occurs"/><code>=1</code>.</p>
</item>
</ulist></p>
    <p>When two or more particles contained directly or indirectly in the
<propref comp="mg" prop="particles"/> of a model group have identically named
element declarations as their 
<propref comp="p" prop="term"/>, the type definitions of those declarations &must; be the
same.  By 'indirectly' is meant particles within the <propref comp="mg" prop="particles"/>
of a group which is itself the <propref comp="p" prop="term"/> of a directly contained
particle, and so on recursively.</p>
<p>See <specref ref="cAnnotations"/> for information on the role of the
<propref comp="mg" prop="annotations"/> property.</p>
    </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 comp="p" prop="min occurs">The &v-value; of the <code>minOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap comp="p" prop="max occurs"><pt>unbounded</pt>, if the <code>maxOccurs</code>
&i-attribute; equals <pt>unbounded</pt>, otherwise the &v-value; of the <code>maxOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
<propmap comp="p" prop="term">A model group as given below:</propmap>
</reprcomp><reprcomp abstract="Model Group" ref="Model_Group_details">
<propmap comp="mg" prop="compositor">One of <pt>all</pt>, <pt>choice</pt>,
<pt>sequence</pt> depending on the element information item.</propmap>
<propmap comp="mg" prop="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 comp="mg" prop="annotations">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>
</div3>
    <div3>
     <head>Constraints on XML Representations of Model Groups</head>
  <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 corresponding particle and model group &must; satisfy the conditions set
out in <specref ref="coss-modelGroup"/> and <specref ref="coss-particle"/>.   
   </p>
  </constraintnote>
    </div3>
    <div3>
     <head>Model Group Validation Rules</head>
<constraintnote type="cvc" id="cvc-model-group">
 <head>Element Sequence Valid</head>
 <p><termdef id="key-partition" term="partition">Define a
<term>partition</term> of a sequence as a sequence of sub-sequences, some or
all of which &may.xm; be empty, such that concatenating all the sub-sequences yields
the original sequence</termdef>.</p>
 <p>For a sequence (possibly empty) of element information items to be
locally <termref def="key-vn">valid</termref> with respect to
a model group
  <olist role="case.mxm">
   <item>
    <p role="if">the <propref comp="mg" prop="compositor"/> is <pt>sequence</pt></p>
    <p role="then">there &is.xm; 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 comp="mg" prop="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 comp="mg" prop="particles"/> as defined in <specref ref="cvc-particle"/>.</p>
   </item>
   <item>
    <p role="if">the <propref comp="mg" prop="compositor"/> is <pt>choice</pt></p>
    <p role="then">there &is.xm; a
particle among the <propref comp="mg" prop="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>
   <item>
    <p role="if">the <propref comp="mg" prop="compositor"/> is <pt>all</pt></p>
    <p role="then">there &is.xm; 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 comp="mg" prop="particles"/> such that there is a one-to-one mapping between the sub-sequences and the <propref comp="mg" prop="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 comp="mg" prop="particles"/> is empty:  although no sequence can be <termref def="key-vn">valid</termref>
with respect to such a group whose <propref comp="mg" prop="compositor"/> is
<pt>choice</pt>, the empty sequence <emph>is</emph> <termref def="key-vn">valid</termref> with respect
to empty groups whose <propref comp="mg" prop="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 
<!--* 'recipe' is Latin, not French, from the typical first word of the text *-->
<phrase diff="del" dg="modals">recip&eacute;</phrase><phrase diff="add" dg="modals">recipe</phrase>
for implementations.  Note in particular that when 
<propref comp="mg" prop="compositor"/> is <pt>all</pt>, particles is restricted to a list
of local and top-level 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 comp="p" prop="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>
    </div3>
    <div3>
     <head>Model Group Information Set Contributions</head>
     <p>None as such.</p>
    </div3>
    <div3 id="coss-modelGroup">
     <head>Constraints on Model Group Schema Components</head>
  <p>All model groups (see <specref ref="Model_Groups"/>) &must; satisfy the following constraints.</p>
  <constraintnote type="cos" id="mg-props-correct">
   <head>Model Group Correct</head>
   <olist role="And.mxm">
    <item><p>The values of the properties of a model group &are.xm; as described in
the property tableau in
<specref ref="Model_Group_details"/>, modulo the impact of <specref ref="conformance-missing"/>.</p></item>
    <item><p><phrase diff="del" dg="modals">Circular groups are 
disallowed.</phrase><phrase diff="add" dg="modals">There are no circular groups.</phrase>  
That is, within the <propref comp="mg" prop="particles"/> of a group there 
<phrase diff="del" dg="modals">&mustnot; be at any
depth a particle</phrase><phrase diff="add" dg="modals">is no 
particle at any depth</phrase> whose <propref comp="p" prop="term"/> is the
group itself.</p></item>
   </olist>   
  </constraintnote>
  <constraintnote type="cos" id="cos-all-limited">
   <head>All Group Limited</head>
   <p>When a model group has <propref comp="mg" prop="compositor"/> <pt>all</pt>, then
    <olist role="and.mxm">
     <item>
<p>It appears only as the value of one or both of the following properties:</p>
<olist>
     <item>
      <p>the <propref comp="mgd" prop="model group"/> property of a model group definition.</p>
     </item>
     <item>
      <p>the
<propref comp="p" prop="term"/> property of a particle with <propref comp="p" prop="max occurs"/><code>=1</code>which is part of a pair which constitutes the <propref comp="ctd" prop="content type"/> of a
complex type definition.</p>
     </item>
    </olist>
     </item>
     <item>
<p>The <propref comp="p" prop="max occurs"/> of all the particles in the
<propref comp="mg" prop="particles"/> of the group &is.xm; <code>0</code> or <code>1</code>.</p>
</item>
    </olist> 
   </p>
  </constraintnote>
<constraintnote type="cos" id="cos-element-consistent">
<head>Element Declarations Consistent</head>
<issue id="RQ-146i" role="1.1">
<p><loc href="&reqs;#ElementDeclarationsConsistent" target="reqs">RQ-146 (ElementDeclarationsConsistent)</loc></p>
<p>Some corner cases, e.g. involving 'skip' wildcards, have emerged with
respect to this constraint.  It will be restated at a higher level of
abstraction, in terms of desired outcome.  See also <specref ref="RQ-36i"/>.</p>
<resolution>
<p>This constraint will be restated in terms of intended outcome, i.e.
that (modulo the impact of xsi:type) validation of an EII with a type
definition will always assign the same type definitions to elements or
attributes of the same name.</p>
</resolution>
</issue>
<p>If the <propref comp="mg" prop="particles"/> contains, either
directly, indirectly (that is, within the <propref comp="mg" prop="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 comp="ed" prop="name"/> and
<propref comp="ed" prop="target namespace"/>, then all their type
definitions &must; be the same top-level definition, that is,
<olist role="and.mxm">
<item>
<p>all their <propref comp="ed" prop="type definition"/>s <phrase diff="del" dg="modals">&must;</phrase> have a &non-absent; <propref comp="ctd" prop="name"/>.</p>
</item>
<item>
<p>all their
<propref comp="ed" prop="type definition"/>s <phrase diff="del" dg="modals">&must;</phrase> have the same
<propref comp="ctd" prop="name"/>.</p>
</item>
<item>
<p>all their
<propref comp="ed" prop="type definition"/>s <phrase diff="del" dg="modals">&must;</phrase> have the same
<propref comp="ctd" prop="target namespace"/>.</p>
</item>
</olist>
</p>
<p><termdef id="key-impl-cont" term="implicitly contains">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 component
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>
    <p>Since this constraint is expressed at the component level, it
applies to content models whose origins (e.g. via type &derivation; and
references to named model groups) are no longer evident.  So particles at
different points in the content model are always distinct from one another,
even if they originated from the same named model group.</p>
   </note>
</constraintnote>
  <note>
    <p>Because locally-scoped element declarations <phrase diff="del" dg="may">may or may not</phrase><phrase diff="add" dg="may">sometimes have and sometimes do not</phrase> have a
<propref comp="ed" prop="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 comp="p" prop="term"/> is a group whose <propref comp="mg" prop="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 comp="p" prop="min occurs"/> and the
sum of the <propref comp="p" prop="min occurs"/> of every wildcard or element
declaration particle in the group's <propref comp="mg" prop="particles"/> and the minimum
part of the effective total range of each of the group particles in the group's <propref comp="mg" prop="particles"/> (or <code>0</code> if there are no <propref comp="mg" prop="particles"/>).</p>
     </def>
    </gitem>
    <gitem>
     <label>maximum</label>
     <def>
      <p><pt>unbounded</pt> if the <propref comp="p" prop="max occurs"/> of any wildcard or element
declaration particle in the group's <propref comp="mg" prop="particles"/> or the maximum
part of the effective total range of any of the group particles in the group's
<propref comp="mg" prop="particles"/> is <pt>unbounded</pt>, or if any of those is non-zero
and the <propref comp="p" prop="max occurs"/> of the particle itself is <pt>unbounded</pt>,
otherwise the product of the particle's <propref comp="p" prop="max occurs"/> and the
sum of the <propref comp="p" prop="max occurs"/> of every wildcard or element
declaration particle in the group's <propref comp="mg" prop="particles"/> and the maximum
part of the effective total range of each of the group particles in the group's <propref comp="mg" prop="particles"/> (or <code>0</code> if there are no <propref comp="mg" prop="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 comp="p" prop="term"/> is a group whose <propref comp="mg" prop="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 comp="p" prop="min occurs"/> and the
minimum of the <propref comp="p" prop="min occurs"/> of every wildcard or element
declaration particle in the group's <propref comp="mg" prop="particles"/> and the minimum
part of the effective total range of each of the group particles in the group's <propref comp="mg" prop="particles"/> (or <code>0</code> if there are no <propref comp="mg" prop="particles"/>).</p>
     </def>
    </gitem>
    <gitem>
     <label>maximum</label>
     <def>
      <p><pt>unbounded</pt> if the <propref comp="p" prop="max occurs"/> of any wildcard or element
declaration particle in the group's <propref comp="mg" prop="particles"/> or the maximum
part of the effective total range of any of the group particles in the group's
<propref comp="mg" prop="particles"/> is <pt>unbounded</pt>, or if any of those is non-zero
and the <propref comp="p" prop="max occurs"/> of the particle itself is <pt>unbounded</pt>,
otherwise the product of the particle's <propref comp="p" prop="max occurs"/> and the
maximum of the <propref comp="p" prop="max occurs"/> of every wildcard or element
declaration particle in the group's <propref comp="mg" prop="particles"/> and the maximum
part of the effective total range of each of the group particles in the group's <propref comp="mg" prop="particles"/> (or <code>0</code> if there are no <propref comp="mg" prop="particles"/>).</p>
     </def>
    </gitem>
   </glist>
  </constraintnote>
    </div3>
   </div2>
   <div2 id="cParticles">
    <head>Particles</head>
    <p>As described in <specref ref="Model_Groups"/>, particles contribute to the definition
of content models.</p>
    <note role="example">
     <eg xml:space="preserve"><![CDATA[<xs:element ref="egg" minOccurs="12" maxOccurs="12"/>

<xs:group ref="omelette" minOccurs="0"/>

<xs:any maxOccurs="unbounded"/>]]>
     </eg>
     <p>XML representations which all involve particles, illustrating some of
the possibilities for controlling occurrence.</p>
    </note>
    <div3 id="Particle_details">
     <head>The Particle Schema Component</head>
<p>The particle schema component has the following properties:</p>

  <compdef name="Particle" abbrev="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.  When the <propref comp="p" prop="term"/> is an element
declaration or wildcard, <propref comp="p" prop="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 comp="p" prop="min occurs"/>.  If <propref comp="p" prop="min occurs"/> is <pt>0</pt>, then occurrence of such children is optional.</p>
<p>Again, when the <propref comp="p" prop="term"/> is an element
declaration or wildcard, the number of such element &i-children; &must; be less than or equal to any numeric specification of
<propref comp="p" prop="max occurs"/>; if <propref comp="p" prop="max occurs"/> is <pt>unbounded</pt>, then there is no
upper bound on the number of such children.</p>
     <p>When the <propref comp="p" prop="term"/> is a model group, the permitted
occurrence range is determined by a combination of <propref comp="p" prop="min occurs"/> and <propref comp="p" prop="max occurs"/> and the occurrence ranges of the <propref comp="p" prop="term"/>'s <propref comp="mg" prop="particles"/>.</p>
    </div3>
    <div3>
     <head>XML Representation of Particle Components</head>
     <p>Particles correspond to all three elements (<eltref ref="element" inside="complexType"/> not immediately within <eltref ref="schema"/>, <eltref ref="group" inside="complexType"/> not immediately within <eltref ref="schema"/> and <eltref ref="any"/>) which allow <code>minOccurs</code> and <code>maxOccurs</code> attributes.  These in turn correspond to
<emph>two</emph> components in each case, a particle and its <propref comp="p" prop="term"/>.  The appropriate mapping is described in <specref ref="declare-element"/>, <specref ref="declare-contentModel"/> and <specref ref="declare-openness"/> respectively.</p>
    </div3>
    <div3>
     <head>Constraints on XML Representations of Particles</head>
     <p>None as such.</p>
    </div3>
    <div3>
     <head>Particle Validation Rules</head>
<constraintnote type="cvc" id="cvc-particle">
<head>Element Sequence Locally Valid (Particle)</head>
<p>For a sequence (possibly empty) of element information items to be
locally <termref def="key-vn">valid</termref> with respect to a
particle
<olist role="case.mxm">
<item id="c-pw">
<p role="if">the <propref comp="p" prop="term"/> is a wildcard</p>
<p role="then">
<olist role="and.ixm">
<item>
<p>The length of the sequence &is.xm; greater than or equal to the
<propref comp="p" prop="min occurs"/>.</p>
</item>
<item>
<p>If <propref comp="p" prop="max occurs"/> is a number, the length of
the sequence &is.xm; less than or equal to the <propref comp="p" prop="max occurs"/>.</p>
</item>
<item>
<p>Each element information item in the sequence &is.xm; <termref def="key-vn">valid</termref> with respect to the wildcard as defined
by <specref ref="cvc-wildcard"/>.</p>
</item>
</olist>
</p>
</item>
<item id="c-cdde">
<p role="if">the <propref comp="p" prop="term"/> is an element
declaration</p>
<p role="then">
<olist role="and.ixm">
<item>
<p>The length of the sequence &is.xm; greater than or equal to the
<propref comp="p" prop="min occurs"/>.</p>
</item>
<item>
<p>If <propref comp="p" prop="max occurs"/> is a number, the length of
the sequence &is.xm; less than or equal to the <propref comp="p" prop="max occurs"/>.</p>
</item>
<item>
<p>For each element information item in the sequence
<olist role="or.ixm">
<item>
<p>The element declaration is local (i.e. its
<propref comp="ed" prop="scope"/> &isnot.xmnb; <pt>global</pt>),
<phrase diff="del" dg="rq17">its <propref comp="ed" prop="abstract"/>
is <pt>false</pt>, </phrase>the element information item's <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.element">namespace
name</xpropref> is identical to the element declaration's <propref comp="ed" prop="target namespace"/> (where an <termref def="key-null">absent</termref> <propref comp="ed" prop="target
namespace"/> is taken to be identical to a <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.element">namespace
name</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 comp="ed" prop="name"/>.</p>
<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>
<item>
<p>The element declaration is top-level (i.e. its
<propref comp="ed" prop="scope"/> is <pt>global</pt>), <phrase diff="del" dg="rq17">its <propref comp="ed" prop="abstract"/> is
<pt>false</pt>, </phrase>the element information item's <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.element">namespace
name</xpropref> is identical to the element declaration's <propref comp="ed" prop="target namespace"/> (where an <termref def="key-null">absent</termref> <propref comp="ed" prop="target
namespace"/> is taken to be identical to a <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.element">namespace
name</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 comp="ed" prop="name"/>.</p>
<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>
<item id="c-psg">
<p>The element declaration is top-level (i.e. its
<propref comp="ed" prop="scope"/> is <pt>global</pt>), its <propref comp="ed" prop="disallowed substitutions"/> 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
name</xpropref> of the element information item resolve to an element
declaration, as defined in <specref ref="cvc-resolve-instance"/> --
<termdef id="key-eqd" term="substituting declaration" role="local">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 comp="ed" prop="disallowed substitutions"/> is validly substitutable for the
particle's element declaration as defined in <specref ref="cos-equiv-&derived;-ok-rec"/>.</p>
<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>
<item>
<p role="if">the <propref comp="p" prop="term"/> is a model group</p>
<p role="then">
<olist role="and.ixm">
<item><p>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 comp="p" prop="min
occurs"/>.</p></item>
<item><p>If <propref comp="p" prop="max occurs"/> is a number,
<code>n</code> &is.xm; less than or equal to <propref comp="p" prop="max
occurs"/>.</p></item>
<item><p>Each sub-sequence in the <termref def="key-partition">partition</termref> 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>
</item>
</olist>
</p>
<note>
<p>Clauses <clauseref ref="c-pw"/> and <clauseref ref="c-psg"/> do not
interact: an element information item validatable by a declaration
with a substitution group head in a different namespace is
<emph>not</emph> validatable by a wildcard which accepts the head's
namespace but not its own.</p>
</note>
</constraintnote>
    </div3>
    <div3>
     <head>Particle Information Set Contributions</head>
     <p>None as such.</p>
    </div3>
    <div3 id="coss-particle">
     <head>Constraints on Particle Schema Components</head>
  <p>All particles (see <specref ref="cParticles"/>) &must; satisfy the following constraints.</p>
  <constraintnote type="cos" id="p-props-correct">
   <head>Particle Correct</head>
   <olist role="And.mxm">
    <item>
   <p>The values of the properties of a particle &are.xm; 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 comp="p" prop="max occurs"/> is not <pt>unbounded</pt>, that is, it has a
numeric value, then
    <olist role="and.ixm">
     <item>
     <p><propref comp="p" prop="min occurs"/> &isnot.xmnb; greater than <propref comp="p" prop="max occurs"/>.</p>
    </item>
    <item>
     <p><propref comp="p" prop="max occurs"/> &is.xm; 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" role="local">For a particle
(call it <local>E</local>, for extension) to be a <term>valid extension</term> of
another particle (call it <local>B</local>, for base)</termdef>
    <olist role="or.mxm">
     <item>
      <p>They are the same particle.</p>
     </item>
     <item>
      <p><local>E</local>'s <propref comp="p" prop="min occurs"/>=<propref comp="p" prop="max occurs"/><code>=1</code> and its <propref comp="p" prop="term"/> is a <pt>sequence</pt> group whose <propref comp="mg" prop="particles"/>' first member is a particle all of whose properties, recursively, are identical to those of <local>B</local>, with the exception of <xpropref role="anon">annotation</xpropref> properties.</p>
     </item>
    </olist>
   </p>
  </constraintnote>
   <p diff="del" dg="rq17">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" diff="del" dg="rq17">
    <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" diff="del" dg="rq17">
   <head>Particle Valid (Restriction)</head>
   <issue id="RQ-11i" role="1.1">
    <p><loc href="&reqs;#pointless-occs">RQ-11 (pointless-occs)</loc>, <loc href="&reqs;#choice-vs-choice">RQ-12 (choice-vs-choice)</loc>, <loc href="&reqs;#restrictn-rules" target="reqs">RQ-17 (restrictn-rules)</loc></p>
    <p>A number of cases have emerged in which the detailed rules in this
section do not allow content models that common sense suggests should be
allowed, or <emph>vice versa</emph>.  The decision to move to a higher-level definition of restriction (see
<specref ref="RQ-17i"/>) means these issues have actually been overtaken.</p>
    <resolution>
     <p>The decision to move to a higher-level definition of restriction means
almost all of this constraint will disappear.</p>
    </resolution>
   </issue>
   <p><termdef id="cd-model-restriction" term="valid restriction" role="local">For a particle (call it <local>R</local>, for restriction) to be a <term>valid restriction</term> of
another particle (call it <local>B</local>, for base)</termdef>
    <olist role="or.mxm">
     <item>
      <p>They are the same particle.</p>
     </item>
     <item>
      <p><phrase diff="del" dg="modals">depending</phrase><phrase diff="add" dg="modals">Depending</phrase> on the kind of particle, per
the table below, with the qualifications that
       <olist role="and.ixm">
        <item>
         <p>Any top-level element declaration particle (in <local>R</local> or
<local>B</local>) which is the
<propref comp="ed" prop="substitution group affiliation"/> of one or more other element declarations
and whose <termref def="key-eq">substitution group</termref>
contains at least one element declaration other than itself is
treated as if it were a <pt>choice</pt> group whose <propref comp="p" prop="min occurs"/> and <propref comp="p" prop="max occurs"/> are those of the particle, and whose <propref comp="mg" prop="particles"/> consists of
one particle with <propref comp="p" prop="min occurs"/> and <propref comp="p" prop="max occurs"/> of <code>1</code>  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="all"/> are ignored, where pointlessness is understood as follows:
          <glist>
           <gitem>
            <label><eltref ref="sequence"/></label>
            <def>
              <olist role="Or.ixm">
              <item>
               <p><propref comp="mg" prop="particles"/> is empty.</p>
              </item>
               <item>
                <olist role="And.ixm">
                 <item><p>The particle within which this <eltref ref="sequence"/>
appears has <propref comp="p" prop="max occurs"/> and <propref comp="p" prop="min occurs"/> of
<code>1</code>.</p></item>
                 <item>
                  <olist role="Or.ixm"> 
                  <item>
                   <p>The <eltref ref="sequence"/>'s <propref comp="mg" prop="particles"/>
has only one member.</p>
                  </item>
                   <item>
                   <p>The particle within which this <eltref ref="sequence"/>
appears is itself among the <propref comp="mg" prop="particles"/> of a <eltref ref="sequence"/>.</p>
                  </item>
                 </olist>
                 </item>
                </olist>
               </item>
             </olist>             
            </def>
           </gitem>
           <gitem>
            <label><eltref ref="all"/></label>
            <def>
              <olist role="Or.ixm">
              <item>
               <p><propref comp="mg" prop="particles"/> is empty.</p>
              </item>
               <item>
                <p><propref comp="mg" prop="particles"/> has only one member.</p>
               </item>
             </olist>             
            </def>
           </gitem>
           <gitem>
            <label><eltref ref="choice"/></label>
            <def>
              <olist role="Or.ixm">
              <item>
               <p><propref comp="mg" prop="particles"/> is empty and the
particle within which this <eltref ref="choice"/> appears has <propref comp="p" prop="min occurs"/> of <code>0</code>.</p>
              </item>
               <item>
                <olist role="And.ixm">
                 <item><p>The particle within which this <eltref ref="choice"/>
appears has <propref comp="p" prop="max occurs"/> and <propref comp="p" prop="min occurs"/> of
<code>1</code>.</p></item>
                 <item>
                 <olist role="Or.ixm"> 
                  <item>
                   <p>The <eltref ref="choice"/>'s <propref comp="mg" prop="particles"/>
has only one member.</p>
                  </item>
                  <item>
                   <p>The particle within which this <eltref ref="choice"/>
appears is itself among the <propref comp="mg" prop="particles"/> of a <eltref ref="choice"/>.</p>
                  </item>
                 </olist>
                </item>
                </olist>
               </item>
             </olist>             
            </def>
           </gitem>
          </glist>
         </p>
        </item>
       </olist>
       </p>
      <restrictCases>
        <restrict case="elt">
         <elt ref="NameAndTypeOK">NameAnd- TypeOK</elt>
         <any>NSCompat</any>
         <all ref="RecurseAsIfGroup">Recurse- AsIfGroup</all>
         <choice ref="RecurseAsIfGroup">Recurse- AsIfGroup</choice>
         <seq ref="RecurseAsIfGroup">RecurseAs- IfGroup</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 ref="NSRecurseCheckCardinality">NSRecurse- CheckCardinality</any>
         <all>Recurse</all>
         <elt>Forbidden</elt>
         <choice>Forbidden</choice>
         <seq>Forbidden</seq>
        </restrict>
        <restrict case="choice">
         <any ref="NSRecurseCheckCardinality">NSRecurse- CheckCardinality</any>
         <choice>RecurseLax</choice>
         <all>Forbidden</all>
         <elt>Forbidden</elt>
         <seq>Forbidden</seq>
        </restrict>
        <restrict case="seq- uence">
         <any ref="NSRecurseCheckCardinality">NSRecurse- CheckCardinality</any>
         <all ref="RecurseUnordered">Recurse- Unordered</all>
         <choice>MapAndSum</choice>
         <seq>Recurse</seq>
         <elt>Forbidden</elt>
        </restrict>
       </restrictCases>
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote id="range-ok" type="cos" diff="del" dg="rq17">
   <head>Occurrence Range OK</head>
   <p>For a particle's occurrence range to be a valid restriction of another's
occurrence range
    <olist role="and.mxm">
     <item>
      <p>Its <propref comp="p" prop="min occurs"/> is greater than or equal to the
other's <propref comp="p" prop="min occurs"/>.</p>
     </item>
     <item>
      
       <olist role="or.ixm">
        <item>
         <p>The other's <propref comp="p" prop="max occurs"/> is <pt>unbounded</pt>.</p>
        </item>
        <item>
         <p>Both <propref comp="p" prop="max occurs"/> are numbers, and the particle's is less than or equal to the
other's.</p>
        </item>
       </olist>      
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote type="cos" id="rcase-NameAndTypeOK" diff="del" dg="rq17">
   <head>Particle Restriction OK (Elt:Elt -- NameAndTypeOK)</head>
   <p>For an element declaration particle to be a <termref def="cd-model-restriction">valid restriction</termref> of another element declaration particle
    <olist role="and.mxm">
     <item>
      <p>The declarations' <propref comp="ed" prop="name"/>s and <propref comp="ed" prop="target namespace"/>s are the same.</p>
     </item>
     <item>
      <p><local>R</local>'s occurrence range is a valid
restriction of <local>B</local>'s occurrence range as defined by <specref ref="range-ok"/>.</p>
     </item>
     <item>
      <olist role="Or.ixm">
       <item>
        <p>Both <local>B</local>'s declaration's <propref comp="ed" prop="scope"/> and
<local>R</local>'s declaration's <propref comp="ed" prop="scope"/> are <pt>global</pt>.</p>
       </item>
       <item>
        <olist role="And.ixm">
         <item>
      <p>Either <local>B</local>'s <propref comp="ed" prop="nillable"/> is <pt>true</pt> or <local>R</local>'s <propref comp="ed" prop="nillable"/> is <pt>false</pt>.</p>
     </item>
     <item>
      <p>either <local>B</local>'s declaration's <propref comp="ed" prop="value constraint"/> is
absent, or is
not <pt>fixed</pt>, or <local>R</local>'s declaration's <propref comp="ed" prop="value constraint"/> is
<pt>fixed</pt> with the same value.</p>
     </item>
     <item>
      <p><local>R</local>'s declaration's <propref comp="s" prop="&constraint; definitions"/> is
a subset of <local>B</local>'s declaration's <propref comp="s" prop="&constraint; definitions"/>,
if any.</p><issue id="RQ-15i" role="1.1">
			<p><loc href="&reqs;#id-restriction" target="reqs">RQ-15 (id-restriction)</loc></p>
            <p>Version 1.0 got the appropriate constraint for &constraint;
definitions and restriction backwards -- the restricted definition &must; have
the same or <emph>more</emph> constraints, not less.</p>
            <resolution>
             <p>When you're constructing a restricted type, then</p>
             <ulist>
              <item>
               <p>the identity constraints of a local element are inherited;</p>
              </item>
              <item><p>any new ones (those occurring in the declaration of E local to R) 
      are added.</p>
              </item>
             </ulist>
             <p>[<loc href="http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2004Apr/0178.html">G Archive</loc> (W3C-member-only link)]</p>
            </resolution>
			</issue></item>
     <item>
      <p><local>R</local>'s declaration's <propref comp="ed" prop="disallowed substitutions"/> is
a superset of <local>B</local>'s declaration's <propref comp="ed" prop="disallowed substitutions"/>.</p>
     </item>
     <item>
      <p><local>R</local>'s <propref comp="ed" prop="type definition"/> is validly &derived; given
{<pt>extension</pt>, <pt>list</pt>, <pt>union</pt>} from <local>B</local>'s <propref comp="ed" prop="type definition"/> as defined by
<specref ref="cos-ct-&derived;-ok"/> or <specref ref="cos-st-&derived;-ok"/>, as appropriate.</p>
     </item>
        </olist>
       </item>
      </olist>
     </item>
    </olist>
   </p>
   <note>
    <p>The above constraint on <propref comp="ed" prop="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, or be one of the member types of a
corresponding union..</p>
   </note>
  </constraintnote>
  <constraintnote type="cos" id="rcase-NSCompat" diff="del" dg="rq17">
   <head>Particle &Derivation; OK (Elt:Any -- NSCompat)</head>
   <p>For an element declaration particle to be a <termref def="cd-model-restriction">valid restriction</termref> of a wildcard particle
    <olist role="and.mxm">
     <item>
      <p>The element declaration's <propref comp="ed" prop="target namespace"/> is
<termref def="key-vn">valid</termref> with respect to the wildcard's <propref comp="w" prop="namespace constraint"/> as
defined by <specref ref="cvc-wildcard-namespace"/>.</p>
     </item>
     <item>
      <p><local>R</local>'s occurrence range is a valid
restriction of <local>B</local>'s occurrence range as defined by <specref ref="range-ok"/>.</p>
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote type="cos" id="rcase-RecurseAsIfGroup" diff="del" dg="rq17">
   <head>Particle &Derivation; OK (Elt:All/Choice/Sequence -- RecurseAsIfGroup)</head>
   <p>For an element declaration particle to be a <termref def="cd-model-restriction">valid restriction</termref> of a group particle (<pt>all</pt>, <pt>choice</pt> or <pt>sequence</pt>)
a group particle of the variety corresponding to <local>B</local>'s, with
<propref comp="p" prop="min occurs"/> and <propref comp="p" prop="max occurs"/> of <code>1</code> and with <propref comp="mg" prop="particles"/> consisting of a single particle
the same as the element declaration &must; be 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" diff="del" dg="rq17">
   <head>Particle &Derivation; OK (Any:Any -- NSSubset)</head>
   <p>For a wildcard particle to be a <termref def="cd-model-restriction">valid restriction</termref> of another wildcard particle
    <olist role="and.mxm">
     <item>
      <p><local>R</local>'s occurrence range &is.xm; a valid
restriction of <local>B</local>'s occurrence range as defined by <specref ref="range-ok"/>.</p>
     </item>
     <item>
      <p><local>R</local>'s <propref comp="w" prop="namespace constraint"/> &is.xm; an intensional
subset of <local>B</local>'s <propref comp="w" prop="namespace constraint"/> as defined by <specref ref="cos-ns-subset"/>.</p>
     </item>
     <item>
      <p>Unless <local>B</local> is the content model wildcard of
the <termref def="ur-type-itself">ur-type definition</termref>, <local>R</local>'s <propref comp="w" prop="process contents"/> &is.xm; identical
to or stronger than <local>B</local>'s <propref comp="w" prop="process contents"/>, where
<pt>strict</pt> is stronger than <pt>lax</pt> is stronger than <pt>skip</pt>.</p>
     </item>
    </olist>
   </p>
   <note id="procContNote" role="forceNote">
    <p>The exception to the third clause above for &derivations; from
the <termref def="ur-type-itself">ur-type definition</termref> is necessary as
its wildcards have a <propref comp="w" prop="process contents"/> of <pt>lax</pt>, so
without this exception, no use of wildcards with <propref comp="w" prop="process contents"/> of <pt>skip</pt> would be possible.</p>
   </note>
  </constraintnote>
  <constraintnote type="cos" id="rcase-NSRecurseCheckCardinality" diff="del" dg="rq17">
   <head>Particle &Derivation; OK (All/Choice/Sequence:Any -- NSRecurseCheckCardinality)</head>
   <p>For a group particle to be a <termref def="cd-model-restriction">valid restriction</termref> of a wildcard particle
    <olist role="and.mxm">
     <item>
      <p>Every member of the <propref comp="mg" prop="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 <local>B</local>'s occurrence range as defined by <specref ref="range-ok"/>.</p>
     </item>
    </olist>
   </p>
  </constraintnote>
  <constraintnote type="cos" id="rcase-Recurse" diff="del" dg="rq17">
   <head>Particle &Derivation; OK (All:All,Sequence:Sequence -- Recurse)</head>
   <p>For an <pt>all</pt> or <pt>sequence</pt> group particle to be a <termref def="cd-model-restriction">valid restriction</termref> of another group particle with the same <propref comp="mg" prop="compositor"/> 
    <olist role="and.mxm">
     <item>
      <p><local>R</local>'s occurrence range is a valid
restriction of <local>B</local>'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 comp="mg" prop="particles"/> of <local>R</local> to the particles in the <propref comp="mg" prop="particles"/> of <local>B</local> such that
       <olist role="and.ixm">
        <item>
         <p>Each particle in the <propref comp="mg" prop="particles"/> of <local>R</local> is a
<termref def="cd-model-restriction">valid restriction</termref> of the
particle in the <propref comp="mg" prop="particles"/> of <local>B</local> it maps to as defined
by <specref ref="cos-particle-restrict"/>.</p>
        </item>
        <item>
         <p>All particles in the <propref comp="mg" prop="particles"/> of <local>B</local> which
are not mapped to by any particle in the <propref comp="mg" prop="particles"/> of <local>R</local>
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, &derived; <pt>all</pt> groups are required to
match the order of their base in order to simplify checking that the &derivation; is OK.</p>
   </note>
   <p><termdef id="key-op" term="order-preserving" role="local">A complete functional mapping is
<term>order-preserving</term> if each particle <local>r</local> in the domain <local>R</local> maps to a
particle <local>b</local> in the range <local>B</local> which follows (not necessarily
immediately) the particle in the range
<local>B</local> mapped to by the predecessor of <local>r</local>, if any, where
<quote>predecessor</quote> and <quote>follows</quote> are defined with respect
to the order of the lists which constitute <local>R</local> and <local>B</local></termdef>.</p>
  </constraintnote>
  <constraintnote type="cos" id="rcase-RecurseLax" diff="del" dg="rq17">
   <head>Particle &Derivation; OK (Choice:Choice -- RecurseLax)</head>
   <p>For a <pt>choice</pt> group particle to be a <termref def="cd-model-restriction">valid restriction</termref> of another <pt>choice</pt> group particle 
    <olist role="and.mxm">
     <item>
      <p><local>R</local>'s occurrence range is a valid
restriction of <local>B</local>'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 comp="mg" prop="particles"/> of <local>R</local> to the particles in the <propref comp="mg" prop="particles"/> of <local>B</local> such that each particle in the <propref comp="mg" prop="particles"/> of <local>R</local> is a
<termref def="cd-model-restriction">valid restriction</termref> of the
particle in the <propref comp="mg" prop="particles"/> of <local>B</local> 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, &derived; <pt>choice</pt> groups are
required to
match the order of their base in order to simplify checking that the &derivation; is OK.</p>
   </note>
  </constraintnote>
  <constraintnote type="cos" id="rcase-RecurseUnordered" diff="del" dg="rq17">
   <head>Particle &Derivation; OK (Sequence:All -- RecurseUnordered)</head>
   <p>For a <pt>sequence</pt> group particle to be a <termref def="cd-model-restriction">valid restriction</termref> of an <pt>all</pt> group particle
    <olist role="and.mxm">
     <item>
      <p><local>R</local>'s occurrence range is a valid
restriction of <local>B</local>'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 comp="mg" prop="particles"/> of <local>R</local> to the particles in the <propref comp="mg" prop="particles"/> of <local>B</local> such that
       <olist role="and.ixm">
        <item>
         <p>No particle in the <propref comp="mg" prop="particles"/> of <local>B</local> is mapped
to by more than one of the particles in the
<propref comp="mg" prop="particles"/> of <local>R</local>;</p>
        </item>
        <item>
         <p>Each particle in the <propref comp="mg" prop="particles"/> of <local>R</local> is a
<termref def="cd-model-restriction">valid restriction</termref> of the
particle in the <propref comp="mg" prop="particles"/> of <local>B</local> it maps to as defined
by <specref ref="cos-particle-restrict"/>;</p>
        </item>
        <item>
         <p>All particles in the <propref comp="mg" prop="particles"/> of <local>B</local> which
are not mapped to by any particle in the <propref comp="mg" prop="particles"/> of <local>R</local>
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" diff="del" dg="rq17">
   <head>Particle &Derivation; OK (Sequence:Choice -- MapAndSum)</head>
   <p>For a <pt>sequence</pt> group particle to be a <termref def="cd-model-restriction">valid restriction</termref> of a <pt>choice</pt> group particle
    <olist role="and.mxm">
     <item>
      <p>There is a complete functional mapping from the particles in the
<propref comp="mg" prop="particles"/> of <local>R</local> to the particles in the <propref comp="mg" prop="particles"/> of <local>B</local> such that each particle in the <propref comp="mg" prop="particles"/> of <local>R</local> is a
<termref def="cd-model-restriction">valid restriction</termref> of the
particle in the <propref comp="mg" prop="particles"/> of <local>B</local> it maps to as defined
by <specref ref="cos-particle-restrict"/>.</p>
     </item>
     <item>
      <p>The pair consisting of the product of the <propref comp="p" prop="min occurs"/> of <local>R</local> and the length of its <propref comp="mg" prop="particles"/> and <pt>unbounded</pt> if <propref comp="p" prop="max occurs"/> is <pt>unbounded</pt> otherwise the product of the <propref comp="p" prop="max occurs"/> of <local>R</local> and the length of its <propref comp="mg" prop="particles"/> is a valid
restriction of <local>B</local>'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 &can.xm; 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" role="local">For a particle to be
<term>emptiable</term></termdef>
   <olist role="or.mxm">
    <item>
     <p>Its <propref comp="p" prop="min occurs"/> is <code>0</code>.</p>
    </item>
    <item>
     <p>Its <propref comp="p" prop="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> 
    </div3>
   </div2>
   <div2 id="Wildcards">
    <head>Wildcards</head>
    <p>In order to exploit the full potential for extensibility offered by XML
plus namespaces, more provision is needed than DTDs allow for targeted flexibility in content
models and attribute declarations.  A wildcard provides for <termref def="key-vn">validation</termref> of
attribute and element information items dependent on their namespace
name, but independently of their local name.</p>
	<issue id="RQ-9i" role="1.1">
	  <p><loc href="&reqs;#wildcard-ns-sets" target="reqs">RQ-9 (wildcard-ns-sets)</loc></p>
  <p>In version 1.0 negated wildcards were restricted to negating only one
namespace.  Experience suggests that at least at the component level this
<emph>may</emph> need to be expanded, but the verdict is out on this until
details of the change in interpretation of wildcards more generally (see <specref ref="RQ-36i"/>) are
worked out.</p>
  <p>Not sure whether final disposition of
corner cases wrt inheritance and weak wildcards mean we need this or
not . . .</p>
  <p>At the moment wildcards can only negate a single namespace.  To handle
certain cases which become possible because to the change in interpretation of
wildcards as subordinate to explicit elements (see <specref ref="RQ-36i"/>), it
may be necessary to negate/exclude a set of explicitly enumerated expanded
names.  This would be a change at the component level only.</p>
  <p>A related possibility, more likely motivated by versioning needs, would be
to provide, perhaps again only at the component level for now, for
<emph>sets</emph> of namespace names to be negated.</p>
	  </issue>
<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>XML representations of the four basic types of wildcard, plus one attribute wildcard.</p>
</note>
    <div3 id="Wildcard_details">
     <head>The Wildcard Schema Component</head>
   <p>The wildcard schema component has the following properties:</p>
     <compdef name="Wildcard" abbrev="w"/>
<p><propref comp="w" prop="namespace constraint"/> provides for <termref def="key-vn">validation</termref> of attribute and element items 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 name) are namespace-qualified with a namespace
other than the specified namespace name;</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 names 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 comp="w" prop="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 top-level declaration for the item
available, or the item &must; have an <code>xsi:type</code>, and the
item &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 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>
if you
can, don't worry if you can't.</p>
       </def>
      </gitem>
     </glist>
    </p>
     <p>See <specref ref="cAnnotations"/> for information on the role of the
<propref comp="w" prop="annotations"/> property.</p>
    </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 comp="p" prop="min occurs">The &v-value; of the <code>minOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
  <propmap comp="p" prop="max occurs"><pt>unbounded</pt>, if the <code>maxOccurs</code>
&i-attribute; equals <pt>unbounded</pt>, otherwise the &v-value; of the <code>maxOccurs</code>
&i-attribute;, if present, otherwise <code>1</code>.</propmap>
<propmap comp="p" prop="term">A wildcard as given below:</propmap>
</reprcomp>
 <reprcomp abstract="Wildcard" ref="Wildcard_details">
<propmap comp="w" prop="namespace constraint">Dependent on the &v-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 &v-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 names 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 &v-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 comp="w" prop="process contents">The &v-value; of the
<code>processContents</code> &i-attribute;, if present, otherwise <pt>strict</pt>.</propmap>
<propmap comp="w" prop="annotations">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>
   </div3>
    <div3>
     <head>Constraints on XML Representations of Wildcards</head>
    <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 corresponding particle and model group &must; satisfy the conditions set
out in <specref ref="coss-modelGroup"/> and <specref ref="coss-particle"/>.</p>
  </constraintnote>
    </div3>
    <div3>
     <head>Wildcard Validation Rules</head>
    <constraintnote type="cvc" id="cvc-wildcard">
     <head>Item Valid (Wildcard)</head>
     <p>For an element or attribute information item to be locally <termref def="key-vn">valid</termref> with respect to a wildcard
constraint
      its <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.element">namespace name</xpropref> &must; be <termref def="key-vn">valid</termref> with respect to the wildcard constraint, as defined in <specref ref="cvc-wildcard-namespace"/>.</p>
     <p>When this constraint applies
      <olist role="case.mxm">
       <item>
        <p role="if"><propref comp="w" prop="process contents"/> is <pt>lax</pt></p>
        <p role="then">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"/>.</p>
       </item>
       <item>
        <p role="if"><propref comp="w" prop="process contents"/> is <pt>strict</pt></p>
        <p role="then">the item's <termref def="key-dd">context-determined declaration</termref> is <pt>mustFind</pt>.</p>
       </item>
       <item>
        <p role="if"><propref comp="w" prop="process contents"/> is <pt>skip</pt></p>
        <p role="then">the item's <termref def="key-dd">context-determined declaration</termref> is <pt>skip</pt>.</p>
       </item>
      </olist>
     </p>
    </constraintnote>
    <constraintnote type="cvc" id="cvc-wildcard-namespace">
     <head>Wildcard allows Namespace Name</head>
     <p>For a value which is either a namespace name or <termref def="key-null">absent</termref> to be <termref def="key-vn">valid</termref> with respect to a wildcard constraint (the
value of a <propref comp="w" prop="namespace constraint"/>)
      <olist role="or.mxm">
       <item>
        <p>The constraint &is.xm; <pt>any</pt>.</p>
       </item>
       <item>
        <olist role="And.ixm">
         <item>
          <p>The constraint is a pair of <pt>not</pt> and a namespace name or
<termref def="key-null">absent</termref> (<termdef id="key-nst" term="namespace test" role="local">call this the <term>namespace test</term>)</termdef>.</p>
         </item>
         <item>
            <p>The value &isnot.xmnb; identical to the <termref def="key-nst">namespace test</termref>.</p>
           </item>
         <item>
          <p>The value &isnot.xmnb; <termref def="key-null">absent</termref>.</p>
         </item>
        </olist>        
       </item>
       <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>
    </div3>
    <div3>
     <head>Wildcard Information Set Contributions</head>
     <p>None as such.</p>
    </div3>
    <div3 id="coss-wildcard">
     <head>Constraints on Wildcard Schema Components</head>
  <p>All wildcards (see <specref ref="Wildcards"/>) &must; satisfy the following constraint.</p>
  <constraintnote type="cos" id="w-props-correct">
   <head>Wildcard Properties Correct</head>
   <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>
  </constraintnote>
  <p>The following constraints define a relation appealed to elsewhere in this specification.</p>
  <constraintnote type="cos" id="cos-ns-subset">
  <head>Wildcard Subset</head>
   <p>For a namespace constraint (call it <local>sub</local>) to be an intensional subset of
another namespace constraint (call it <local>super</local>)
    <olist role="or.mxm">
     <item>
      <p><local>super</local> &is.xm; <pt>any</pt>.</p>
     </item>
     <item>
      <olist role="And.ixm">
       <item><p><local>sub</local> &is.xm; a pair of <pt>not</pt> and
a value
(a namespace name or
<termref def="key-null">absent</termref>).</p></item>
       <item><p><local>super</local> &is.xm; a pair of <pt>not</pt> and the same value.</p></item>
      </olist>
     </item>
     <item>
      <olist role="And.ixm">
       <item>
        <p><local>sub</local> &is.xm; a set whose members are either namespace names or
<termref def="key-null">absent</termref>.</p>
       </item>
       <item>
        <olist role="Or.ixm">
       <item>
        <p><local>super</local> &is.xm; the same set or a superset thereof.</p>
       </item>
         <item>
         <p><local>super</local> &is.xm; a pair of <pt>not</pt> and a value (a namespace name or
<termref def="key-null">absent</termref>)
and neither that value nor <termref def="key-null">absent</termref> &is.xm; in <local>sub</local>'s set.</p>
        </item>
      </olist>
       </item>
      </olist>
     </item>
    </olist>
   </p>
  </constraintnote>
     <constraintnote id="cos-aw-union" type="cos">
   <head>Attribute Wildcard Union</head>
   <p>For a wildcard's <propref comp="w" prop="namespace constraint"/> value to be the intensional
union of two other such values (call them <local>O1</local> and <local>O2</local>):
    <olist role="case.mxm">
     <item>
      <p role="if"><local>O1</local> and <local>O2</local> are the same value</p>
      <p role="then">that value &is.xm; the value.</p>
     </item>
     <item>
      <p role="if">either <local>O1</local> or <local>O2</local> is <pt>any</pt></p>
      <p role="then"><pt>any</pt> &is.xm; the value.</p>
     </item>
     <item>
      <p role="if">both <local>O1</local> and <local>O2</local> are sets of (namespace names
or <termref def="key-null">absent</termref>)</p>
      <p role="then">the union of those sets &is.xm; the value.</p>
     </item>
     <item>
      <p role="if">the two are negations of different values (namespace names or <termref def="key-null">absent</termref>)</p>
      <p role="then">a pair of <pt>not</pt> and <termref def="key-null">absent</termref> &is.xm; the value.</p>
     </item>
     <item>
      <p role="if">either <local>O1</local> or <local>O2</local> is a pair of <pt>not</pt>
and a namespace name and the other is a set of (namespace names or <termref def="key-null">absent</termref>) (call this set <local>S</local>)</p>
      <p role="then">
       <olist role="case.ixm">
        <item>
         <p role="if">the set <local>S</local> includes both the negated namespace name and <termref def="key-null">absent</termref></p>
         <p role="then"><pt>any</pt> &is.xm; the value.</p>
        </item>
        <item>
         <p role="if">the set <local>S</local> includes the negated namespace name but not <termref def="key-null">absent</termref></p>
         <p role="then">a pair of <pt>not</pt> and <termref def="key-null">absent</termref> &is.xm; the value.</p>
        </item>
        <item>
         <p role="if">the set <local>S</local> includes <termref def="key-null">absent</termref>
but not the negated namespace name</p>
         <p role="then">the union is not expressible.</p>
        </item>
        <item>
         <p role="if">the set <local>S</local> does not include either the negated namespace
name or <termref def="key-null">absent</termref></p>
         <p role="then">whichever of <local>O1</local> or <local>O2</local> is a pair of <pt>not</pt>
and a namespace name &is.xm; the value.</p>
        </item>
       </olist>
      </p>
     </item>
     <item>
      <p role="if">either <local>O1</local> or <local>O2</local> is a pair of <pt>not</pt>
and <termref def="key-null">absent</termref> and the other is a set of
(namespace names or <termref def="key-null">absent</termref>) (again, call this
set <local>S</local>)</p>
      <p role="then">
       <olist role="Case.ixm">
        <item>
         <p role="if">the set <local>S</local> includes  <termref def="key-null">absent</termref></p>
         <p role="then"><pt>any</pt> &is.xm; the value.</p>
        </item>
        <item>
         <p role="if">the set <local>S</local> does not include <termref def="key-null">absent</termref></p>
         <p role="then">a pair of <pt>not</pt> and <termref def="key-null">absent</termref> &is.xm; the value.</p>
        </item>
       </olist>
      </p>
     </item>
    </olist>
    In the case where there are more than two values, the intensional
union is determined by identifying the intensional union of two
of the values as above, then the intensional union of that value with
the third (providing the first union was expressible), and so on as required.
   </p>
  </constraintnote>
  <constraintnote id="cos-aw-intersect" type="cos">
   <head>Attribute Wildcard Intersection</head>
   <p>For a wildcard's <propref comp="w" prop="namespace constraint"/> value to be the intensional
intersection of two other such values (call them <local>O1</local> and <local>O2</local>):
    <olist role="case.mxm">
     <item>
      <p role="if"><local>O1</local> and <local>O2</local> are the same value</p>
      <p role="then">that value &is.xm; the value.</p>
     </item>
     <item>
      <p role="if">either <local>O1</local> or <local>O2</local> is <pt>any</pt></p>
      <p role="then">the
other &is.xm; the value.</p>
     </item>
     <item>
      <p role="if">either <local>O1</local> or <local>O2</local> is a pair of <pt>not</pt>
and a value (a namespace name or <termref def="key-null">absent</termref>) and the other is a set of (namespace names or <termref def="key-null">absent</termref>)</p>
      <p role="then">that set,
minus the negated value if it was in the set, minus <termref def="key-null">absent</termref> if it was in the set, &is.xm; the value.</p>
     </item>
     <item>
      <p role="if">both <local>O1</local> and <local>O2</local> are sets of (namespace names
or <termref def="key-null">absent</termref>)</p>
      <p role="then">the intersection of those sets &is.xm; the value.</p>
     </item>
     <item>
      <p role="if">the two are negations of different namespace names</p>
      <p role="then">the intersection is not expressible.</p>
     </item>
     <item>
      <p role="if">the one is a negation of a namespace name and the other is a
negation of  <termref def="key-null">absent</termref></p>
      <p role="then">the one which is the negation of a namespace name &is.xm; the value.</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>
    </div3>
   </div2>
<div2 id="c&Constraint;_Definitions">
    <head>&Constraint; Definitions</head>
<p>&Constraint; definition components provide for uniqueness and
reference constraints with respect to the contents of multiple elements and attributes.</p>
 <note role="example">
  <eg xml:space="preserve"><![CDATA[<xs:key name="fullName">
 <xs:selector xpath=".//person"/>
 <xs:field xpath="forename"/>
 <xs:field xpath="surname"/>
</xs:key>

<xs:keyref name="personRef" refer="fullName">
 <xs:selector xpath=".//personPointer"/>
 <xs:field xpath="@first"/>
 <xs:field xpath="@last"/>
</xs:keyref>

<xs:unique name="nearlyID">
 <xs:selector xpath=".//*"/>
 <xs:field xpath="@id"/>
</xs:unique>]]></eg>
  <p>XML representations for the three kinds of &constraint; definitions.</p>
 </note>
    <div3 id="&Constraint;_Definition_details">
     <head>The &Constraint; Definition Schema Component</head>
     <p>The &constraint; definition schema component has the following
properties:
</p>   

	  <issue id="RQ-14i" role="1.1">
	    <p><loc href="&reqs;#id-inconsistency" target="reqs">RQ-14 (id-inconsistency)</loc></p>
    <p>Version 1.0 provided no home for annotations on <code>xs:field</code>
and <code>xs:select</code>.  The overall reworking of annotation at the
component level described in <specref ref="RQ-131i"/> will take care of this.</p>
    <resolution>
     <p>See <specref ref="RQ-131i"/>.</p>
    </resolution>
	    </issue>
  <compdef name="&Constraint; Definition" abbrev="icd"/>

<p>&Constraint; definitions are identified by their <propref comp="icd" prop="name"/> and <propref comp="icd" prop="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 comp="icd" prop="&constraint; category"/> 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 comp="icd" prop="selector"/>, of the tuples resulting from
evaluation of the <propref comp="icd" prop="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 comp="icd" prop="selector"/>, of the tuples resulting from
evaluation of the <propref comp="icd" prop="fields"/> XPath expression(s), with those of the <propref comp="icd" prop="referenced key"/>. </p></item>
</ulist> </p>
<p>These constraints are specified along side the specification of types for the
attributes and elements involved, i.e. something declared as of type integer
&can.xm; 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 apply 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 number, but non-conflicting if
they were both strings, or one was a string and one a number.  Values of
differing type can only be equal if one type is &derived; from the other, and the
value is in the value space of both.</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-nillable;</p></item>
     <item>
      <p>The comparison between <pt>keyref</pt> <propref comp="icd" prop="fields"/> and
<pt>key</pt> or <pt>unique</pt> <propref comp="icd" prop="fields"/> is by value equality,
not by string equality.</p>
     </item>
    </ulist>
    <p><propref comp="icd" prop="selector"/> specifies a restricted XPath (<bibref ref="bib-xpath"/>) expression relative to
instances of the element being declared.  This &must; identify a node set of
subordinate elements (i.e. contained within the declared element) to which the constraint applies.</p>
    <p><propref comp="icd" prop="fields"/> specifies XPath expressions relative to each
element selected by a <propref comp="icd" prop="selector"/>.  This &must; identify
a single node (element or attribute) 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 comp="icd" prop="fields"/>s, to cater to multi-field keys,
keyrefs, and uniqueness constraints.
     </p>
     <p>In order to reduce the burden on implementers, in particular
implementers of streaming processors, only restricted subsets of XPath
expressions are allowed in <propref comp="icd" prop="selector"/> and <propref comp="icd" prop="fields"/>.  The details are given in <specref ref="coss-&constraint;"/>.</p>
 <note>
      <p>Provision for multi-field keys etc. goes beyond what is supported by <code>xsl:key</code>.</p>
     </note>
     <p>See <specref ref="cAnnotations"/> for information on the role of the
<propref comp="icd" prop="annotations"/> property.</p>
    </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 comp="icd" prop="name">The &v-value; of the <code>name</code> &i-attribute;</propmap>
  <propmap comp="icd" prop="target namespace">The &v-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <code>schema</code>
element information item.</propmap>
<propmap comp="icd" prop="&constraint; category">One of <pt>key</pt>, <pt>keyref</pt> or
<pt>unique</pt>, depending on the item.</propmap>
<propmap comp="icd" prop="selector">A restricted XPath expression corresponding to the &v-value; of
the <code>xpath</code> &i-attribute; of the <eltref ref="selector"/> element information item among the &i-children;</propmap>
<propmap comp="icd" prop="fields">A sequence of XPath expressions, corresponding to the
&v-value;s of the <code>xpath</code> &i-attribute;s of the <eltref ref="field"/> element information item &i-children;, in order.</propmap>
<propmap comp="icd" prop="referenced key">If the item is a <eltref ref="keyref"/>, the
&constraint; definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>refer</code> &i-attribute;, otherwise <termref def="key-null">absent</termref>.</propmap>
<propmap comp="icd" prop="annotations">The annotations corresponding to the <eltref ref="annotation"/> element information item in the
&i-children;, if present, and in the <eltref ref="selector"/> and <eltref ref="field"/> &i-children;, if present, otherwise <termref def="key-null">absent</termref>.</propmap>
</reprcomp></reprdef>
    
    <note role="example">
     <eg xml:space="preserve"><![CDATA[<xs:element name="vehicle">
 <xs:complexType>
  . . .
  <xs:attribute name="plateNumber" type="xs:integer"/>
  <xs:attribute name="state" type="twoLetterCode"/>
 </xs:complexType>
</xs:element>

<xs:element name="state">
 <xs:complexType>
  <xs:sequence>
   <xs:element name="code" type="twoLetterCode"/>
   <xs:element ref="vehicle" maxOccurs="unbounded"/>
   <xs:element ref="person" maxOccurs="unbounded"/>
  </xs:sequence>
 </xs:complexType>

 <xs:key name="reg"> <!-- vehicles are keyed by their plate within states -->
  <xs:selector xpath=".//vehicle"/>
  <xs:field xpath="@plateNumber"/>
 </xs:key>
</xs:element>

<xs:element name="root">
 <xs:complexType>
  <xs:sequence>
   . . .
   <xs:element ref="state" maxOccurs="unbounded"/>
   . . .
  </xs:sequence>
 </xs:complexType>

 <xs:key name="state"> <!-- states are keyed by their code -->
  <xs:selector xpath=".//state"/>
  <xs:field xpath="code"/>
 </xs:key>

 <xs:keyref name="vehicleState" refer="state">
  <!-- every vehicle refers to its state -->
  <xs:selector xpath=".//vehicle"/>
  <xs:field xpath="@state"/>
 </xs:keyref>

 <xs:key name="regKey"> <!-- vehicles are keyed by a pair of state and plate -->
  <xs:selector xpath=".//vehicle"/>
  <xs:field xpath="@state"/>
  <xs:field xpath="@plateNumber"/>
 </xs:key>

 <xs:keyref name="carRef" refer="regKey"> <!-- people's cars are a reference -->
  <xs:selector xpath=".//car"/>
  <xs:field xpath="@regState"/>
  <xs:field xpath="@regPlate"/>
 </xs:keyref>

</xs:element>

<xs:element name="person">
 <xs:complexType>
  <xs:sequence>
   . . .
   <xs:element name="car">
    <xs:complexType>
     <xs:attribute name="regState" type="twoLetterCode"/>
     <xs:attribute name="regPlate" type="xs:integer"/>
    </xs:complexType>
   </xs:element>
  </xs:sequence>
 </xs:complexType>
</xs:element>]]></eg>
     <p>A <code>state</code> element is defined, which
contains a <code>code</code> child and some <code>vehicle</code> and <code>person</code>
children.  A <code>vehicle</code> in turn has a <code>plateNumber</code> attribute,
which is an integer, and a <code>state</code> attribute.  State's
<code>code</code>s are a key for them within the document.  Vehicle's
<code>plateNumber</code>s are a key for them within states, and
<code>state</code> and
<code>plateNumber</code> is asserted to be a <pt>key</pt> for
<code>vehicle</code> within the document as a whole.  Furthermore, a <code>person</code> element has
an empty <code>car</code> child, with <code>regState</code> and
<code>regPlate</code> attributes, which are then asserted together to refer to
<code>vehicle</code>s via the <code>carRef</code> constraint.  The requirement
that a <code>vehicle</code>'s <code>state</code> match its containing
<code>state</code>'s <code>code</code> is not expressed here.</p>
    </note>
 </div3>
    <div3>
     <head>Constraints on XML Representations of &Constraint; Definitions</head>
    <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 corresponding &constraint; definition &must; satisfy the conditions set
out in <specref ref="coss-&constraint;"/>.</p>
  </constraintnote>
    </div3>
    <div3>
     <head>&Constraint; Definition Validation Rules</head>
 <constraintnote type="cvc" id="cvc-&constraint;">
  <head>&Constraint; Satisfied</head>
  <p>For an element information item to be locally <termref def="key-vn">valid</termref> with respect to an &constraint;
   <olist role="and.mxm">
    <item>
     <p>The <propref comp="icd" prop="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" role="local">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
either the context node 
<phrase diff="del" dg="wd2.silent">oran</phrase><phrase diff="add" dg="wd2.silent">or an</phrase>
element node among its descendants.</p>
    </item>
    <item>
     <p>For each node in the <termref def="key-tns">target node
set</termref> all of the <propref comp="icd" prop="fields"/>, with
that node as the context node, evaluate to either an empty node-set or
a node-set with exactly one member, which &has.xmh; a simple type.
<termdef id="key-ks" term="key-sequence" role="local">Call the
sequence of the type-determined values (as defined in <bibref ref="ref-xsp2"/>) of the <xpropref role="psviAnon">schema normalized
value</xpropref> of the element and/or attribute information items in
those node-sets in order the <term>key-sequence</term> of the
node</termdef>.</p>
    </item>
    <item>
     <p>
   <termdef id="key-qns" term="qualified node set" role="local">Call the subset of the <termref def="key-tns">target node set</termref> for
which all the <propref comp="icd" prop="fields"/> evaluate to a node-set with exactly one
member which is an element or attribute node with a simple type the <term>qualified node set</term></termdef>.
     <olist role="Case.ixm">
    <item id="c-u">
     <p role="if">the <propref comp="icd" prop="&constraint; category"/> is <pt>unique</pt></p>
     <p role="then">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 by <xtermref diff="del" href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#equal" dg="fpwd">Equal</xtermref><xtermref diff="add" href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#equality" dg="fpwd">Equality</xtermref> in <bibref ref="ref-xsp2"/>.</p>
    </item>
      <item id="c-k">
     <p role="if">the <propref comp="icd" prop="&constraint; category"/> is <pt>key</pt></p>
       <p role="then">
        <olist role="and.ixm">
         <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, as defined by <xtermref diff="del" href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#equal" dg="fpwd">Equal</xtermref><xtermref diff="add" href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#equality" dg="fpwd">Equality</xtermref> in <bibref ref="ref-xsp2"/>.</p>
    </item>
    <item id="c-nlbl">
     <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 comp="ed" prop="nillable"/> is <pt>true</pt>.</p>
    </item>
        </olist>
       </p>
    </item>
    <item id="cl-krv">
     <p role="if">the <propref comp="icd" prop="&constraint; category"/> is <pt>keyref</pt></p>
     <p role="then">for each member of the <termref def="key-qns">qualified node
set</termref> (call this the <local>keyref member</local>), there &is.xm; a <termref def="key-nt">node table</termref> associated with the
<propref comp="icd" prop="referenced key"/> in the <propref role="psvi" ref="e-id_constraint_table"/>
of the element information item (see <specref ref="sic-key"/>, which &is.xm;
understood as logically prior to this clause of this constraint, below) and
there &is.xm; an entry in that table whose
<termref def="key-ks">key-sequence</termref> is equal to the
<local>keyref member's</local> <termref def="key-ks">key-sequence</termref> member for
member, as defined by <xtermref diff="del" href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#equal" dg="fpwd">Equal</xtermref><xtermref diff="add" href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#equality" dg="fpwd">Equality</xtermref> in <bibref ref="ref-xsp2"/>.</p>
    </item>
   </olist>
     </p>
    </item>
   </olist>
  </p>
  <note>
   <p>The use of  <xpropref role="psviAnon">schema normalized value</xpropref> in the definition
of <termref def="key-ks">key sequence</termref> above means that
<pt>default</pt> or <pt>fixed</pt> value constraints &may.xm; play a part in <termref def="key-ks">key sequence</termref>s.</p>
  </note>
 </constraintnote>
     <note>
      <p>Because the validation of <pt>keyref</pt> (see <clauseref ref="cl-krv"/>) depends on finding
appropriate entries in a element information item's <termref def="key-nt">node
table</termref>, and <termref def="key-nt">node tables</termref> are assembled
strictly recursively from the node tables of descendants, only element
information items within the sub-tree rooted at the element information item
being <termref def="key-vn">validated</termref> can be referenced successfully.</p>
     </note>
 <note>
  <p>Although this specification defines a &PSVI;
contribution which would enable schema-aware processors to implement <clauseref ref="c-nlbl"/> 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 comp="ed" prop="nillable"/> property &must; be available.</p>
 </note>
    </div3>
    <div3>
     <head>&Constraint; Definition Information Set Contributions</head>
 <constraintnote type="sic" id="sic-key">
  <head>&Constraint; Table</head>
  <p><termdef id="key-ec" term="eligible &constraint;" role="local">An <term>eligible
&constraint;</term> of an element information item is one such that <clauseref ref="c-u"/> or <clauseref ref="c-k"/> of <specref ref="cvc-&constraint;"/> is satisfied
with respect to that item and that constraint,
or such that any of the element information item &i-children; of that item have an
<propref role="psvi" ref="e-id_constraint_table"/> property whose value has an entry for that constraint</termdef>.</p>
  <p><termdef id="key-nt" term="node table" role="local">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 a property as follows:</p>
  <proplist item="element" role="psvi">
    <propdef id="e-id_constraint_table" name="&constraint; table">
     one
<local>&Constraint; Binding</local>
information item for each <termref def="key-ec">eligible &constraint;</termref>, with
properties as follows:
     <proplist item="&Constraint; Binding" role="psvi">
      <propdef id="cb-definition" name="definition">The <termref def="key-ec">eligible &constraint;</termref>.</propdef>
      <propdef id="cb-node_table" name="node table">A <termref def="key-nt">node table</termref> with one entry for every <termref def="key-ks">key-sequence</termref> (call it <local>k</local>) and
node (call it <local>n</local>) such that
   <olist role="or.ixm">
    <item id="c-kc">
     <p>There is an entry in one of the <termref def="key-nt">node
tables</termref> associated with the <propref role="psvi" ref="cb-definition"/> in an <local>&Constraint; Binding</local>
information item in at least one of the <propref role="psvi" ref="e-id_constraint_table"/>s of the element information item
&i-children; of the element information item whose <termref def="key-ks">key-sequence</termref> is <local>k</local> and whose node
is <local>n</local>;</p>
    </item>
    <item>
     <p><local>n</local> appears with <termref def="key-ks">key-sequence</termref> <local>k</local> in the <termref def="key-qns">qualified node set</termref> for the <propref role="psvi" ref="cb-definition"/>.</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 <clauseref ref="c-kc"/> above. Note
that if all the conflicting entries arose under <clauseref ref="c-kc"/> above, this means no entry at all will appear for the
offending <termref def="key-ks">key-sequence</termref>.</propdef>
     </proplist>
    </propdef>
   </proplist>
  <note>
   <p>The complexity of the above arises from the fact that
<pt>keyref</pt> &constraint;s &can.xm; be defined on domains distinct from the
embedded domain of the &constraint; they reference, or <phrase diff="del" dg="may">the domains may be</phrase><phrase diff="add" dg="may">on domains which are</phrase> 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 <local>&Constraint; Binding</local> 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
<propref role="psvi" ref="e-id_constraint_table"/> properties in the
&PSVI;. In other words, the above constraints <phrase diff="del" dg="may">may</phrase><phrase diff="add" dg="may">are to</phrase>
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>
    </div3>
    <div3 id="coss-&constraint;">
     <head>Constraints on &Constraint; Definition Schema Components</head>
  <p>All &constraint; definitions (see <specref ref="c&Constraint;_Definitions"/>) &must; satisfy the following constraint.</p>
  <constraintnote type="cos" id="c-props-correct">
   <head>&Constraint; Definition Properties Correct</head>
   <olist role="And.mxm">
    <item>
     <p>The values of the properties of an &constraint; definition &are.xm; 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 comp="icd" prop="&constraint; category"/> is
<pt>keyref</pt>, the cardinality of the <propref comp="icd" prop="fields"/> <phrase diff="del" dg="modals">&must; equal</phrase><phrase diff="add" dg="modals">is equal to</phrase> that of the <propref comp="icd" prop="fields"/> of the <propref comp="icd" prop="referenced
key"/>.</p>
    </item>
   </olist>
  </constraintnote>
     <constraintnote type="cos" id="c-selector-xpath">
      <head>Selector Value OK</head>
      <olist role="And.mxm">
       <item>
      <p>The <propref comp="icd" prop="selector"/> &is.xm; a valid XPath
expression, as defined in <bibref ref="bib-xpath"/>.</p>
       </item>
       <item>
        <olist role="Or.ixm">
         <item>
          <p>It <phrase diff="del" dg="modals">&must; conform</phrase><phrase diff="add" dg="modals">conforms</phrase> to the following extended BNF:
        <scrap lang="ebnf">
         <head>Selector XPath expressions</head>
         <prod id="Selector">
          <lhs>Selector</lhs>
          <rhs><nt def="Path">Path</nt> ( '|' <nt def="Path">Path</nt> )*</rhs>
         </prod>
         <prod id="Path">
          <lhs>Path</lhs>
          <rhs>('.//')? <nt def="Step">Step</nt> ( '/' <nt def="Step">Step</nt> )*</rhs>
         </prod>
         <prod id="Step">
          <lhs>Step</lhs>
          <rhs>'.' | <nt def="NameTest">NameTest</nt></rhs>
         </prod>
         <prod id="NameTest">
          <lhs>NameTest</lhs>
          <rhs><xnt href="http://www.w3.org/TR/REC-xml-names/#NT-QName">QName</xnt> | '*' | <xnt href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</xnt> ':' '*'</rhs>
         </prod>
        </scrap>
        </p>
         </item>
         <item>
          <p>It &is.xm; an XPath expression involving the <code>child</code> axis whose abbreviated form is
as given above.</p>
         </item>
        </olist>
       </item>
      </olist>
      <p>For readability, whitespace &may; be used in selector XPath expressions even though not
explicitly allowed by the grammar: <nt def="whitespace">whitespace</nt> &may; be freely added within patterns before or after any <nt def="token">token</nt>.
      <scrap lang="ebnf">
         <head>Lexical productions</head>
         <prod id="token">
          <lhs>token</lhs>
          <rhs>'.' | '/' | '//' | '|' | '@' | <nt def="NameTest">NameTest</nt></rhs>
         </prod>
         <prod id="whitespace">
          <lhs>whitespace</lhs>
          <rhs><xnt href="http://www.w3.org/TR/REC-xml/#NT-S">S</xnt></rhs>
         </prod>
        </scrap></p>
      <p>
When tokenizing, the longest possible token is always returned.</p>      
     </constraintnote>
     <constraintnote type="cos" id="c-fields-xpaths">
      <head>Fields Value OK</head>
      <olist role="And.mxm">
       <item>
      <p>Each member of the <propref comp="icd" prop="fields"/> &is.xm; a valid XPath
expression, as defined in <bibref ref="bib-xpath"/>.</p>
       </item>
       <item>
        <olist role="Or.ixm">
         <item>
          <p>It <phrase diff="del" dg="modals">&must; conform</phrase><phrase diff="add" dg="modals">conforms</phrase> to the extended BNF given
above for <nt def="Selector">Selector</nt>, with the following modification:
        <scrap>
         <head>Path in Field XPath expressions</head>
         <prod id="fPath">
          <lhs>Path</lhs>
          <rhs>('.//')? ( <nt def="Step">Step</nt> '/' )* ( <nt def="Step">Step</nt> | '@' <nt def="NameTest">NameTest</nt> )</rhs>
         </prod>
        </scrap>
           This production differs from the one above in allowing the final
step to match an attribute node.
        </p>
         </item>
         <item>
          <p>It &is.xm; an XPath expression involving the <code>child</code> and/or <code>attribute</code> axes whose abbreviated form is
as given above.</p>
         </item>
        </olist>
       </item>
      </olist>
      <p>For readability, whitespace &may; be used in field XPath expressions even though not
explicitly allowed by the grammar: <nt def="whitespace">whitespace</nt> &may; be freely added within patterns before or after any <nt def="token">token</nt>.
      </p>
      <p>When tokenizing, the longest possible token is always returned.</p>
     </constraintnote>
    </div3>
   </div2>
   <div2 id="cNotation_Declarations">
    <head>Notation Declarations</head>
    <p>Notation declarations reconstruct XML<phrase diff="del" dg="fpwd"> 1.0</phrase> NOTATION declarations.</p>
    <note role="example">
     <eg xml:space="preserve"><![CDATA[<xs:notation name="jpeg" public="image/jpeg" system="viewer.exe">]]></eg>
     <p>The XML representation of a notation declaration.</p>
    </note>
    <div3 id="Notation_Declaration_details">
     <head>The Notation Declaration Schema Component</head>
    <p>The notation declaration schema component has the following
properties:</p>

  <compdef name="Notation Declaration" abbrev="nd"/>
    <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/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#NOTATION">NOTATION</xtermref> simple type.</p>
     <p>See <specref ref="cAnnotations"/> for information on the role of the
<propref comp="nd" prop="annotations"/> property.</p>
    </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 comp="nd" prop="name">The &v-value; of the
<code>name</code> &i-attribute;</propmap>
  <propmap comp="nd" prop="target namespace">The &v-value; of the
<code>targetNamespace</code> &i-attribute; of the parent <code>schema</code>
element information item.</propmap>
<propmap comp="nd" prop="system identifier">The &v-value; of the <code>system</code>
&i-attribute;, if present, otherwise <termref def="key-null">absent</termref>.</propmap>
<propmap comp="nd" prop="public identifier">The &v-value; of the <code>public</code> &i-attribute;</propmap>
<propmap comp="nd" prop="annotations">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:simpleContent>
   &lt;xs:extension base="xs:hexBinary"&gt;
    &lt;xs:attribute name="pictype"&gt;
     &lt;xs:simpleType>
      &lt;xs:restriction base="xs:NOTATION">
       &lt;xs:enumeration value="jpeg"/>
       &lt;xs:enumeration value="png"/>
       . . .
      &lt;/xs:restriction>
     &lt;/xs:simpleType>
    &lt;/xs:attribute>
   &lt;/xs:extension>
  &lt;/xs:simpleContent>
 &lt;/xs:complexType&gt;
&lt;/xs:element&gt;

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

</note>
</div3>
    <div3>
     <head>Constraints on XML Representations of Notation Declarations</head>
 <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 corresponding notation definition &must; satisfy the conditions set
out in <specref ref="coss-notation"/>.</p>
  </constraintnote>
    </div3>
    <div3>
     <head>Notation Declaration Validation Rules</head>
     <p>None as such.</p>
    </div3>
    <div3>
     <head>Notation Declaration Information Set Contributions</head>
    <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/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#NOTATION">NOTATION</xtermref>, in the &PSVI; its parent element information item either has a property as follows:</p>
     <proplist item="element" role="psvi">
       <propdef id="e-notation" name="notation">An
<termref def="key-iso">item isomorphic</termref> to the notation declaration whose <propref comp="nd" prop="name"/> and <propref comp="nd" prop="target namespace"/> match the <termref def="q-local">local name</termref> and <termref def="q-uri">namespace name</termref> (as defined in <specref ref="src-qname"/>) of the attribute item's &v-value;</propdef>
      </proplist>
     <p>or has a pair of properties as follows:</p>
     <proplist item="element" role="psvi">
      <propdef id="e-notation_system" name="notation system">The value of the <propref comp="nd" prop="system identifier"/> of that notation declaration.</propdef>
      <propdef id="e-notation_public" name="notation public">The value of the <propref comp="nd" prop="public identifier"/> of that notation declaration.</propdef>
     </proplist>
     <note>
      <p>For compatibility, only one such attribute &should.xs; appear on any given
element.  If more than one such attribute <emph>does</emph> appear, which one
supplies the infoset property or properties above is not defined.</p>
     </note>
    </constraintnote>
    </div3>
    <div3 id="coss-notation">
     <head>Constraints on Notation Declaration Schema Components</head>
  <p>All notation declarations (see <specref ref="cNotation_Declarations"/>) &must; satisfy the following constraint.</p>
  <constraintnote type="cos" id="n-props-correct">
   <head>Notation Declaration Correct</head>
     <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>   
  </constraintnote>
    </div3>
   </div2>
   <div2 id="cAnnotations">
    <head>Annotations</head>
    <p>Annotations provide for human- and machine-targeted annotations of
schema components.</p>
    <note role="example">
      <eg xml:space="preserve"><![CDATA[<xs:simpleType fn:note="special">
  <xs:annotation>
   <xs:documentation>A type for experts only</xs:documentation>
   <xs:appinfo>
    <fn:specialHandling>checkForPrimes</fn:specialHandling>
   </xs:appinfo>
  </xs:annotation>]]>
     </eg>
      <p>XML representations of three kinds of annotation.</p>
     </note>
<div3 id="Annotation_details">
     <head>The Annotation Schema Component</head>
    <p>The annotation schema component has the following
properties:</p>
<compdef name="Annotation" abbrev="a"/>
    <p><propref comp="a" prop="user information"/> is intended for human consumption,
<propref comp="a" prop="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 comp="a" prop="user information"/>, indication &should.xs; be given as to the identity of the (human) language used in the contents, using the <code>xml:lang</code> attribute.</p>
     <p><propref comp="a" prop="attributes"/> ensures that when schema authors take
advantage of the provision for adding attributes from namespaces other than the
XML Schema namespace to schema documents, they are available within the components
corresponding to the element items where such attributes appear.</p>
	  <issue id="RQ-19i" role="1.1">
	    <p><loc href="&reqs;#annotation-psvi" target="reqs">RQ-19 (annotation-psvi)</loc></p>
    <p>Out-of-band attributes were not always handled properly during component
construction from schema documents.  This is fixed by the overall reworking of
annotation construction described in <specref ref="RQ-131i"/>.</p>
    <resolution>
     <p>See <specref ref="RQ-131i"/>.</p>
    </resolution>
	    </issue>
    <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">Schema
Component Constraints</termref> it <emph>cannot</emph> affect the <termref def="key-vn">validation</termref> of element information items.</p>
    </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 comp="a" prop="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 comp="a" prop="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>
  <propmap comp="a" prop="attributes">A sequence of attribute information items, namely
those allowed by the attribute wildcard in the type definition for the <eltref ref="annotation"/> item itself or for the enclosing items which correspond to the component within which the annotation component is located.</propmap>
</reprcomp></reprdef>
<p>The annotation component corresponding to the <eltref ref="annotation"/>
element in the example above will have one element item in each of its <propref comp="a" prop="user information"/> and <propref comp="a" prop="application information"/> and one attribute item in its <propref comp="a" prop="attributes"/>.</p></div3>
    <div3>
     <head>Constraints on XML Representations of Annotations</head>
 <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 corresponding annotation &must; satisfy the conditions set
out in <specref ref="coss-annotation"/>.</p>
  </constraintnote>
    </div3>
    <div3>
     <head>Annotation Validation Rules</head>
     <p>None as such.</p>
    </div3>
    <div3>
     <head>Annotation Information Set Contributions</head>
     <p>None as such: the addition of annotations to the &PSVI; is
covered by the &PSVI; contributions of the enclosing components.</p>
    </div3>
    <div3 id="coss-annotation">
     <head>Constraints on Annotation Schema Components</head>
  <p>All annotations (see <specref ref="cAnnotations"/>) &must; satisfy the following constraint.</p>
  <constraintnote type="cos" id="an-props-correct">
   <head>Annotation Correct</head>
   <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>
  </constraintnote>
    </div3>
   </div2>
<div2 id="Simple_Type_Definitions">
    <head>Simple Type Definitions</head>
 <note>
  <p>This section consists of a combination of non-normative versions of
normative material from <bibref ref="ref-xsp2"/>, for local cross-reference
purposes, and normative material relating to the interface between schema
components defined in this specification and the simple type definition component.</p>
 </note>
    <p>Simple type definitions provide for constraining character information item &i-children; of element and attribute
information items.</p>
<note role="example">
      <eg xml:space="preserve"><![CDATA[<xs:simpleType name="fahrenheitWaterTemp">
 <xs:restriction base="xs:number">
  <xs:fractionDigits value="2"/>
  <xs:minExclusive value="0.00"/>
  <xs:maxExclusive value="100.00"/>
 </xs:restriction>
</xs:simpleType>]]></eg>
 <p>The XML representation of a simple type definition.</p>
     </note>
    <div3 id="Simple_Type_Definition_details">
     <head>(non-normative) The Simple Type Definition Schema Component</head>
<p>The simple type definition schema component has the following properties:
</p>
 <compdef name="Simple Type Definition" abbrev="std"/>

   
<p>Simple types are identified by their <propref comp="std" prop="name"/> and <propref comp="std" prop="target namespace"/>.  Except
for anonymous simple types (those with no <propref comp="std" prop="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 comp="std" prop="name"/>s and <propref comp="ctd" prop="target namespace"/>s
are provided for reference from
instances (see <specref ref="xsi_type"/>), and for use in the XML
representation of schema components
(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 comp="std" prop="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="cElement_Declarations"/> and <specref ref="cAttribute_Declarations"/>. </p>
</note>
     <p>A simple type definition with an empty specification for <propref comp="std" prop="final"/> can be used as the
<propref comp="std" prop="base type definition"/> for other types &derived; by either of
extension or restriction, or as the <propref comp="std" prop="item type definition"/> in
the definition of a list, or in the <propref comp="std" prop="member type definitions"/> of
a union; the explicit values <pt>extension</pt>, <pt>restriction</pt>,
<pt>list</pt> and <pt>union</pt> prevent further
&derivations; by extension (to yield a complex type) and restriction (to yield a
simple type) and use in &constructing; lists and unions respectively.</p>
<p><propref comp="std" prop="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 comp="std" prop="base type definition"/>), which is the <termref def="key-simpleUrType">simple 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 which is not itself &derived; by restriction from a
list or union respectively. Each
<emph>atomic</emph> type is ultimately a restriction of exactly one such
built-in primitive datatype, which is its <propref comp="std" prop="primitive type definition"/>.</p>
<p><propref comp="std" prop="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 comp="std" prop="primitive type definition"/>.  Therefore, the value
space and lexical space (i.e. what is <termref def="key-vn">validated</termref> by any atomic simple type) is determined by the
pair (<propref comp="std" prop="primitive type definition"/>, <propref comp="std" prop="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 comp="std" prop="item type definition"/>.  The item type specified
&mustnot; 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 comp="std" prop="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 comp="std" prop="member type definitions"/>.  As in the case of
<pt>list</pt>, the <propref comp="std" prop="facets"/>
apply to the union itself, and are restricted to those appropriate for unions.</p>
 
 <p>The <termref def="key-simpleUrType">simple ur-type definition</termref>
&must; <emph>not</emph> be named as the <propref comp="std" prop="base type definition"/> of any user-defined atomic simple type definitions:  as it has no constraining facets, this would be incoherent.</p>
     <p>See <specref ref="cAnnotations"/> for information on the role of the
<propref comp="std" prop="annotations"/> property.</p>
    </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 comp="std" prop="name">The &v-value; of the <code>name</code> &i-attribute; if present, otherwise <termref def="key-null">absent</termref>.</propmap>
  <propmap comp="std" prop="target namespace">The &v-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 comp="std" prop="base type definition">
   <olist role="Caseval">
    <item>
     <p role="if">the <eltref ref="restriction"/> alternative is chosen</p>
     <p role="then">the type definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>base</code> &i-attribute; of <eltref ref="restriction"/>, if present, otherwise the
type definition corresponding to the <eltref ref="simpleType"/> among
the &i-children; of <eltref ref="restriction"/>.</p>
    </item>
    <item>
     <p role="if">the <eltref ref="list"/> or <eltref ref="union"/> alternative is chosen</p>
     <p role="then">the <termref def="simple-ur-type-itself">simple ur-type definition</termref>.</p>
    </item>
   </olist>
  </propmap>
  <propmap comp="std" prop="final">As for the <propref comp="ctd" prop="prohibited substitutions"/> property of
complex type definitions, but using the
<code>final</code> and <code>finalDefault</code> &i-attributes; in place of the
<code>block</code> and <code>blockDefault</code>
&i-attributes; and with the
relevant set being <code>{</code><pt>extension</pt>,
<pt>restriction</pt>, <pt>list</pt>, <pt>union</pt><code>}</code>.</propmap>
  <propmap comp="std" prop="variety">If the <eltref ref="list"/> alternative is chosen,
then <pt>list</pt>, otherwise if the <eltref ref="union"/> alternative is
chosen, then <pt>union</pt>, otherwise (the <eltref ref="restriction"/>
alternative is chosen), then the <propref comp="std" prop="variety"/> of the <propref comp="std" prop="base type definition"/>.</propmap>
</reprcomp>
  <p>If the <propref comp="std" prop="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 comp="std" prop="primitive type definition">The built-in primitive type
definition from which the <propref comp="std" prop="base type definition"/> is &derived;.</propmap>
   <propmap comp="std" prop="facets">A set of facet components <termref def="key-facets-restriction">constituting a restriction</termref>
of the <propref comp="std" prop="facets"/> of the
<propref comp="std" prop="base type definition"/> with respect to a
set of facet components corresponding to the appropriate element information items among the
&i-children; of <eltref ref="restriction"/> (i.e. those which specify facets, if any), as
defined in <specref ref="st-restrict-facets"/>.</propmap>
</reprcomp>
  <p>If the <propref comp="std" prop="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 comp="std" prop="item type definition">
    <olist role="Caseval">
     <item>
      <p role="if">the <eltref ref="list"/> alternative is chosen</p>
      <p role="then">the type definition <termref def="src-resolve">resolved</termref> to by the
&v-value; of the <code>itemType</code> &i-attribute; of <eltref ref="list"/>, if present, otherwise the
type definition corresponding to the <eltref ref="simpleType"/> among
the &i-children; of <eltref ref="list"/>.</p>
     </item>
     <item>
      <p role="if">the <eltref ref="restriction"/> option is chosen</p>
      <p role="then">the <propref comp="std" prop="item type definition"/> of the <propref comp="std" prop="base type definition"/>.</p>
     </item>
    </olist>
   </propmap>
   <propmap comp="std" prop="facets">If the <eltref ref="restriction"/> alternative is
chosen, a set of facet components <termref def="key-facets-restriction">constituting a restriction</termref>
of the <propref comp="std" prop="facets"/> of the
<propref comp="std" prop="base type definition"/> with respect to a
set of facet components corresponding to the appropriate element information items among the
&i-children; of <eltref ref="restriction"/> (i.e. those which specify facets, if any), as
defined in <specref ref="st-restrict-facets"/>, otherwise the empty set.</propmap>
</reprcomp>
  <p>If the <propref comp="std" prop="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 comp="std" prop="member type definitions"><olist role="Caseval">
     <item>
      <p role="if">the <eltref ref="union"/> alternative is chosen</p>
      <p role="then"><termdef id="key-exm" term="explicit members" role="local">define the
<term>explicit members</term> as</termdef> the type definitions <termref def="src-resolve">resolved</termref> to by the
items in the &v-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; of <eltref ref="union"/>, if any.  The actual value is then formed by replacing any union type definition
in the <termref def="key-exm">explicit members</termref> with the members of
their <propref comp="std" prop="member type definitions"/>, in order.</p>
     </item>
     <item>
      <p role="if">the <eltref ref="restriction"/> option is chosen</p>
      <p role="then">the <propref comp="std" prop="member type definitions"/> of the <propref comp="std" prop="base type definition"/>.</p>
     </item>
    </olist>
   </propmap>
   <propmap comp="std" prop="facets">If the <eltref ref="restriction"/> alternative is
chosen, a set of facet components <termref def="key-facets-restriction">constituting a restriction</termref>
of the <propref comp="std" prop="facets"/> of the
<propref comp="std" prop="base type definition"/> with respect to a
set of facet components corresponding to the appropriate element information items among the
&i-children; of <eltref ref="restriction"/> (i.e. those which specify facets, if any), as
defined in <specref ref="st-restrict-facets"/>, otherwise the empty set.</propmap>
</reprcomp>
 </reprdef>
</div3>
    <div3>
     <head> Constraints on XML Representations of Simple Type Definitions</head>
     <constraintnote type="src" id="src-simple-type">
      <head>Simple Type Definition Representation OK</head>
      <p>In addition to the conditions imposed on <eltref ref="simpleType"/> element
information items by the schema for schemas,
   <olist role="and.mxm">
    <item>
     <p>The corresponding simple type definition, if any, <phrase diff="del" dg="modals">&must; satisfy</phrase><phrase diff="add" dg="modals">satisfies</phrase> the conditions set out in <specref ref="coss-st"/>.</p>
    </item>
    <item><p>If the <eltref ref="restriction"/> alternative is chosen,
either it &has.xmh; a <code>base</code> &i-attribute;
or a <eltref ref="simpleType"/> among its &i-children;, but not
both.</p>
    </item>
    <item><p>If the <eltref ref="list"/> alternative is chosen, either
it &has.xmh; an <code>itemType</code>
&i-attribute; or a <eltref ref="simpleType"/> among its &i-children;,
but not both.</p>
    </item>
    <item>
      <p><phrase diff="del" dg="modals">Circular union type definition
is disallowed. </phrase><phrase diff="add" dg="modals">There are no
circular union type definitions.</phrase> That is, if the <eltref ref="union"/> alternative is chosen, there <phrase diff="del" dg="modals">&mustnot; be any</phrase><phrase diff="add" dg="modals">are no</phrase> entries in the <code>memberTypes</code>
&i-attribute; at any depth which resolve to the component
corresponding to the <eltref ref="simpleType"/>.</p>
     </item>
   </olist>
  </p>
     </constraintnote>
    </div3>
    <div3>
     <head>Simple Type Definition Validation Rules</head>
 <constraintnote type="cvc" id="cvc-simple-type">
 <head>String Valid</head>
 <p>For a string to be locally <termref def="key-vn">valid</termref> with respect to a simple type definition 
  <olist role="and.mxm">
   <item>
    <p>It is schema-valid with respect to that definition as defined by
<xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#cvc-datatype-valid">Datatype Valid</xtermref> in <bibref ref="ref-xsp2"/>.</p>    
   </item>
   <item>
    <olist role="Case.ixm">
     <item>
      <p role="if">The definition is <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ENTITY">ENTITY</xtermref> or is validly
&derived; from <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ENTITY">ENTITY</xtermref> given the empty set,
as defined in <specref ref="cos-st-&derived;-ok"/></p>
      <p role="then">the string &is.xm; a <termref def="key-vde">declared
entity name</termref>.</p>
     </item>
     <item>
      <p role="if">The definition is <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ENTITIES">ENTITIES</xtermref> or is validly
&derived; from <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ENTITIES">ENTITIES</xtermref> given the empty set,
as defined in <specref ref="cos-st-&derived;-ok"/></p>
      <p role="then">every whitespace-delimited substring of the string &is.xm; a <termref def="key-vde">declared
entity name</termref>.</p>
     </item>
     <item>
      <p role="otherwise">no further condition applies.</p>
     </item>
    </olist>
   </item>
  </olist>
 </p>
  <p><termdef id="key-vde" term="declared entity name">A string is a <term>declared entity name</term> if it is equal to the <xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.entity.unparsed">name</xpropref> of some unparsed entity
information item in the value of the
<xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.document">unparsedEntities</xpropref> property of the document information item
at the root of the infoset containing the element or attribute information item
whose &i-value; the string is.</termdef></p>
</constraintnote>
    </div3>
    <div3>
     <head>Simple Type Definition Information Set
Contributions</head>
     <p>None as such.</p>
    </div3>
    <div3 id="coss-st">
     <head>Constraints on Simple Type Definition
Schema Components</head>
  <p>All simple type definitions other than the <termref def="simple-ur-type-itself">simple ur-type
definition</termref> and the built-in primitive datatype definitions (see <specref ref="Simple_Type_Definitions"/>) &must; satisfy both the following constraints.</p>
  <constraintnote type="cos" id="st-props-correct">
   <head>Simple Type Definition Properties Correct</head>
   <olist role="And.mxm">
    <item><p>The values of the properties of a simple type definition &are.xm; as described in
the property tableau in
<xspecref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dc-defn">Datatype definition</xspecref>, modulo the impact of <specref ref="conformance-missing"/>.</p></item>
    <item><p>All simple type definitions &are.xm; &derived;
ultimately from the <termref def="simple-ur-type-itself">simple ur-type
definition (so</termref> circular definitions are disallowed).  That is, it &is.xm; possible to reach a built-in
primitive datatype or the <termref def="simple-ur-type-itself">simple ur-type definition</termref> by repeatedly following the <propref comp="std" prop="base type definition"/>.</p></item>
    <item>
      <p>The <propref comp="std" prop="final"/> of the <propref comp="std" prop="base type definition"/> &doesnot.xmn; contain <pt>restriction</pt>.</p>
    </item>
    
   </olist>

  </constraintnote>
  <constraintnote type="cos" id="cos-st-restricts">
<head>&Derivation; Valid (Restriction, Simple)</head>
   <olist role="Case.mxm">
    <item>
     <p role="if">the <propref comp="std" prop="variety"/> is <pt>atomic</pt></p>
     <p role="then">
      <olist role="and.ixm">
      <item>
       <p>The <propref comp="std" prop="base type definition"/> &is.xm; an atomic simple type
definition or a built-in
primitive datatype.</p>
      </item>
       <item>
           <p>The <propref comp="std" prop="final"/> of the <propref comp="std" prop="base type definition"/> &doesnot.xmn; contain <pt>restriction</pt>.</p>
          </item>
      <item>
       <p>For each facet in the <propref comp="std" prop="facets"/> (call this <local>DF</local>) 
        <olist role="and.ixm">
         <item>
          <p><local>DF</local> &is.xm; an allowed constraining facet for the
<propref comp="std" prop="primitive type definition"/>, as specified in the appropriate
subsection of <xspecref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#built-in-primitive-datatypes">3.2 Primitive datatypes</xspecref>.</p>
         </item>
         <item>
          <p>If there is a facet of the same kind in the
<propref comp="std" prop="facets"/> of the <propref comp="std" prop="base type definition"/> (call
this <local>BF</local>), then the <local>DF</local>'s
<xpropref role="anon">value</xpropref> &is.xm; a valid restriction of <local>BF</local>'s <xpropref role="anon">value</xpropref>  as
defined in <bibref ref="ref-xsp2"/>.</p>
         </item>
        </olist>
        </p>
      </item>
     </olist></p>
    </item>
    <item>
       <p role="if">the <propref comp="std" prop="variety"/> is <pt>list</pt></p>
       <p role="then">
        <olist role="and.ixm">
        <item>
         <p>The <propref comp="std" prop="item type definition"/>
&has.xmh; a <propref comp="std" prop="variety"/> of
<pt>atomic</pt> or <pt>union</pt> (in which case all the <propref comp="std" prop="member type definitions"/> &are.xm;
<pt>atomic</pt>).</p>
        </item>
        <item>
         <olist role="Case.ixm">
          <item>
           <p role="if">the <propref comp="std" prop="base type definition"/>
is  the
<termref def="simple-ur-type-itself">simple ur-type definition</termref>        
          </p>
           <p role="then">
            <olist role="and.ixm">
            <item>
           <p>The <propref comp="std" prop="final"/> of the <propref comp="std" prop="item type definition"/> &doesnot.xmn; contain <pt>list</pt>.</p>
          </item>
            <item>
             <p>The <propref comp="std" prop="facets"/> <phrase diff="del" dg="modals">&must; only contain</phrase> <phrase diff="add" dg="modals">contains only</phrase> the
<pt>whiteSpace</pt> facet component.</p>
            </item>
           </olist>
           </p>
          </item>
          <item>
           <p role="otherwise">
            <olist role="and.ixm">
            <item>
             <p>The <propref comp="std" prop="base type definition"/> &has.xmh; a <propref comp="std" prop="variety"/> of <pt>list</pt>.</p>
            </item>
            <item>
           <p>The <propref comp="std" prop="final"/> of the <propref comp="std" prop="base type definition"/> &doesnot.xmn; contain <pt>restriction</pt>.</p>
          </item>
             <item>
              <p>The <propref comp="std" prop="item type definition"/>
&is.xm; validly &derived; from the <propref comp="std" prop="base type
definition"/>'s <propref comp="std" prop="item type definition"/>
given the empty set, as defined in <specref ref="cos-st-&derived;-ok"/>.</p>
             </item>
             <item><p>Only <pt>length</pt>, <pt>minLength</pt>, <pt>maxLength</pt>, <pt>whiteSpace</pt>,
<pt>pattern</pt> and <pt>enumeration</pt> facet components are allowed among
the <propref comp="std" prop="facets"/>.</p></item>
            <item>
             <p>For each facet in the <propref comp="std" prop="facets"/> (call this <local>DF</local>), if there is a facet of the same kind in the
<propref comp="std" prop="facets"/> of the <propref comp="std" prop="base type definition"/> (call
this <local>BF</local>), then the <local>DF</local>'s
<xpropref role="anon">value</xpropref> &is.xm; a valid restriction of <local>BF</local>'s <xpropref role="anon">value</xpropref>  as
defined in <bibref ref="ref-xsp2"/>.</p>
            </item>
           </olist>
           </p>
          </item>
         </olist>
          <p>The first case above will apply when a list is &constructedDiff; by
specifying an item type, the second when &derived; by restriction from another list.</p>
         </item>
       </olist></p>
      </item>
    <item>
       <p role="if">the <propref comp="std" prop="variety"/> is <pt>union</pt></p>
       <p role="then">
        <olist role="and.ixm">
        <item>
         <p>The <propref comp="std" prop="member type definitions"/> <phrase diff="del" dg="modals">&must;</phrase> all have <propref comp="std" prop="variety"/> of <pt>atomic</pt> or <pt>list</pt>.</p>
        </item>
        <item>
         <olist role="Case.ixm">
          <item>
           <p role="if">the <propref comp="std" prop="base type definition"/>
is  the
<termref def="simple-ur-type-itself">simple ur-type definition</termref>        
          </p>
           <p role="then">
            <olist role="and.ixm">
            <item>
           <p>All of the <propref comp="std" prop="member type definitions"/> 
<phrase diff="del" dg="modals">&must;</phrase> have a <propref comp="std" prop="final"/> 
which does not contain <pt>union</pt>.</p>
          </item>
            <item>
             <p>The <propref comp="std" prop="facets"/> <phrase diff="add" dg="modals">property</phrase> &is.xm; empty.</p>
            </item>
           </olist>
           </p>
          </item>
          <item>
           <p role="otherwise">
            <olist role="and.ixm">
            <item>
             <p>The <propref comp="std" prop="base type definition"/> &has.xmh; a <propref comp="std" prop="variety"/> of <pt>union</pt>.</p>
            </item>
            <item>
           <p>The <propref comp="std" prop="final"/> of the <propref comp="std" prop="base type definition"/> &doesnot.xmn; contain <pt>restriction</pt>.</p>
          </item>
             <item>
              <p>The <propref comp="std" prop="member type definitions"/><phrase diff="del" dg="modals">, in order,</phrase> &are.xm; <phrase diff="add" dg="modals">each</phrase>
validly &derived; from the corresponding type definitions in the <propref comp="std" prop="base type definition"/>'s <propref comp="std" prop="member type definitions"/> given the empty set, as defined in <specref ref="cos-st-&derived;-ok"/>.</p>
             </item>
             <item><p>Only <pt>pattern</pt> and <pt>enumeration</pt> facet components are allowed among
the <propref comp="std" prop="facets"/>.</p></item>
            <item>
             <p>For each facet in the <propref comp="std" prop="facets"/> (call this <local>DF</local>), if there is a facet of the same kind in the
<propref comp="std" prop="facets"/> of the <propref comp="std" prop="base type definition"/> (call
this <local>BF</local>),then the <local>DF</local>'s
<xpropref role="anon">value</xpropref> &is.xm; a valid restriction of <local>BF</local>'s <xpropref role="anon">value</xpropref>  as
defined in <bibref ref="ref-xsp2"/>.</p>
            </item>
           </olist>
           </p>
          </item>
         </olist>
          <p>The first case above will apply when a union is &constructedDiff; by
specifying one or more member types, the second when &derived; by restriction from another union.</p>
         </item>
       </olist></p>
      </item>
   </olist>
   <p><termdef id="cd-st-restriction" term="valid restriction">If this
constraint <specref ref="cos-st-restricts"/> holds of a simple type definition, it is a <term>valid
restriction</term> of its <propref comp="std" prop="base type definition"/></termdef>.</p>
</constraintnote>
    <p>The following constraint defines relations appealed to elsewhere in this specification.</p>
    <constraintnote id="cos-st-&derived;-ok" type="cos">
   <head>Type &Derivation; OK (Simple)</head>
   <p>For a simple type definition (call it <local>D</local>, for &derived;) to be validly
&derived; from a type definition (call this <local>B</local>, for base) given a
subset of {<pt>extension</pt>, <pt>restriction</pt>, <pt>list</pt>, <pt>union</pt>} (of which
only <pt>restriction</pt> is actually relevant)
    <olist role="or.mxm">
     <item id="c-stid">
      <p>They are the same type
definition.</p>
     </item>
     <item>
      <olist role="And.ixm">     
     <item>
      <p><pt>restriction</pt> is not in the
subset, or in the <propref comp="std" prop="final"/> of its own <propref comp="std" prop="base type definition"/>;</p>
     </item>
     <item>      
      <olist role="Or.ixm">
      <item>
      <p><local>D</local>'s <propref comp="std" prop="base type definition"/> is <local>B</local>.</p>
     </item>
       <item>
         <p><local>D</local>'s <propref comp="std" prop="base type definition"/> is not the
<termref def="ur-type-itself">ur-type definition</termref> and is validly &derived;
from <local>B</local> given the subset, as defined by this constraint.</p>
        </item>
       <item>
         <p><local>D</local>'s <propref comp="std" prop="variety"/> is <pt>list</pt> or <pt>union</pt> and <local>B</local>
is the <termref def="simple-ur-type-itself">simple ur-type definition</termref>.</p>
        </item>
       <item>
        <p><local>B</local>'s <propref comp="std" prop="variety"/> is <pt>union</pt> and
<local>D</local> is validly &derived;
from <phrase diff="del" dg="rq17">a type definition</phrase><phrase diff="add" dg="rq17">an <termref def="key-shadowed">unshadowed type definition</termref></phrase> in <local>B</local>'s <propref comp="std" prop="member type definitions"/> given the subset, as defined by this constraint.</p>
       </item>
    </olist> 
     </item>
    </olist>
     </item>
    </olist>    
   </p>
     <p diff="add" dg="rq17"><termdef id="key-shadowed" term="shadowed type definition">A
type definition <local>S</local> in the <propref comp="std" prop="member type definitions"/> of a union is <term>shadowed</term> if and only if its lexical space overlaps with the lexical space of some other simple type definition <local>O</local> which precedes it in that <propref comp="std" prop="member type definitions"/>, and <local>S</local> is not validly derived from <local>O</local> as defined by this constraint.</termdef></p>
  </constraintnote>
     <note>
      <p>With respect to <clauseref ref="c-stid"/>, see the Note on identity at
the end of <specref ref="no-identity"/> above.</p>
     </note>
  <constraintnote type="cos" id="st-restrict-facets">
   <head>Simple Type Restriction (Facets)</head>
   <p>For a simple type definition (call it <local>R</local>) to restrict another simple type
definition (call it <local>B</local>) with a
set of facets (call this <local>S</local>)
    <olist role="and.mxm">
     <item>
      <p>The <propref comp="std" prop="variety"/>  of <local>R</local> is the same as that of <local>B</local>.</p>
     </item>
     <item>
      <p>If <propref comp="std" prop="variety"/> is <pt>atomic</pt>, the 
<propref comp="std" prop="primitive type definition"/> of <local>R</local> is the same as that of <local>B</local>.</p>
     </item>
     <item id="c-fr">
      <p>The <propref comp="std" prop="facets"/> of <local>R</local> are the union of <local>S</local> and
the <propref comp="std" prop="facets"/> of <local>B</local>, eliminating duplicates.  To eliminate
duplicates, when a facet of the same kind occurs in both <local>S</local> and
the <propref comp="std" prop="facets"/> of <local>B</local>, the one in the <propref comp="std" prop="facets"/>
of <local>B</local> is not included, with the exception of <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-enumeration">enumeration</xtermref> and <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#dt-pattern">pattern</xtermref> facets, for which multiple occurrences with distinct values are allowed.</p>
      <p>Additional constraint(s) <phrase diff="del" dg="may">may</phrase><phrase diff="add" dg="may">sometimes</phrase> apply depending on the kind of facet, see
the appropriate sub-section of <xspecref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#rf-facets">4.3
Constraining Facets</xspecref></p>
     </item>
    </olist>
   </p>
   <p><termdef id="key-facets-restriction" term="constitute a restriction" role="local">If
<clauseref ref="c-fr"/> above holds, the <propref comp="std" prop="facets"/> of <local>R</local>
<term>constitute a restriction</term> of the <propref comp="std" prop="facets"/> of
<local>B</local> with respect to <local>S</local></termdef>.</p>
  </constraintnote>
    </div3>
 <div3 id="builtin-stds">
  <head>Built-in Simple Type Definition<phrase diff="add" dg="dgaat">s</phrase></head>
 <p>There is a simple type definition nearly equivalent to the <termref def="key-simpleUrType">simple 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 comp="std" prop="name">anySimpleType</pvpair>
      <pvpair comp="std" prop="target namespace">http://www.w3.org/2001/XMLSchema</pvpair>
      <pvpair comp="std" prop="base type definition"><termref def="ur-type-itself">the ur-type definition</termref></pvpair>
      <pvpair comp="std" prop="final">The empty set</pvpair>
      <pvpair comp="std" prop="variety"><termref def="key-null">absent</termref></pvpair>
     </pvlist>
    </schemaComp>
  <p>The <termref def="key-simpleUrType">simple ur-type definition</termref> is the root of the simple type definition
 hierarchy, and as such mediates between the other simple type
 definitions, which all eventually trace back to it via their <propref comp="std" prop="base type definition"/> properties, and the <termref def="key-urType">ur-type definition</termref>, which is
 <emph>its</emph> <propref comp="std" prop="base type definition"/>.  This is
 why the <termref def="simple-ur-type-itself">simple ur-type definition</termref> is exempted
 from the first clause of <specref ref="st-props-correct"/>, which would
otherwise bar it because of its &derivation; from a complex type definition and absence of <propref comp="std" prop="variety"/>.</p>
  <issue id="RQ-141i" role="1.1">
	    <p><loc href="&reqs;#anyAtomicType" target="reqs">RQ-141 (anyAtomicType)</loc></p>
   <p>The XML Query Working Group has had to introduce a new high-level simple
type definition into the type hierarchy to have a handle on all and only the
atomic simple type definitions (i.e. no lists or unions).  This will be
added now to this spec. with the name <code>anyAtomicType</code>.</p>
    <resolution>
     <p>Add anyAtomicType as the supertype of all atomics and the
child of anySimpleType.</p>
    </resolution>
	    </issue>
  <p diff="add" dg="dgaat"><termdef term="anyAtomicType" id="aat">There is a simple type definition named <term>anyAtomicType</term> present in every
schema by definition</termdef>.  It has the following properties:</p>
 <schemaComp id="aat-def" diff="add" dg="dgaat">
     <head>Simple Type Definition of anyAtomicType</head>
     <pvlist>
      <pvpair comp="std" prop="name">anyAtomicType</pvpair>
      <pvpair comp="std" prop="target namespace">http://www.w3.org/2001/XMLSchema</pvpair>
      <pvpair comp="std" prop="base type definition"><termref def="simple-ur-type-itself">the simple ur-type definition</termref></pvpair>
      <pvpair comp="std" prop="final">The empty set</pvpair>
      <pvpair comp="std" prop="variety"><termref def="key-null">atomic</termref></pvpair>
     </pvlist>
    </schemaComp>
  <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>number</pt>, <pt>dateTime</pt>, <pt>duration</pt>,
<pt>time</pt>, <pt>date</pt>, <pt>gMonth</pt>, <pt>gMonthDay</pt>, <pt>gDay</pt>, <pt>gYear</pt>, <pt>gYearMonth</pt>, <pt>hexBinary</pt>, <pt>base64Binary</pt>, <pt>anyURI</pt> (see the <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#built-in-primitive-datatypes">Primitive
Datatypes</xtermref> section of &XSP2;) are present by definition in every schema.  All
are in the XML Schema <propref comp="std" prop="target namespace"/> (namespace
name <code>http://www.w3.org/2001/XMLSchema</code>), have an <pt>atomic</pt> <propref comp="std" prop="variety"/> with an empty
<propref comp="std" prop="facets"/> and<phrase diff="del" dg="dgaat"> the <termref def="key-simpleUrType">simple ur-type definition</termref></phrase><phrase diff="add" dg="dgaat"><termref def="aat">anyAtomicType</termref></phrase> as
their <propref comp="std" prop="base type definition"/> and themselves as <propref comp="std" prop="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/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#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>
 </div3>
   </div2>
   <div2 id="Schemas">
    <head>Schemas as a Whole</head>
    <p>A schema consists of a set of schema components.</p>
    <note role="example">
        <eg xml:space="preserve">&lt;xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.example.com/example"&gt;
  . . .
&lt;/xs:schema&gt;</eg>
        <p>The XML representation of the skeleton of a schema.</p>
    </note>
    <div3 id="Schema_details">
     <head>The Schema Itself</head>
    <p>At the abstract level, the schema itself is just a container
for its components.</p>
	  <issue id="RQ-16i" role="1.1">
	    <p><loc href="&reqs;#id-components" target="reqs">RQ-16 (id-components)</loc>, <loc href="&reqs;#scd-accessible-constraints" target="reqs">RQ-133 (scd-accessible-constraints)</loc></p>
    <p>Version 1.0 provides a property of the top-level 'schema' component for
every kind of named component <emph>except</emph> identity constraints.  This
omission will be rectified by giving it an [identity constraints] property.</p>
    <resolution>
     <p>Add an [identity constraints] property of the schema component, which contains all the identity constraint components.</p>
     <!--* <ednote>
      <edtext>This will actually happen as an erratum to XML Schema 2nd
edition, but this issue is here anyway to make sure it gets folded in.</edtext>
     </ednote> *-->
    </resolution>
	    </issue>
    <compdef name="Schema" abbrev="s"/>
    </div3>
    <div3 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>, that is, one or more <eltref ref="schema"/> element information items.  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 <xpropref role="anon">target namespace</xpropref>.  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 <xpropref role="anon">target namespace</xpropref>, see <specref ref="src-import"/>.</p>
     <reprdef>
      <reprelt eltname="schema"/>
      <reprcomp abstract="Schema" ref="key-schema">
       <propmap comp="s" prop="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 comp="s" prop="attribute declarations">The (top-level) 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 comp="s" prop="element declarations">The (top-level) 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 comp="s" prop="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 comp="s" prop="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 comp="s" prop="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 comp="s" prop="&constraint; definitions" diff="add" dg="fpwd">The &constraint; definitions
corresponding to all the <eltref ref="key"/>, <eltref ref="keyref"/> and
<eltref ref="unique"/> element information items anywhere within the
&i-children;, if any, plus any included or imported &constraint; definitions, see <specref ref="compound-schema"/> and <specref ref="composition-schemaImport"/>.</propmap>
       <propmap comp="s" prop="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 above, 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>
 <p>The definition of the schema abstract data model in <specref ref="concepts-data-model"/> makes clear that most components have a <xpropref role="anon">target namespace</xpropref>.  Most components corresponding to representations within a given <eltref ref="schema"/> element information item will have a <xpropref role="anon">target namespace</xpropref> which corresponds to the <code>targetNamespace</code> attribute. </p>
     <p>Since the empty string is not a legal namespace name, supplying
an empty string for <code>targetNamespace</code> is incoherent, and 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 comp="ed" prop="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, the specification applies the target namespace facility uniformly to all
schema components, i.e. not only declarations but also definitions have a <xpropref role="anon">target namespace</xpropref>.</p>
</note>
     <p>Although the example schema at the beginning of this section 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.xm; appear in the content of <eltref ref="schema"/> corresponds to
a schema component, and all except <eltref ref="annotation"/> are named.  The
sections below
present each such item in turn, setting out the
components to which it &may.xm; correspond.</p>
<div4 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.xm;,
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 or references to them, this refers to the
simple type <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#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/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#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/2001/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>
</div4>
    <div4>
  <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 <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref>:  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, 
<bibref ref="ref-xpointer"/> provides a mechanism which maps well onto the
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 top-level 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.xm; 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
<xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref>, 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>
 </div4>
</div3>
    <div3>
     <head>Constraints on XML Representations of Schemas</head>
 <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 &v-value; is composed of a
 <termdef id="q-local" term="local name" role="local"><term>local name</term></termdef> and a <termdef id="q-uri" term="namespace name" role="local"><term>namespace name</term></termdef>.  Its &v-value; is determined based on 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> following <bibref ref="ref-xml-namespaces"/>:</p>
  <p><olist role="Case.mxm">
    <item>
     <p role="if">its &i-value; is prefixed</p>
     <p role="then">
      <olist role="and.ixm">
       <item>
        <p>There &is.xm; a namespace in 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">prefix</xpropref> matches the prefix.</p>
       </item>
       <item>
       <p role="then">its <termref def="q-uri">namespace name</termref> is the
<xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.namespace">namespace
name</xpropref> of that namespace.</p></item>
       <item>
        <p>Its <termref def="q-local">local name</termref> is the portion of
its &i-value; after the colon (<code>':'</code>).</p>
       </item>
      </olist>
     </p>     
    </item>
    <item>
     <p role="otherwise">(its &i-value; is unprefixed) <olist role="and.ixm">
       <item>
        <p>its <termref def="q-local">local name</termref> is its &i-value;.</p>
       </item>
       <item>
        <olist role="Case.ixm">
       <item>
        <p role="if">there is a namespace in 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">prefix</xpropref> has no value</p>
        <p role="then">its <termref def="q-uri">namespace name</termref> is the
<xpropref href="http://www.w3.org/TR/xml-infoset/#infoitem.namespace">namespace
name</xpropref> of that namespace.</p>
       </item>
       <item>
        <p role="otherwise">its <termref def="q-uri">namespace name</termref> is <termref def="key-null">absent</termref>.</p>
       </item>
      </olist>
       </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"> namespace attributes</xpropref> of the containing element information item and its ancestors.</p>
 </constraintnote>
 <p><termdef id="key-resolve" term="resolve">Whenever the word <term>resolve</term> 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 <specref ref="src-resolve"/> &must.x.s; be understood</termdef>:</p>
 <constraintnote type="src" id="src-resolve">
  <head>QName resolution (Schema Document)</head>
  <p>For a <termref def="gloss-QName">QName</termref>
to resolve to a schema component of a specified kind
   <olist role="and.mxm">
    <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 <termref def="gloss-QName">QName</termref>
appears, that is
      <olist role="case.ixm">
    <item>
     <p role="if">the kind specified is simple or complex type definition</p>
     <p role="then">the property is the <propref comp="s" prop="type definitions"/>.</p>
    </item>
    <item>
     <p role="if">the kind specified is attribute declaration</p>
     <p role="then">the property is the <propref comp="s" prop="attribute declarations"/>.</p> 
    </item>
    <item>
     <p role="if">the kind specified is element declaration</p>
     <p role="then">the property is the <propref comp="s" prop="element declarations"/>.</p> 
    </item>
    <item>
     <p role="if">the kind specified
is attribute group</p>
     <p role="then">the property is the <propref comp="s" prop="attribute group definitions"/>.</p> 
    </item>
    <item>
     <p role="if">the kind specified is
model group</p>
     <p role="then">the property is the <propref comp="s" prop="model group definitions"/>.</p>
    </item>
    <item>
     <p role="if">the kind specified is notation declaration</p>
     <p role="then">the property is the <propref comp="s" prop="notation declarations"/>.</p> 
    </item>
   </olist>
     </p>
    </item>
    <item>
     <p>The
component's <xpropref role="anon">name</xpropref> matches the <termref def="q-local">local
name</termref> of the <termref def="gloss-QName">QName</termref>;</p>
    </item>
    <item>
     <p>The component's <xpropref role="anon">target namespace</xpropref> is identical to the <termref def="q-uri">namespace name</termref> of the <termref def="gloss-QName">QName</termref>;</p>
    </item>
    <item>
     <olist role="Case.ixm">
      <item>
       <p role="if">the <termref def="q-uri">namespace name</termref> of the <termref def="gloss-QName">QName</termref> is <termref def="key-null">absent</termref></p>
       <p role="then">
        <olist role="or.ixm">
         <item>
          <p>The <eltref ref="schema"/> element information item of the schema document containing the <termref def="gloss-QName">QName</termref> has no <code>targetNamespace</code> &i-attribute;.</p>
         </item>
         <item>
          <p>The <eltref ref="schema"/> element information item of the that schema document contains an <eltref ref="import"/> element
information item with no <code>namespace</code> &i-attribute;.</p>
         </item>
        </olist>
       </p>
      </item>
      <item>
       <p role="otherwise">the <termref def="q-uri">namespace name</termref> of the <termref def="gloss-QName">QName</termref> is
the same as
        <olist role="orval">
         <item>
          <p>The &v-value; of the <code>targetNamespace</code> &i-attribute; of
the <eltref ref="schema"/> element information item of the schema document containing the <termref def="gloss-QName">QName</termref>.</p>
         </item>
         <item>
          <p>The &v-value; of the <code>namespace</code> &i-attribute; of some
<eltref ref="import"/> element information item contained in the <eltref ref="schema"/> element information item of that schema document.</p>
         </item>
        </olist>.</p>
      </item>
     </olist>
     
    </item>
   </olist>
  </p>
 </constraintnote>
    </div3>
    <div3>
     <head>Validation Rules for Schemas as a Whole</head>
 <p>As the discussion above at <specref ref="components"/> 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 name (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 property to use is determined by the kind of component specified, that is,
   <olist role="case.mxm">
    <item>
     <p role="if">the kind specified is simple or complex type definition</p>
     <p role="then">the property is the <propref comp="s" prop="type definitions"/>.</p>
    </item>
    <item>
     <p role="if">the kind specified is attribute declaration</p>
     <p role="then">the property is the <propref comp="s" prop="attribute declarations"/>.</p> 
    </item>
    <item>
     <p role="if">the kind specified is element declaration</p>
     <p role="then">the property is the <propref comp="s" prop="element declarations"/>.</p> 
    </item>
    <item>
     <p role="if">the kind specified
is attribute group</p>
     <p role="then">the property is the <propref comp="s" prop="attribute group definitions"/>.</p> 
    </item>
    <item>
     <p role="if">the kind specified is
model group</p>
     <p role="then">the property is the <propref comp="s" prop="model group definitions"/>.</p>
    </item>
    <item>
     <p role="if">the kind specified is notation declaration</p>
     <p role="then">the property is the <propref comp="s" prop="notation declarations"/>.</p> 
    </item>
   </olist>
   The component resolved to is the entry in the table whose <xpropref role="anon">name</xpropref> matches the local name of the pair and whose <xpropref role="anon">target namespace</xpropref> is identical to the namespace name of the pair.
  </p>
 </constraintnote>
    </div3>
    <div3>
     <head>Schema Information Set Contributions</head>
     <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 <phrase diff="del" dg="may">may well be of relevance to</phrase><phrase diff="add" dg="may">can often be useful for</phrase> 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"> by an <term>item isomorphic</term> to a component is meant 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>Processors <phrase diff="del" dg="rq144">&must;</phrase><phrase diff="add" dg="rq144">&may;</phrase> add a property in the &PSVI;
to the element information item at which <termref def="key-va">assessment</termref> began, as follows:</p>
      <proplist item="element" role="psvi">
       <propdef id="e-schema_information" name="schema information">A set of <iiName>namespace schema information</iiName> information items, one for each namespace name which appears as the
<xpropref role="anon">target namespace</xpropref> 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 <xpropref role="anon">target namespace</xpropref>.  Each <iiName>namespace schema information</iiName> information item has the
following properties and values:
        <proplist item="namespace schema information" role="psvi">
         <propdef id="nsi-schema_namespace" name="schema namespace">A namespace
name or <termref def="key-null">absent</termref>.</propdef>
         <propdef id="nsi-schema_components" name="schema components">A (possibly
empty) set of schema component information items, each one an <termref def="key-iso">item isomorphic</termref> to a component whose <xpropref role="anon">target
namespace</xpropref> is the sibling <propref ref="nsi-schema_namespace" role="psvi"/>
property above, drawn from the schema used for <termref def="key-va">assessment</termref>.</propdef>
         <propdef name="schema documents" id="nsi-schema_documents">A
(possibly empty) set of <iiName>schema document</iiName> information items, with
properties and values as follows, for each schema document which
contributed components to the schema, and whose
<code>targetNamespace</code> matches the sibling <propref role="psvi" ref="nsi-schema_namespace"/> property above (or whose
<code>targetNamespace</code> was <termref def="key-null">absent</termref>
but that 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"/>):
          <proplist item="schema document" role="psvi">
           <propdef name="document location" id="sd-document_location">Either a URI reference, if available, otherwise
<termref def="key-null">absent</termref>
           </propdef>
           <propdef name="document" id="sd-document">A document
information item, if available, otherwise <termref def="key-null">absent</termref>.</propdef>
          </proplist>
         </propdef>
        </proplist>
       </propdef>
      </proplist>
     <p>The <propref ref="nsi-schema_components"/> 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>
     <constraintnote type="sic" id="sic-id">
  <head>ID/IDREF Table</head>
      <p>In the &PSVI; a set of <iiName>ID/IDREF binding</iiName> information items is associated
with the <termref def="key-vr">validation root</termref> element information
item:</p>
      <proplist item="element" role="psvi">
       <propdef name="ID/IDREF table" id="e-ii_table">A (possibly empty) set of
<iiName>ID/IDREF binding</iiName> information items, as specified below.</propdef>
      </proplist>
      <p><termdef id="key-eas" term="eligible item set" role="local">Let the
<term>eligible item set</term> be the set of consisting of every attribute or element
information item</termdef> for which
         <olist role="andtest">
            <item>
             <p>its  <xpropref role="psviAnon">validation context</xpropref> is the
<termref def="key-vr">validation root</termref>;</p>
            </item>
            <item>
             <p>it was successfully <termref def="key-vn">validated</termref> with respect to an attribute
declaration as per <specref ref="cvc-attribute"/> or element declaration as per
<specref ref="cvc-elt"/> (as appropriate) whose attribute <propref comp="ad" prop="type definition"/> or element <propref comp="ed" prop="type definition"/> (respectively) is the
built-in <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref>, <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#IDREF">IDREF</xtermref> or <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#IDREFS">IDREFS</xtermref> simple type definition or a type &constructedDiff; from one of them.</p>
            </item>
           </olist></p>
      <p>Then there is one <iiName>ID/IDREF binding</iiName> in the <propref ref="e-ii_table" role="psvi"/>
for every distinct string which is</p><olist role="orval">
        <item>
         <p>the &v-value; of a member of the <termref def="key-eas">eligible
item set</termref> whose type definition is or is &constructedDiff; from <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref> or <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#IDREF">IDREF</xtermref>;</p>
        </item>
        <item>
         <p>one of the items in the &v-value; of a member of the <termref def="key-eas">eligible
item set</termref> whose type definition is or is &constructedDiff; from <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#IDREFS">IDREFS</xtermref>.</p>
        </item>
       </olist>
      <p>Each <iiName>ID/IDREF binding</iiName> has properties as follows:</p>
      <proplist item="ID/IDREF binding" role="psvi">
        <propdef name="id" id="iib-id">The string identified above.</propdef>
        <propdef id="iib-binding" name="binding">A set consisting of every element information item for which
          <olist role="andtest">
            <item>
             <p>its <propref role="psvi" ref="e-validation_context"/> is the
<termref def="key-vr">validation root</termref>;</p>
            </item>
            <item>
             <p>it has an attribute information item in
its &i-attributes; or an element information item in its &i-children; which was <termref def="key-vn">validated</termref> by the
built-in <xtermref href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html#ID">ID</xtermref> simple type definition or a type &constructedDiff; from it whose
 <xpropref role="psviAnon">schema normalized value</xpropref> is the <propref role="psvi" ref="iib-id"/> of
this <iiName>ID/IDREF binding</iiName>.</p>
            </item>
           </olist>
        </propdef>
       </proplist>
<p>The net effect of the above is to have one entry for every string used as an
id, whether by declaration or by reference, associated with those elements, if
any, which actually purport to have that id.  See <specref ref="cvc-id"/> above
for the validation rule which actually checks for errors here.</p>
  <note>
   <p>The <iiName>ID/IDREF binding</iiName>
information item, unlike most other aspects of this
specification, is essentially an internal bookkeeping mechanism.  It is introduced to
support the definition of <specref ref="cvc-id"/> above. 
Accordingly, conformant processors &may;, but are <emph>not</emph> required to,
expose it in the &PSVI;.
In other words, the above constraint <phrase diff="del" dg="may">may</phrase><phrase diff="add" dg="may">is to</phrase> be read as saying <termref def="key-va">assessment</termref> proceeds <emph>as if</emph> such an infoset item existed.</p></note>
 </constraintnote>
    </div3>
    <div3 id="coss-schema">
     <head>Constraints on Schemas as a Whole</head>
  <p>All schemas (see <specref ref="Schemas"/>) &must; satisfy the following constraint.</p>
  <constraintnote type="cos" id="sch-props-correct">
   <head>Schema Properties Correct</head>
   <olist role="And.mxm">
    <item>
     <p>The values of the properties of a schema &are.xm; as described in
the property tableau in
<specref ref="Schema_details"/>, modulo the impact of <specref ref="conformance-missing"/>;</p>
    </item>
    <item id="c-nmd">
     <p><phrase diff="del" dg="modals">Each</phrase><phrase diff="add" dg="modals">None</phrase> of the <propref comp="s" prop="type definitions"/>,  <propref comp="s" prop="element declarations"/>, <propref comp="s" prop="attribute group definitions"/>, <propref comp="s" prop="model group definitions"/> and <propref comp="s" prop="notation declarations"/> <phrase diff="add" dg="modals">properties</phrase> <phrase diff="del" dg="modals">&mustnot; contain</phrase><phrase diff="add" dg="modals">contains</phrase> two or more schema components with the same <xpropref role="anon">name</xpropref> and <xpropref role="anon">target
namespace</xpropref>.</p>
    </item>
   </olist>
  </constraintnote>
 
    </div3>
   </div2>
   <div2 id="Auxiliary_Components" diff="add" dg="ep01">
    <head>Auxil<phrase diff="del" dg="wd2.silent">l</phrase>iary Components</head>
    <!--* <ednote>
     <edtext>These abstract components and micro-components have been added to assist
in organising the preceding material.   The will probably move elsewhere in
a subsequent working draft.</edtext>
    </ednote> *-->
    <compdef name="Component" abbrev="c"/>
    <compdef name="Annotated Component" abbrev="ac"/>
    <compdef name="Term" abbrev="t"/>
    <compdef name="Facet" abbrev="f"/>
    <compdef name="Fundamental Facet" abbrev="ff"/>
    <compdef name="Type Definition" abbrev="td"/>
    <microCompdef name="Namespace Constraint" abbrev="nc"/>
    <microCompdef name="Scope" abbrev="sc"/>
    <microCompdef name="Value Constraint" abbrev="vc"/>
    <microCompdef name="Content Type" abbrev="ct"/>
    <microCompdef name="Key Binding" abbrev="kb"/>
   </div2>
  </div1>
   <div1 id="composition">
    <head>Schemas and Namespaces: Access and Composition</head>
      <issue id="RQ-151i" role="1.1">
	<p><loc href="&reqs;#composition" target="reqs">RQ-151 (consistent)</loc></p>
       <p>Experience with version 1.0 has shown that the rules in this section
miss a few cases, and are unclear in others.  A full rewrite taking a more
formal approach, without changing the intended semantics, will be done to
address these problems.</p>
       <resolution>
        <p>Give a complete and formal definition of schema composition, and use it for currently defined (e.g. include) and currently undefined (e.g. schema docs on command line) cases. </p>
       </resolution>
	</issue>
<p>This chapter defines the mechanisms by which this specification establishes the necessary
precondition for <termref def="key-va">assessment</termref>, namely access to
one or more schemas. This chapter also sets out in detail the relationship
between schemas and namespaces, as well as mechanisms for
modularization of schemas, including provision for incorporating definitions
and declarations from one schema in 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>. This section sets 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 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 components</termref>
  transitively required to complete an <termref def="key-va">assessment</termref> (note that components derived
from <termref def="key-schemaDoc">schema documents</termref> 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.xm; 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 Documents, Namespaces and Composition</head>
<p>The sub-sections of <specref ref="components"/> define 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 <phrase diff="del" dg="may">may</phrase><phrase diff="add" dg="may">will
sometimes</phrase> involve resolving both instance &rarr; schema and
schema &rarr; schema references. As observed earlier in <specref ref="concepts-conformance"/>,  the
precise mechanisms for resolving such references are expected to
evolve over time. In support of such evolution, this specification
observes the design principle that references from one schema document
to a 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, it is documented with the layer 2 mechanisms of import and
include, with which it is closely associated.</p></note>
 <div3 id="compound-schema">
<head>Assembling a schema for a single target namespace from multiple schema definition documents<phrase diff="add" dg="imp"> (<code>&lt;include&gt;</code>)</phrase></head>
 <p>Schema components for a single target namespace can be assembled from
several <termref def="key-schemaDoc">schema documents</termref>, 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 documents</termref>, 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 corresponding to its definition and declaration &i-children;, but also
all the components of all the <termref def="key-schema">XML Schemas</termref> corresponding to any <eltref ref="include"/>d schema documents.
Such included schema documents &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 the <eltref ref="include"/>d schema document is 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, 
    <olist role="and.apply.xm">
    <item id="c-ins">
     <p>If the &v-value; of the <code>schemaLocation</code> &i-attribute;
successfully resolves
      <olist role="or.mxm">
       <item id="c-vxd">
        <p>It resolves to (a fragment of) a resource which is an XML
document (of type
<code>application/xml</code> or <code>text/xml</code> with an XML declaration
for preference, but this is not required), 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>
       <item>
        <p>It resolves 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="include"/>d <eltref ref="schema"/> item <local>SII</local>, the valid
schema <local>I</local> and the <eltref ref="include"/>ing item's parent <eltref ref="schema"/> item <local>SII&rsquo;</local>.</p>
    </item>
     <item>
      <olist role="Or.mxm">
       <item id="c-normi">
        <p><local>SII</local> has a <code>targetNamespace</code> &i-attribute;, and its &v-value; is identical to the &v-value; of the <code>targetNamespace</code> &i-attribute; of <local>SII&rsquo;</local> (which &must; have such an &i-attribute;).</p>
       </item>
       <item id="c-normi2"><p>Neither <local>SII</local> nor <local>SII&rsquo;</local> have a <code>targetNamespace</code> &i-attribute;.</p></item>
       <item id="c-chami"><p><local>SII</local> has no <code>targetNamespace</code>
&i-attribute; (but <local>SII&rsquo;</local> does).</p></item>
      </olist>      
     </item>
     <item>
      <olist role="Case.mxm">
       <item>
         <p role="if"><clauseref ref="c-normi"/> or <clauseref ref="c-normi2"/> above is satisfied</p>
        <p role="then">the schema corresponding to
<local>SII&rsquo;</local> <phrase diff="del" dg="modals">&must;
include</phrase><phrase diff="add" dg="modals">includes</phrase> not
only definitions or declarations corresponding to the appropriate
members of its own &i-children;, but also components identical to all
the <termref def="key-component">schema components</termref> of
<local>I</local>.</p>
        </item>
        <item id="c-docham">
         <p role="if"><clauseref ref="c-chami"/> above is satisfied</p>
         <p role="then">the schema corresponding to the
<eltref ref="include"/>d item's parent <eltref ref="schema"/> <phrase diff="del" dg="modals">&must; include</phrase><phrase diff="add" dg="modals">includes</phrase> not only definitions or declarations
corresponding to the appropriate members of its own &i-children;, but
also components identical to all the <termref def="key-component">schema components</termref> of <local>I</local>,
except that anywhere the <termref def="key-null">absent</termref>
target namespace name would have appeared, the &v-value; of the
<code>targetNamespace</code> &i-attribute; of
<local>SII&rsquo;</local> is used.  In particular, it replaces
<termref def="key-null">absent</termref> in the following places:
          <olist>
           <item><p>The  <xpropref role="anon">target
namespace</xpropref> of named schema components, both at the top level
and (in the case of nested type definitions and nested attribute and
element declarations whose <code>code</code> was <pt>qualified</pt>)
nested within definitions;</p></item>
           <item><p>The <propref comp="w" prop="namespace
constraint"/> of a wildcard, whether negated or not;</p></item>
          </olist>
         </p>
        </item>
       </olist>
     </item>
   </olist>
   </p>
 <p>It is <emph>not</emph> an error for the &v-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
above to fail to be satisfied.  Failure to resolve <phrase diff="del" dg="may">may well</phrase><phrase diff="add" dg="may">is likely
to</phrase> cause less than complete <termref def="key-va">assessment</termref> outcomes, of course.</p>
  
   <p>As discussed in <specref ref="conformance-missing"/>, <termref def="gloss-QName">QName</termref>s in XML representations <phrase diff="del" dg="may">may</phrase><phrase diff="add" dg="may">will
sometimes</phrase> fail to <termref def="key-resolve">resolve</termref>, rendering components incomplete
and unusable because of missing subcomponents.  During schema
construction, implementations &must; retain <termref def="gloss-QName">QName</termref> values for such references, in case
an appropriately-named component becomes available to discharge the
reference by the time it is actually needed.  <termref def="key-null">Absent</termref> target <termref def="q-uri">namespace
name</termref>s of such as-yet unresolved reference <termref def="gloss-QName">QName</termref>s in <eltref ref="include"/>d
components &must; also be converted if <clauseref ref="c-docham"/> is
satisfied.</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
<clauseref ref="c-nmd"/> 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<phrase diff="add" dg="imp"> (<code>&lt;redefine&gt;</code>)</phrase></head>
 <p>In order 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>
 <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 documents</termref>, 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 corresponding to its definition and declaration &i-children;, but also
all the components of all the <termref def="key-schema">XML Schemas</termref> corresponding to any <eltref ref="redefine"/>d schema documents.
Such schema documents &must; either (a) have the same
<code>targetNamespace</code> as the <eltref ref="redefine"/>ing schema document, or 
(b) no <code>targetNamespace</code> at all, in which case  the <eltref ref="redefine"/>d schema document is 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, 
  <ulist>
   <item>
    <p>Type
definitions &must; use themselves as their base type definition;</p>
   </item>
   <item>
    <p>
     Attribute
group definitions and model group definitions &must; be supersets or subsets of their original
definitions, either by including exactly one
reference to themselves or by containing only (possibly restricted) components
which appear in a corresponding way in their <eltref ref="redefine"/>d selves.</p>
   </item>
  </ulist>Not all the components 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 &can.xm;
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>
  <p>The pervasive impact of redefinition reinforces the need for
implementations to adopt some form of lazy or 'just-in-time' approach to
component construction, which is also called for in order to avoid
inappropriate dependencies on the order in which definitions and references appear in (collections of) schema documents.</p>
 </note>
 <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.xm; 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
    <olist role="and.apply.xm">
     <item><p>If there are any element information items among the
&i-children; other than <eltref ref="annotation"/> then the &v-value;
of the <code>schemaLocation</code> &i-attribute; 
&must; successfully resolve.</p></item>
    <item>
     <p>If the &v-value; of the <code>schemaLocation</code> &i-attribute;
successfully resolves
      <olist role="or.mxm">
       <item>
        <p>it resolves to (a fragment of) a resource which is an XML document
(see <clauseref ref="c-vxd"/>), 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>
       <item>
        <p>It resolves 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="redefine"/>d <eltref ref="schema"/> item <local>SII</local>, the valid
schema <local>I</local> and the <eltref ref="redefine"/>ing item's parent <eltref ref="schema"/> item <local>SII&rsquo;</local>.</p>
    </item>
     <item>
      <olist role="Or.mxm">
       <item id="c-normir">
        <p><local>SII</local> has a <code>targetNamespace</code> &i-attribute;, and its &v-value; is identical to the &v-value; of the <code>targetNamespace</code> &i-attribute; of <local>SII&rsquo;</local> (which &must; have such an &i-attribute;).</p>
       </item>
       <item id="c-normi2r"><p>Neither <local>SII</local> nor <local>SII&rsquo;</local> have a <code>targetNamespace</code> &i-attribute;.</p></item>
       <item id="c-chamir"><p><local>SII</local> has no <code>targetNamespace</code>
&i-attribute; (but <local>SII&rsquo;</local> does).</p></item>
      </olist>      
     </item>
     <item>
      <olist role="Case.mxm">
       <item>
         <p role="if"><clauseref ref="c-normir"/> or <clauseref ref="c-normi2r"/> above is satisfied</p>
        <p role="then">the schema corresponding to
<local>SII&rsquo;</local> <phrase diff="del" dg="modals">&must;
include</phrase><phrase diff="add" dg="modals">includes</phrase> not
only definitions or declarations corresponding to the appropriate
members of its own &i-children;, but also components identical to all
the <termref def="key-component">schema components</termref> of
<local>I</local>, with the exception of those explicitly redefined
(see <specref ref="src-expredef"/> below).</p>
        </item>
        <item>
         <p role="if"><clauseref ref="c-chamir"/> above is satisfied</p>
         <p role="then">the schema corresponding to
<local>SII&rsquo;</local> <phrase diff="del" dg="modals">&must;
include</phrase><phrase diff="add" dg="modals">includes</phrase> not
only definitions or declarations corresponding to the appropriate
members of its own &i-children;, but also components identical to all
the <termref def="key-component">schema components</termref> of
<local>I</local>, with the exception of those explicitly redefined
(see <specref ref="src-expredef"/> below), except that anywhere the <termref def="key-null">absent</termref> target namespace name would have
appeared, the &v-value; of the <code>targetNamespace</code>
&i-attribute; of <local>SII&rsquo;</local> is used (see <clauseref ref="c-docham"/> in <specref ref="src-include"/>
for details).</p>
        </item>
       </olist>       
     </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 &v-value; of whose <code>base</code>
&i-attribute; &must; be the same as the &v-value; of its own
<code>name</code> attribute plus target namespace;</p>
     </item>
     <item>
      <p>Within the &i-children;, for each <eltref ref="group"/> <olist role="case.mxm">
       <item>
        <p role="if">it has a <eltref ref="group"/> among its contents at some level the &v-value; of whose
<code>ref</code> &i-attribute; is the same as the &v-value; of its own
<code>name</code> attribute plus target namespace</p>
        <p role="then">
         <olist role="and.ixm">
          <item>
           <p>It &has.xmh; exactly one such group.</p>
          </item>
          <item>
           <p>The &v-value; of both that group's <code>minOccurs</code> an