Movatterモバイル変換


[0]ホーム

URL:


W3C

XML Schema Part 1: Structures Second Edition

W3C Recommendation 28 October 2004

This version:
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/
Latest version:
http://www.w3.org/TR/xmlschema-1/
Previous version:
http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/
Editors:
Henry S. Thompson, University of Edinburgh<ht@cogsci.ed.ac.uk>
David Beech, Oracle Corporation<David.Beech@oracle.com>
Murray Maloney, for Commerce One<murray@muzmo.com>
Noah Mendelsohn, Lotus Development Corporation<Noah_Mendelsohn@lotus.com>

Please refer to theerrata for this document, which may include some normative corrections.

This document is also available in these non-normative formats:XML,XHTML with visible change markup,Independent copy of the schema for schemadocuments, and Independent copy of the DTD for schema documents.See alsotranslations.

Copyright © 2004 W3C® (MIT,ERCIM,Keio), All Rights Reserved. W3Cliability,trademark anddocument use rules apply.


Abstract

XML Schema: Structures specifies the XML Schema definition language, which offers facilities for describing the structure and constraining the contents of XML 1.0 documents, including those which exploit the XMLNamespace facility. The schema language, which is itself represented in XML 1.0 and uses namespaces, substantially reconstructs and considerably extends the capabilities found in XML 1.0 document type definitions (DTDs). This specification depends onXML Schema Part 2: Datatypes.

Status of this Document

This section describes the status of this document at thetime of its publication. Other documents may supersede this document.A list of current W3C publications and the latestrevision of this technical report can be found in theW3C technical reports index athttp://www.w3.org/TR/.

This is aW3CRecommendation, which forms part of the Second Edition of XMLSchema. This document has been reviewed by W3C Members andother interested parties and has been endorsed by the Director as aW3C Recommendation. It is a stable document and may be used asreference material or cited as a normative reference from another document. W3C's role in making the Recommendation is to draw attentionto the specification and to promote its widespread deployment. Thisenhances the functionality and interoperability of the Web.

This document has been produced by theW3C XML Schema Working Groupas part of the W3CXMLActivity. The goals of the XML Schema language are discussed intheXML SchemaRequirements document. The authors of this document are themembers of the XML Schema Working Group. Different parts of thisspecification have different editors.

This document was produced under the24January 2002 Current Patent Practice (CPP) as amended by theW3C Patent PolicyTransition Procedure. The Working Group maintains apubliclist of patent disclosures relevant to this document;that page also includes instructions for disclosing a patent. An individual whohas actual knowledge of a patent which the individual believescontains Essential Claim(s) with respect to this specification shoulddisclose the information in accordance withsection 6 of the W3C Patent Policy.

The English version of this specification is the only normativeversion. Information about translations of this document is availableathttp://www.w3.org/2001/05/xmlschema-translations.

This second edition isnot a new version,it merely incorporates the changes dictated by the corrections toerrors found in thefirstedition as agreed by the XML Schema Working Group, as aconvenience to readers. A separate list of all such corrections isavailable athttp://www.w3.org/2001/05/xmlschema-errata.

The errata list for this second edition is available athttp://www.w3.org/2004/03/xmlschema-errata.

Please report errors in this document towww-xml-schema-comments@w3.org (archive).

Note: David Beech has retired since the publication of the first edition,and can be reached atdavidbeech@earthlink.net.

Murray Maloney is no longer affiliated with Commerce One; his contactdetails are unchanged.

Noah Mendelsohn's affiliation has changed since the publication of thefirst edition. He is now at IBM, and can be contacted atnoah_mendelsohn@us.ibm.com

Table of Contents

1Introduction
    1.1Purpose
    1.2Dependencies on Other Specifications
    1.3Documentation Conventions and Terminology
2Conceptual Framework
    2.1Overview of XML Schema
    2.2XML Schema Abstract Data Model
    2.3Constraints and Validation Rules
    2.4Conformance
    2.5Names and Symbol Spaces
    2.6Schema-Related Markup inDocuments Being Validated
    2.7Representation of Schemas on the World Wide Web
3Schema Component Details
    3.1Introduction
    3.2Attribute Declarations
    3.3Element Declarations
    3.4Complex Type Definitions
    3.5AttributeUses
    3.6Attribute Group Definitions
    3.7Model Group Definitions
    3.8Model Groups
    3.9Particles
    3.10Wildcards
    3.11Identity-constraint Definitions
    3.12Notation Declarations
    3.13Annotations
    3.14Simple Type Definitions
    3.15Schemas as a Whole
4Schemas and Namespaces: Access and Composition
    4.1Layer 1: Summary of the Schema-validity Assessment Core
    4.2Layer 2: Schema Documents, Namespaces and Composition
    4.3Layer 3: Schema Document Access and Web-interoperability
5Schemas and Schema-validity Assessment
    5.1Errors in Schema Construction and Structure
    5.2Assessing Schema-Validity
    5.3Missing Sub-components
    5.4Responsibilities of Schema-aware Processors

Appendices

ASchema for Schemas (normative)
BReferences (normative)
COutcome Tabulations (normative)
    C.1Validation Rules
    C.2Contributions to the post-schema-validation infoset
    C.3Schema Representation Constraints
    C.4Schema Component Constraints
DRequired Information Set Items and Properties (normative)
ESchema Components Diagram (non-normative)
FGlossary (non-normative)
GDTD for Schemas (non-normative)
HAnalysis of the Unique Particle Attribution Constraint (non-normative)
IReferences (non-normative)
JAcknowledgements (non-normative)


1 Introduction

This document sets out the structural part (XML Schema: Structures) of the XML Schema definition language.

Chapter 2 presents aConceptual Framework (§2) for XML Schemas, including an introduction to the nature of XML Schemas and an introductionto the XML Schema abstract data model, along with other terminology used throughout this document.

Chapter 3,Schema Component Details (§3), specifies the precisesemantics of each component of the abstract model, the representation of each component in XML, with reference to a DTD and XML Schemafor an XML Schema document type, along with a detailed mapping between the elements andattribute vocabulary of this representation and the components and propertiesof the abstract model.

Chapter 4 presentsSchemas and Namespaces: Access and Composition (§4), including theconnection between documents and schemas, the import, inclusion and redefinition of declarations and definitions and the foundations of schema-validity assessment.

Chapter 5 discussesSchemas and Schema-validity Assessment (§5), including theoverall approach to schema-validity assessment of documents, and responsibilities of schema-aware processors.

The normative appendices include aSchema for Schemas (normative) (§A) for the XML representation of schemas andReferences (normative) (§B).

The non-normative appendices include theDTD for Schemas (non-normative) (§G) and aGlossary (non-normative) (§F).

This document is primarily intended as a language definition reference.As such, although it contains a few examples, it isnot primarily designedto serve as a motivating introduction to the design and its features, or as atutorial for new users.Rather it presents a careful and fully explicit definition of that design, suitablefor guiding implementations. For those in search of a step-by-stepintroduction to the design, the non-normative[XML Schema: Primer] is a much betterstarting point than this document.

next sub-section1.1 Purpose

The purpose ofXML Schema: Structures is to define the nature of XML schemasand their component parts,provide an inventory of XML markup constructs with which to represent schemas, and define theapplication of schemas to XML documents.

The purpose of anXML Schema: Structures schema is to define and describe a class of XML documents by using schema components to constrain and document the meaning, usage and relationships of their constituent parts: datatypes, elements and their content and attributes and their values. Schemas may also provide for the specification of additional document information, such as normalization and defaulting of attributeand element values. Schemas havefacilities for self-documentation. Thus,XML Schema: Structures can be used to define, describe and catalogue XML vocabularies for classes of XML documents.

Any application that consumes well-formed XML can use theXML Schema: Structures formalism to express syntactic, structural and value constraints applicable to its document instances. TheXML Schema: Structures 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 provideall the facilities that might be needed byany application. Some applications may require constraint capabilities not expressible in this language, and so may need to perform their own additional validations.

previous sub-sectionnext sub-section1.2 Dependencies on Other Specifications

The definition ofXML Schema: Structures depends on the following specifications:[XML-Infoset],[XML-Namespaces],[XPath], and[XML Schemas: Datatypes].

SeeRequired Information Set Items and Properties (normative) (§D) for a tabulation of the information itemsand properties specified in[XML-Infoset] which thisspecification requires as a precondition to schema-aware processing.

previous sub-section1.3 Documentation Conventions and Terminology

The section introduces the highlighting and typography as used in this document to present technical material.

Special terms are defined at their point ofintroduction in the text. For example[Definition:]  aterm is something used with a special meaning. The definition islabeled as such and the term it defines is displayed in boldface. The end of the definition is not specially markedin the displayed or printed text. Uses of defined terms are links totheir definitions, set off with middle dots, for instance·term·.

Non-normative examples are set off in boxes and accompanied by a briefexplanation:

Example
<schema targetNamespace="http://www.example.com/XMLSchema/1.0/mySchema">
And an explanation of the example.

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:

Schema ComponentExample
{example property}
Definition of the property.

References to properties of schema components are links tothe relevant definition as exemplified above, set off with curly braces, for instance{example property}.

The correspondence between an element information item which is partof the XML representation of a schema and one or more schema components is presented in a tableauwhich illustrates the element information item(s) involved.This is followed by a tabulation of the correspondence between properties of the componentand properties of the information item. Where context may determine which ofseveral different components may arise, several tabulations, one per context,are given. The property correspondences are normative,as are the illustrations of the XML representation element information items.

In the XML representation, bold-faceattribute names (e.g.count below) indicate a requiredattribute information item, and the rest areoptional. Where an attribute information item has an enumerated typedefinition, the values are shown separated by vertical bars, as forsize below; if there is a default value, it is shownfollowing a colon. Where an attribute information item has a built-in simpletype definition defined in[XML Schemas: Datatypes], a hyperlink to itsdefinition therein is given.

The allowed content of the information item isshown as a grammar fragment, using the Kleene operators?,* and+. Each element name therein is a hyperlink toits own illustration.

Note: The illustrations are derived automatically from theSchema for Schemas (normative) (§A). In the case of apparent conflict, theSchema for Schemas (normative) (§A) takes precedence, as it, together with the·Schema Representation Constraints·, provide the normative statement ofthe form of XML representations.
XML Representation Summaryexample Element Information Item

<example
  count =integer
  size = (large |medium |small) : medium>
  Content:(all |any*)
</example>

Example Schema Component
PropertyRepresentation
{example property}Description of what the property corresponds to, e.g. the value of thesize[attribute]

References to elements in the text are links tothe relevant illustration as exemplified above, set off with angle brackets, for instance<example>.

References to properties of information items as defined in[XML-Infoset] are notated as links to the relevant section thereof, set off with square brackets, for example[children].

Properties which this specification defines for information items areintroduced as follows:

PSVI Contributionsfor example information items
[new property]
The value the property gets.

References to properties of information items defined in this specificationare notated as links to their introduction as exemplified above, set off with square brackets, for example[new property].

The following highlighting is used for non-normative commentary in this document:

Note: General comments directed to all readers.

Following[XML 1.0 (Second Edition)], within normative prose in this specification, the wordsmay andmust are defined as follows:

may
Conforming documents and XML Schema-aware processors are permitted to but need not behave as described.
must
Conforming documents and XML Schema-aware processors are required to behave as described; otherwise they are in error.

Note however that this specification provides a definition of error and of conformant processors'responsibilities with respect to errors (seeSchemas and Schema-validity Assessment (§5)) which is considerablymore complex than that of[XML 1.0 (Second Edition)].

2 Conceptual Framework

This chapter gives an overview ofXML Schema: Structures at the level of its abstract data model.Schema Component Details (§3) provides details on this model, includinga normative representation in XML for the components of the model.Readers interested primarily in learning to write schema documents may wish tofirst read[XML Schema: Primer] for a tutorial introduction, and only then consult the sub-sections ofSchema Component Details (§3) namedXML Representation of ... forthe details.

next sub-section2.1 Overview of XML Schema

An XML Schemaconsists of components such as type definitionsand element declarations. These can be used to assess the validity ofwell-formed element and attribute information items (as definedin[XML-Infoset]), and furthermoremay specify augmentations to those items and their descendants. This augmentation makes explicit information which may havebeen implicit in the original document, such as normalized and/or default values forattributes and elements andthe types of element and attribute information items.[Definition:]  We refer to the augmented infoset which results from conformant processing as defined in this specification as thepost-schema-validation infoset, or PSVI.

Schema-validity assessment has two aspects:

1Determining local schema-validity, that iswhether an element or attribute information item satisfies theconstraints embodied in the relevantcomponents of an XML Schema;
2 Synthesizing an overall validation outcome for the item,combining local schema-validity with the results of schema-validityassessments of its descendants, if any, andadding appropriate augmentations to the infoset to record this outcome.

Throughout this specification,[Definition:]  thewordvalid and its derivatives are used to refer toclause1 above, the determination of localschema-validity.

Throughout this specification,[Definition:]   the wordassessment is used to referto the overall process oflocal validation, schema-validity assessment and infoset augmentation.

previous sub-sectionnext sub-section2.2 XML Schema Abstract Data Model

        2.2.1Type Definition Components
        2.2.2Declaration Components
        2.2.3Model Group Components
        2.2.4Identity-constraint Definition Components
        2.2.5Group Definition Components
        2.2.6Annotation Components

This specification builds on[XML 1.0 (Second Edition)] and[XML-Namespaces]. The concepts and definitions usedherein regarding XML are framed at the abstract level ofinformationitems as defined in[XML-Infoset]. Bydefinition, this use of the infoset providesa priori guarantees ofwell-formedness(as defined in[XML 1.0 (Second Edition)]) andnamespaceconformance (as defined in[XML-Namespaces]) forall candidates for·assessment· and for all·schema documents·.

Just as[XML 1.0 (Second Edition)] and[XML-Namespaces] can be described in terms ofinformation items, XML Schemas can be described in terms of anabstract data model. In defining XML Schemas in terms of an abstractdata model, this specification rigorously specifies the information whichmust be available to a conforming XML Schema processor. The abstractmodel for schemas is conceptual only, and does not mandate anyparticular implementation or representation of this information. Tofacilitate interoperation and sharing of schema information, anormative XML interchange format for schemas is provided.

[Definition:]  Schema component is the generic term for the building blocks that comprise the abstract data model of the schema.[Definition:]  AnXML Schema is aset of·schema components·. There are 13 kinds ofcomponent in all, falling into three groups. The primary components, which may(type definitions) or must (element and attribute declarations) have namesare as follows:

  • Simple type definitions
  • Complex type definitions
  • Attribute declarations
  • Element declarations

The secondary components, which must have names, are as follows:

  • Attribute group definitions
  • Identity-constraint definitions
  • Model group definitions
  • Notation declarations

Finally, the "helper" components provide small parts ofother components; they are not independent of their context:

  • Annotations
  • Model groups
  • Particles
  • Wildcards
  • Attribute Uses

During·validation·,[Definition:]  declaration components are associated by(qualified) name to information items being·validated·.

On the other hand,[Definition:]  definition components defineinternal schema components that can be used in other schema components.

[Definition:]  Declarations anddefinitions may have and be identified bynames, which are NCNames as defined by[XML-Namespaces].

[Definition:]  Several kindsof component have atarget namespace, which is either·absent· or a namespace name, also asdefined by[XML-Namespaces]. The·targetnamespace· serves to identify the namespace within which theassociation between the component and its name exists. In the case ofdeclarations, this in turn determines the namespace name of, for example, the elementinformation items it may·validate·.

Note: At the abstract level, there isno requirement that the components of a schema share a·target namespace·. Any schema for use in·assessment· of documents containing names from more than one namespacewill of necessity include components with different·target namespaces·. This contrasts withthe situation at the level of the XML representation of components, in which each schema document contributesdefinitions and declarations to a single target namespace.

·Validation·, defined in detail inSchema Component Details (§3), is arelation between information items and schema components. For example, anattribute information item may·validate· with respect to an attributedeclaration, a list of element information items may·validate· withrespect to a content model, and so on. The following sections brieflyintroduce the kinds of components in theschema abstract data model, other major features of the abstractmodel, and how they contribute to·validation·.

2.2.1 Type Definition Components

The abstract model provides two kinds of type definition component: simpleand complex.

[Definition:]  This specification usesthe phrasetype definition in cases where no distinctionneed be made between simple and complex types.

Type definitions form a hierarchy with a single root. The subsections below first describe characteristics of thathierarchy, then provide an introduction to simple and complex type definitions themselves.

2.2.1.1 Type Definition Hierarchy

[Definition:]  Except for a distinguished·ur-type definition·, every·type definition· is, by construction, either a·restriction· or an·extension· of some other type definition. The graph of these relationships forms a tree known as theType Definition Hierarchy.

[Definition:]  A typedefinition whosedeclarations or facets are in a one-to-one relation with those of anotherspecified typedefinition, with each in turn restricting the possibilities of the one itcorresponds to, is said to be arestriction.The specific restrictions might include narrowed ranges or reducedalternatives.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.

[Definition:]  A complex type definitionwhich allows element or attribute content in addition to that allowed byanother specified typedefinition is said to be anextension.

[Definition:]  A distinguished complextype definition, theur-typedefinition, whosename isanyType in the XML Schema namespace, is present in each·XML Schema·, serving as the root of the typedefinition hierarchy for that schema.

[Definition:]  A type definition used as thebasis for an·extension· or·restriction· is known asthebase type definition of that definition.

2.2.1.2 Simple Type Definition

A simple type definition is a set of constraints on strings and information about the values they encode, applicable to the·normalized value· of an attributeinformation 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.

Each simple type definition, whether built-in (that is, defined in[XML Schemas: Datatypes]) oruser-defined, is a·restriction· of some particularsimple·base typedefinition·. For the built-in primitive type definitions, this is[Definition:]  thesimpleur-type definition, a special restriction of the·ur-typedefinition·, whose name isanySimpleType in the XML Schema namespace. The·simple ur-type definition· 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.

The mapping from lexical space to value space isunspecified for items whose type definition is the·simple ur-type definition·. Accordingly this specification does not constrain processors' behaviour inareas where this mapping is implicated, for example checking such items againstenumerations, constructing default attributes or elements whose declared typedefinition is the·simple ur-type definition·, checkingidentity constraints involving such items.

Note: The Working Group expects to return to this area in a futureversion of this specification.

Simple types mayalso be defined whose members are lists of itemsthemselves constrained by some other simple type definition, or whosemembership is the union of the memberships of some other simple typedefinitions. Such list and union simple type definitions are also restrictions of the·simple ur-typedefinition·.

For detailed information on simple type definitions, seeSimple Type Definitions (§3.14) and[XML Schemas: Datatypes]. The latter also defines an extensive inventory ofpre-defined simple types.

2.2.1.3 Complex Type Definition

A complex type definition is a set of attribute declarations and a content type, applicable to the[attributes] and[children] of an element information item respectively. The content type mayrequire the[children] to contain neither element nor character informationitems (that is, to be empty), to be a string which belongs to a particular simpletype or to contain a sequence of element information items which conforms to a particular model group, with or without character information items as well.

Each complex type definition other than the·ur-type definition· is either

or

Acomplex type which extends another does so by having additional content modelparticles at the end of the other definition's content model,or by having additional attribute declarations, or both.

Note: This specification allows only appending, and not other kinds ofextensions. This decisionsimplifies application processing required to cast instances from derived tobase type. Future versions may allow more kinds of extension, requiring morecomplex transformations to effect casting.

For detailed information on complex type definitions, seeComplex Type Definitions (§3.4).

2.2.2 Declaration Components

There are three kinds of declaration component: element, attribute, andnotation. Each is described in a section below. Also included is a discussionof element substitution groups, which is a feature provided in conjunction withelement declarations.

2.2.2.1 Element Declaration

An element declaration is an association of a name with a type definition, either simple orcomplex, an (optional) default value and a (possibly empty) set of identity-constraintdefinitions. The association is either global or scoped to a containing complex type definition. Atop-level element declaration with name 'A' is broadly comparable to a pair ofDTD declarations as follows, where the associated type definitionfills in the ellipses:

<!ELEMENT A . . .><!ATTLIST A . . .>

Element declarations contribute to·validation· as part of model group·validation·, when their defaults and type components are checked against an elementinformation item with a matching name and namespace, and by triggeringidentity-constraint definition·validation·.

For detailed information on element declarations, seeElement Declarations (§3.3).

2.2.2.2 Element Substitution Group

In XML 1.0, the name and content of an element must correspond exactly to the element type referenced in the corresponding content model.

[Definition:]  Throughthe new mechanism ofelement substitution groups, XML Schemas provides a more powerful model supporting substitution of one named element for another.Any top-level element declaration can serve as the defining member, orhead, for an element substitution group. Other top-level element declarations,regardless of target namespace, can be designated as members of thesubstitution group headed by this element. In a suitably enabled contentmodel, a reference to the head·validates· not just the head itself, but elementscorresponding to any other member of the substitution group as well.

All such members must have type definitions which are either the same as thehead's type definition orrestrictions or extensions of it.Therefore, although the names of elements can vary widely as newnamespaces and members of the substitution group are defined, thecontent of member elements is strictly limited according to the typedefinition of the substitution group head.

Note that element substitution groups are not represented as separate components. They arespecified in the property values for element declarations (seeElement Declarations (§3.3)).

2.2.2.3 Attribute Declaration

An attribute declaration is an association between a name and a simple type definition, togetherwith occurrence information and (optionally) a default value. Theassociation is either global, or local to its containing complex type definition. Attribute declarations contribute to·validation· as part of complex type definition·validation·, when theiroccurrence, defaults and type components are checked against an attributeinformation item with a matching name and namespace.

For detailed information on attribute declarations, seeAttribute Declarations (§3.2).

2.2.2.4 Notation Declaration

A notation declaration is an association between a name and an identifier for anotation. For an attribute information item to be·valid· with respect to aNOTATION simple type definition, its value must have been declaredwith a notation declaration.

For detailed information on notation declarations, seeNotation Declarations (§3.12).

2.2.3 Model Group Components

The model group, particle, and wildcard components contribute tothe portion of a complex type definition that controls an elementinformation item's content.

2.2.3.1 Model Group

A model group is a constraint in the form of a grammar fragment that applies tolists of element information items. It consists of a list of particles, i.e.element declarations, wildcards and model groups. There are three varieties ofmodel group:

For detailed information on model groups, seeModel Groups (§3.8).

2.2.3.2 Particle

A particle is a term in the grammar for element content, consisting of either an elementdeclaration, a wildcard or a model group, together withoccurrence constraints. Particles contribute to·validation· as part of complex type definition·validation·, when they allow anywherefrom zero to many element information items or sequences thereof, depending ontheir contents and occurrenceconstraints.

[Definition:]  A particle canbe used in a complex type definition to constrain the·validation·of the[children] of an element information item; such a particle is calledacontent model.

Note: XML Schema: Structures·content models· are similar to but more expressive than[XML 1.0 (Second Edition)] content models; unlike[XML 1.0 (Second Edition)],XML Schema: Structures applies·content models· to the·validation· of both mixed and element-only content.

For detailed information on particles, seeParticles (§3.9).

2.2.3.3 Attribute Use

An attribute use plays a role similar to that of a particle, but forattribute declarations: an attribute declaration within a complex type definitionis embedded within an attribute use, which specifies whether the declarationrequires or merely allows its attribute, and whether it has a default or fixed value.

2.2.3.4 Wildcard

A wildcard is a special kind of particle which matches element and attribute information items dependent on their namespace name, independentlyof their local names.

For detailed information on wildcards, seeWildcards (§3.10).

2.2.4 Identity-constraint Definition Components

An identity-constraint definition is an association between a name and one ofseveral varieties ofidentity-constraint related to uniqueness and reference. All thevarieties use[XPath] expressions to pick out sets ofinformation items relative to particular target elementinformation items which are unique, or a key, or a·valid· reference, withina specified scope. An element information item is only·valid· withrespect to an element declarationwith identity-constraint definitions if those definitions are all satisfied for all the descendantsof that element information item which they pick out.

For detailed information on identity-constraint definitions, seeIdentity-constraint Definitions (§3.11).

2.2.5 Group Definition Components

There are two kinds of convenience definitions provided to enablethe re-use of pieces of complex type definitions: model group definitionsand attribute group definitions.

2.2.5.1 Model Group Definition

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

For detailed information on model group definitions, seeModel Group Definitions (§3.7).

2.2.5.2 Attribute Group Definition

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

For detailed information on attribute group definitions, seeAttribute Group Definitions (§3.6).

2.2.6 Annotation Components

An annotation is information for human and/or mechanicalconsumers. The interpretation of such information isnot defined in this specification.

For detailed information on annotations, seeAnnotations (§3.13).

previous sub-sectionnext sub-section2.3 Constraints and Validation Rules

The[XML 1.0 (Second Edition)] specification describes two kinds of constraints on XML documents:well-formedness andvalidity constraints. Informally, the well-formedness constraints are those imposed by the definition of XML itself (such as the rules for the use of the < and > characters and the rules for proper nesting of elements), while validity constraints are the further constraints on document structure provided by a particular DTD.

The preceding section focused on·validation·, that isthe constraints on information items which schema components supply. In facthowever this specification provides four different kinds of normative statements about schema components, their representations in XML and their contribution to the·validation· of information items:

Schema Component Constraint
[Definition:]  Constraints on the schema components themselves, i.e.conditions components must satisfy to be components at all. Located in thesixth sub-section of the per-component sections ofSchema Component Details (§3)and tabulated inSchema Component Constraints (§C.4).
Schema Representation Constraint
[Definition:]  Constraints on therepresentation of schema components in XML beyond those which are expressedinSchema for Schemas (normative) (§A). Located in thethird sub-section of the per-component sections ofSchema Component Details (§3)and tabulated inSchema Representation Constraints (§C.3).
Validation Rules
[Definition:]  Contributions to·validation· associatedwith schema components. Located in thefourth sub-section of the per-component sections ofSchema Component Details (§3)and tabulated inValidation Rules (§C.1).
Schema Information Set Contribution
[Definition:]  Augmentations to·post-schema-validation infoset·sexpressed by schema components, which follow as a consequence of·validation· and/or·assessment·.Located in thefifth sub-section of the per-component sections ofSchema Component Details (§3)and tabulated inContributions to the post-schema-validation infoset (§C.2).

The last of these, schema information set contributions, are not as new as they might at first seem. XML 1.0 validation augments the XML 1.0 information set in similar ways,for example by providing values for attributes not present in instances, and by implicitly exploiting type information for normalization or access.(As an example of the latter case, consider the effect ofNMTOKENS on attribute white space, and the semantics ofID andIDREF.) By including schemainformation set contributions, this specification makes explicit some featuresthat XML 1.0 left implicit.

previous sub-sectionnext sub-section2.4 Conformance

This specification describes three levels of conformance for schema aware processors. The first isrequired of all processors. Support for the other two will depend on the application environmentsfor which the processor is intended.

[Definition:]  Minimally conforming processors must completely andcorrectly implement the·Schema ComponentConstraints·,·Validation Rules·,and·Schema InformationSet Contributions· contained in this specification.

[Definition:]  ·Minimally conforming· processors which acceptschemas represented in the form of XML documents as described inLayer 2: Schema Documents, Namespaces and Composition (§4.2) areadditionally said to provideconformance to the XML Representation of Schemas.Such processors must, when processing schema documents, completely andcorrectly implement all·Schema RepresentationConstraints· in this specification, and must adhere exactly to thespecifications inSchema Component Details (§3) for mapping the contents ofsuch documents to·schemacomponents· for use in·validation· and·assessment·.

Note: By separating the conformance requirements relating to the concrete syntax of XML schemadocuments, this specification admits processorswhich use schemas stored in optimized binaryrepresentations, dynamically created schemas represented as programming language data structures, or implementations in which particular schemas are compiled into executable codesuch as C or Java. Such processors can be said to be·minimally conforming· but not necessarily in·conformance to the XML Representation of Schemas·.

[Definition:]  Fully conformingprocessors are network-enabled processors which are not only both·minimally conforming· and·in conformance to the XML Representation of Schemas·, but which additionally must be capable of accessingschema documents from the World Wide Web according toRepresentation of Schemas on the World Wide Web (§2.7) andHow schema definitions are located on the Web (§4.3.2)..

Note: Although this specification provides just these three standard levels of conformance, it isanticipated that other conventions can be established in the future. For example, the World WideWeb Consortium is considering conventions for packaging on the Web a variety ofresources relating to individual documents and namespaces. Should suchdevelopments 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 modifyor republish this specification to define such additional levels of conformance.

SeeSchemas and Namespaces: Access and Composition (§4) for a more detailed explanation of themechanisms supporting these levels of conformance.

previous sub-sectionnext sub-section2.5 Names and Symbol Spaces

As discussed inXML Schema Abstract Data Model (§2.2), most schema components (may) have·names·.If all such names were assigned from the same "pool", then it would be impossible to have, for example, a simple type definition and an elementdeclaration both with the name"title" in a given·target namespace·.

Therefore[Definition:]  this specification introduces the termsymbol space to denote acollection of names, each of which is unique with respect to the others. A symbol space is similar to the non-normative concept ofnamespace partition introduced in[XML-Namespaces].There is a single distinct symbol space within a given·targetnamespace· for each kind of definition and declaration componentidentified inXML Schema Abstract Data Model (§2.2), except that within a target namespace, simpletype 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.

Locally scoped attribute and elementdeclarations 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 othersymbol spaces. So, for example, two complex type definitions havingthe same target namespace can containa local attribute declaration for the unqualified name "priority", or contain a local element declarationfor the name "address", without conflict or necessary relation betweenthe two.

previous sub-sectionnext sub-section2.6 Schema-Related Markup inDocuments Being Validated

        2.6.1xsi:type
        2.6.2xsi:nil
        2.6.3xsi:schemaLocation, xsi:noNamespaceSchemaLocation

The XML representation of schema components uses a vocabularyidentified by the namespace namehttp://www.w3.org/2001/XMLSchema. For brevity, the text and examples in this specification use the prefixxs: to stand for this namespace; in practice,any prefix can be used.

XML Schema: Structures also defines several attributes for direct use in any XML documents. These attributes are in a different namespace,which has the namespace namehttp://www.w3.org/2001/XMLSchema-instance.For brevity, the text and examples in this specification use the prefixxsi: to stand for this latter namespace; in practice,any prefix can be used. All schema processors have appropriate attributedeclarations for these attributes built in, seeAttribute Declaration for the 'type' attribute (§3.2.7),Attribute Declaration for the 'nil' attribute (§3.2.7),Attribute Declaration for the 'schemaLocation' attribute (§3.2.7) andAttribute Declaration for the 'noNamespaceSchemaLocation' attribute (§3.2.7).

2.6.1 xsi:type

TheSimple Type Definition (§2.2.1.2) orComplex Type Definition (§2.2.1.3) used in·validation· of an element is usuallydetermined by reference to the appropriate schema components.An element information item in an instance may, however,explicitly assert its type using the attributexsi:type.The value of this attribute is a·QName·; seeQName Interpretation (§3.15.3) forthe means by which the·QName· isassociated with a type definition.

2.6.2 xsi:nil

XML Schema: Structures introduces a mechanism for signaling that an element shouldbe accepted as·valid· when it has nocontent despite a content type which does not require or even necessarily allow empty content. Anelement may be·valid· without content if it has the attributexsi:nil withthe valuetrue. An element so labeled must be empty, but cancarry attributes if permitted by the corresponding complex type.

2.6.3 xsi:schemaLocation, xsi:noNamespaceSchemaLocation

Thexsi:schemaLocation andxsi:noNamespaceSchemaLocation attributes can be used in a document to providehints as to the physical location of schema documents which may be used for·assessment·.SeeHow schema definitions are located on the Web (§4.3.2) for details on the use of these attributes.

previous sub-section2.7 Representation of Schemas on the World Wide Web

On the World Wide Web, schemas are conventionally represented as XMLdocuments (preferably of MIME typeapplication/xml ortext/xml, but see clause1.1 ofInclusion Constraints and Semantics (§4.2.1)), conforming to the specifications inLayer 2: Schema Documents, Namespaces and Composition (§4.2). For more information onthe representation and use of schema documents on the World Wide Web seeStandards for representation of schemas and retrieval of schema documents on the Web (§4.3.1) andHow schema definitions are located on the Web (§4.3.2).

3 Schema Component Details

next sub-section3.1 Introduction

        3.1.1Components and Properties
        3.1.2XML Representations of Components
        3.1.3The Mapping between XML Representations and Components
        3.1.4White Space Normalization during Validation

The following sections provide full details on the composition of all schema components, togetherwith their XML representations and their contributions to·assessment·. Each section is devoted to a single component, with separate subsections for

  1. properties: their values and significance
  2. XML representation and the mapping to properties
  3. constraints on representation
  4. validation rules
  5. ·post-schema-validation infoset· contributions
  6. constraints on the components themselves

The sub-sections immediately below introduce conventions and terminology used throughout the component sections.

3.1.1 Components and Properties

Components are defined in terms of theirproperties, and each property in turn is defined by giving its range,that is the values it may have. This can be understood asdefining a schema as a labeled directed graph, where the root is a schema,every other vertex is a schemacomponent or a literal (string, boolean, number) and every labeled edge is aproperty. The graph isnot acyclic: multiple copies ofcomponents with the same name in the same·symbol space· may not exist, so in some cases re-entrant chainsof properties must exist. Equality of components for the purposes of thisspecification is always defined as equality of names (including targetnamespaces) within symbol spaces.

Note: A schema and its components as defined in this chapter are an idealization of the information a schema-awareprocessor requires: implementations are not constrained in how they provideit. In particular, no implications about literal embedding versus indirectionfollow from the use below of language such as "properties . . . having . . .components as values".

[Definition:]  Throughout this specification, thetermabsent is used as a distinguished property value denoting absence.

Any property notidentified as optional is required to be present; optional properties which arenot present are taken to have·absent· as their value. Anyproperty identified as a having a set, subset or list value may have an empty value unless this is explicitlyruled out: this isnot the same as·absent·. 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 asequence of ISO 10646 characters identified aslegal XML charactersin[XML 1.0 (Second Edition)].

3.1.2 XML Representations of Components

The principal purpose ofXML Schema: Structures is to define a set of schema components that constrain the contents of instances and augment the information sets thereof. Although no external representationof schemas is required for this purpose, such representations willobviously be widely used. To provide for this in an appropriate andinteroperable way, this specification provides a normative XML representation for schemas whichmakes provision for every kind of schemacomponent.[Definition:]  A document inthis form (i.e. a<schema> element information item) is aschema document. For the schema document as a whole, andits constituents, the sections below define correspondences between elementinformation items (with declarations inSchema for Schemas (normative) (§A) andDTD for Schemas (non-normative) (§G)) andschema components. All the element information items in the XML representationof a schema must be in the XML Schema namespace, that is their[namespace name] must behttp://www.w3.org/2001/XMLSchema. Although a common way of creating the XML Infosets which are or contain·schema documents· will be using an XML parser, this is not required: any mechanism which constructs conformant infosets as defined in[XML-Infoset] is a possible starting point.

Two aspects of the XML representations of components presented in thefollowing sections are constant across them all:

  1. All of them allow attributes qualified with namespace names other thanthe XML Schema namespace itself: these appear as annotations in thecorresponding schema component;
  2. All of them allow an<annotation> as their first child, for human-readable documentation and/or machine-targeted information.

3.1.3 The Mapping between XML Representations and Components

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 ofschema component on the one hand and the properties of information items inthat XML representation on the other, togetherwith constraints on that representation above and beyond those implicit in theSchema for Schemas (normative) (§A).

The language used is as if the correspondences were mappings from XML representation toschema component, but the mapping in the other direction, and therefore thecorrespondence in the abstract, can always beconstructed therefrom.

In discussing the mapping from XML representations to schemacomponents below, the value of a component property is often determined by thevalue of an attribute information item, one of the[attributes] of an elementinformation item. Since schema documents are constrained by theSchema for Schemas (normative) (§A), there is always a simple typedefinition associated with any such attribute information item.[Definition:]  Thephraseactual value is used to refer to the member of the value space of thesimple type definition associated with an attribute information item which corresponds toits·normalized value·. This will often be a string, but may also be aninteger, a boolean, a URI reference, etc. This term is also occasionally used with respect to element or attribute information items in a document being·validated·.

Many properties are identified below as havingother schema components or sets of components as values. For the purposes of exposition, the definitions inthis section assume that (unless the property is explicitly identified asoptional) all such values are in fact present. When schemacomponents are constructed from XML representations involving reference by nameto other components, this assumption may be violated if one or more referencescannot be resolved. This specification addresses the matter of missingcomponents in a uniform manner, described inMissing Sub-components (§5.3): no mention ofhandling missing components will be found in the individual componentdescriptions below.

Forward reference to named definitions and declarationsisallowed, both within and between·schema documents·. By the time the component corresponding to an XML representation whichcontains a forward reference is actually needed for·validation· an appropriately-named component may have become available to discharge the reference: seeSchemas and Namespaces: Access and Composition (§4) for details.

3.1.4 White Space Normalization during Validation

Throughout this specification,[Definition:]  theinitial value of someattribute information item is the value of the[normalizedvalue] property of that item. Similarly, theinitial value of an element information item is the string composed of, in order, the[character code] of each character information item in the[children] of thatelement information item.

The above definition means that comments and processing instructions,even in the midst of text, are ignored for all·validation· purposes.

[Definition:]  Thenormalized value of an element orattribute information item is an·initial value· whose white space, if any, has beennormalized according to the value of thewhiteSpace facet of thesimple type definition used in its·validation·:

preserve
No normalization is done, the value is the·normalized value·
replace
All occurrences of#x9 (tab),#xA (line feed) and#xD (carriage return) are replaced with#x20 (space).
collapse
Subsequent to the replacements specified above underreplace,contiguous sequences of#x20s are collapsed to a single#x20, and initial and/or final#x20s are deleted.

If the simple type definition used in an item's·validation· is the·simple ur-type definition·, the·normalized value· must be determined as in thepreserve case above.

There are three alternative validation rules which may supply thenecessary background for the above:Attribute Locally Valid (§3.2.4) (clause3),Element Locally Valid (Type) (§3.3.4) (clause3.1.3) orElement Locally Valid (Complex Type) (§3.4.4) (clause2.2).

These three levels of normalization correspond to the processing mandatedin XML 1.0 for element content, CDATA attribute content and tokenizedattributed content, respectively. SeeAttribute Value Normalization in[XML 1.0 (Second Edition)] for the precedent forreplace andcollapse for attributes. Extending this processing to element content is necessary to ensure a consistent·validation· semantics for simple types, regardless of whether they are applied to attributes or elements. Performing it twice in the case of attributes whose[normalizedvalue] has already been subject to replacement or collapse on the basis ofinformation in a DTD is necessary to ensure consistent treatment of attributesregardless of the extent to which DTD-based information has been made use ofduring infoset construction.

Note: Even when DTD-based informationhas been appealed to, andAttribute ValueNormalization has taken place, the above definition of·normalized value· maymeanfurther normalization takes place, as for instance whencharacter entity references in attribute values result in white space charactersother than spaces in their·initial value·s.

previous sub-sectionnext sub-section3.2 Attribute Declarations

        3.2.1The Attribute Declaration Schema Component
        3.2.2XML Representation of Attribute Declaration Schema Components
        3.2.3Constraints on XML Representations of Attribute Declarations
        3.2.4Attribute Declaration Validation Rules
        3.2.5Attribute Declaration Information Set Contributions
        3.2.6Constraints on Attribute Declaration Schema Components
        3.2.7Built-in Attribute Declarations

Attribute declarations provide for:

  • Local·validation· of attribute information item values using a simple type definition;
  • Specifying default or fixed values for attribute information items.
Example
<xs:attribute name="age" type="xs:positiveInteger" use="required"/>
The XML representation of an attribute declaration.

3.2.1 The Attribute Declaration Schema Component

The attribute declaration schema component has the followingproperties:

{name}
An NCName as defined by[XML-Namespaces].
{target namespace}
Either·absent· ora namespace name, as defined in[XML-Namespaces].
{type definition}
Asimple type definition.
{scope}
Optional. Eitherglobal or a complex typedefinition.
{value constraint}
Optional. A pairconsisting of a value and one ofdefault,fixed.
{annotation}
Optional. An annotation.

The{name} property must match the local part of the names of attributes being·validated·.

The value of the attribute must conform to the supplied{type definition}.

A non-·absent· value of the{target namespace} property provides for·validation· ofnamespace-qualified attribute information items (which must be explicitlyprefixed in the character-level form of XML documents).·Absent· values of{target namespace}·validate· unqualified (unprefixed) items.

A{scope} ofglobal identifies attribute declarationsavailable for use in complex type definitions throughout the schema. Locally scoped declarations are available for use only within thecomplex type definition identified by the{scope} property. This property is·absent· 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.

{value constraint} reproduces the functions of XML 1.0 default and#FIXEDattribute values.default specifies that the attribute is to appear unconditionally inthe·post-schema-validation infoset·, with the supplied value usedwhenever the attribute is not actually present;fixed indicates that the attribute value if present must equal the suppliedconstraint value, and if absent receives the supplied value as fordefault. Note that it isvalues that are supplied and/orchecked, not strings.

SeeAnnotations (§3.13) for information on the role of the{annotation} property.

Note: A more complete and formal presentation of the semantics of{name},{target namespace} and{value constraint} is provided inconjunction with other aspects of complex type·validation· (seeElement Locally Valid (Complex Type) (§3.4.4).)

[XML-Infoset] distinguishes attributes with names such asxmlns orxmlns:xsl fromordinary attributes, identifying them as[namespace attributes]. Accordingly, it is unnecessary and in fact not possible forschemas to contain attribute declarations corresponding to suchnamespace declarations, seexmlns Not Allowed (§3.2.6). No means is provided inthis specification to supply adefault value for a namespace declaration.

3.2.2 XML Representation of Attribute Declaration Schema Components

The XML representation for an attribute declaration schema component is an<attribute> element information item. It specifies a simple typedefinition for an attribute either by reference or explicitly, and may provide default information. The correspondences between theproperties of the information item andproperties of the component are as follows:

XML Representation Summaryattribute Element Information Item

<attribute
  default =string
  fixed =string
  form = (qualified |unqualified)
  id =ID
  name =NCName
  ref =QName
  type =QName
  use = (optional |prohibited |required) : optional
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?,simpleType?)
</attribute>

If the<attribute> element information item has<schema> as its parent, the corresponding schema component is as follows:
Attribute Declaration Schema Component
PropertyRepresentation
{name}The·actual value· of thename[attribute]
{target namespace}The·actual value· of thetargetNamespace[attribute] of the parent<schema>element information item, or·absent· if there is none.
{type definition}The simple type definitioncorresponding to the<simpleType> element information item in the[children], if present, otherwise the simple type definition·resolved· to bythe·actual value· of thetype[attribute], if present, otherwise the·simple ur-type definition·.
{scope}global.
{value constraint}If there is adefault or afixed[attribute], then a pair consisting of the·actual value· (with respect to the{type definition}) of that[attribute] andeitherdefault orfixed, as appropriate, otherwise·absent·.
{annotation}The annotation corresponding to the<annotation> element information item in the[children], if present, otherwise·absent·.
otherwise if the<attribute> element information item has<complexType> or<attributeGroup> as an ancestorand theref[attribute] is absent, it corresponds to anattribute use with properties as follows (unlessuse='prohibited', in which case the itemcorresponds to nothing at all):
Attribute Use Schema Component
PropertyRepresentation
{required}true if theuse[attribute] is present with·actual value·required, otherwisefalse.
{attribute declaration}See the Attribute Declaration mappingimmediately below.
{value constraint}If there is adefault or afixed[attribute], then a pair consisting of the·actual value· (with respect to the{type definition} of the{attribute declaration}) of that[attribute] andeitherdefault orfixed, as appropriate, otherwise·absent·.
Attribute Declaration Schema Component
PropertyRepresentation
{name}The·actual value· of thename[attribute]
{target namespace}Ifform is present and its·actual value· isqualified, or ifform is absent and the·actual value· ofattributeFormDefault on the<schema>ancestor isqualified, then the·actual value· of thetargetNamespace[attribute] of the parent<schema>element information item, or·absent· if thereis none, otherwise·absent·.
{type definition}The simple type definitioncorresponding to the<simpleType> element information item in the[children], if present, otherwise the simple type definition·resolved· to bythe·actual value· of thetype[attribute], if present, otherwise the·simple ur-type definition·.
{scope}If the<attribute> element information itemhas<complexType> as an ancestor, the complex definitioncorresponding to that item, otherwise (the<attribute> elementinformation item is within an<attributeGroup> definition),·absent·.
{value constraint}·absent·.
{annotation}The annotation corresponding to the<annotation> element information item in the[children], if present, otherwise·absent·.
otherwise (the<attribute> element information item has<complexType> or<attributeGroup> as an ancestor and theref[attribute] is present), it corresponds to anattribute use with properties as follows (unlessuse='prohibited', in which case the itemcorresponds to nothing at all):
Attribute Use Schema Component
PropertyRepresentation
{required}true if theuse[attribute] is present with·actual value·required, otherwisefalse.
{attribute declaration}The (top-level) attribute declaration·resolved· to by the·actual value· of theref[attribute]
{value constraint}If there is adefault or afixed[attribute], then a pair consisting of the·actual value· (with respect to the{type definition} of the{attribute declaration}) of that[attribute] andeitherdefault orfixed, as appropriate, otherwise·absent·.

Attribute declarations can appear at the top level of a schema document, or within complextype definitions, either as complete (local) declarations, or by reference to top-leveldeclarations, or within attribute group definitions. For complete declarations, top-level or local, thetype attribute is used when the declaration can use abuilt-in or pre-declared simple type definition. Otherwise ananonymous<simpleType> is provided inline.

The default when no simple type definition is referenced orprovided is the·simple ur-type definition·, which imposes no constraints at all.

Attribute information items·validated· by a top-level declaration must be qualified with the{target namespace} of that declaration (if this is·absent·, the item must be unqualified). Control over whether attribute information items·validated· by a local declaration must be similarly qualified or notis provided by theform[attribute], whose default is providedby theattributeFormDefault[attribute] on the enclosing<schema>, via its determination of{target namespace}.

The names for top-level attribute declarations are in their own·symbol space·. The names of locally-scopedattribute declarations reside in symbol spaces local to the type definition which containsthem.

3.2.3 Constraints on XML Representations of Attribute Declarations

Schema Representation Constraint: Attribute Declaration Representation OK
In addition to the conditions imposed on<attribute> elementinformation items by the schema for schemas,all of the following must be true:
1default andfixed must not both be present.
2 Ifdefault anduse are both present,use must have the·actual value·optional.
3 If the item's parent is not<schema>, thenall of the following must be true:
3.1 One ofref orname must be present, but not both.
3.2 Ifref is present, then all of<simpleType>,form andtype must be absent.
4type and<simpleType>must not both be present.
5 The corresponding attributedeclaration must satisfy the conditions set out inConstraints on Attribute Declaration Schema Components (§3.2.6).

3.2.4 Attribute Declaration Validation Rules

Validation Rule: Attribute Locally Valid
For an attribute information item to be locally·valid· with respect to anattribute declarationall of the following must be true:
1The declaration must not be·absent· (seeMissing Sub-components (§5.3) forhow this can fail to be the case).
2Its{type definition} must not be absent.
3The item's·normalized value· must be locally·valid· with respect to that{type definition} as perString Valid (§3.14.4).
4 The item's·actual value· must match the value of the{value constraint}, if it ispresent andfixed.
Validation Rule: Schema-Validity Assessment (Attribute)
The schema-validity assessment of an attribute information item dependson its·validation· alone.

[Definition:]  During·validation·, associationsbetween element and attribute information items among the[children]and[attributes] on the one hand, and element and attributedeclarations on the other, are established as a side-effect. Suchdeclarations are called thecontext-determined declarations. See clause3.1 (inElement Locally Valid (Complex Type) (§3.4.4)) forattribute declarations, clause2 (inElement Sequence Locally Valid (Particle) (§3.9.4)) for elementdeclarations.

For an attribute information item's schema-validity to have been assessedall of the following must be true:

1 A non-·absent· attribute declarationmust be known for it, namelyone of the following:
1.1 A declaration which has been established as its·context-determined declaration·;
1.2A declaration resolved to by its[local name] and[namespace name] as defined byQName resolution (Instance) (§3.15.4), provided its·context-determined declaration· isnotskip.
2 Its·validity· with respect to thatdeclaration must have been evaluated as perAttribute Locally Valid (§3.2.4).
3 Both clause1 and clause2 ofAttribute Locally Valid (§3.2.4) must be satisfied.

[Definition:]  For attributes, there is nodifference between assessment and strict assessment, so if the above holds, the attribute information item has beenstrictly assessed.

3.2.5 Attribute Declaration Information Set Contributions

Schema Information Set Contribution: Assessment Outcome (Attribute)
If the schema-validity of an attribute information item has been assessedas perSchema-Validity Assessment (Attribute) (§3.2.4), then in the·post-schema-validation infoset· it has properties as follows:
PSVI Contributionsfor attribute information items
[validation context]
The nearest ancestor element informationitem with a[schema information] property.
[validity]
The appropriatecase among the following:
1Ifit was·strictly assessed·,then the appropriatecase among the following:
1.1Ifit was·valid· as defined byAttribute Locally Valid (§3.2.4),thenvalid;
1.2otherwiseinvalid.
2otherwisenotKnown.
[validation attempted]
The appropriatecase among the following:
1Ifit was·strictly assessed·,thenfull;
2otherwisenone.
[schema specified]
infoset. SeeAttribute Default Value (§3.4.5) for the other possible value.
Schema Information Set Contribution: Validation Failure (Attribute)
If the local·validity·, as defined byAttribute Locally Valid (§3.2.4)above, of an attribute information item has been assessed,in the·post-schema-validation infoset· the item has aproperty:
PSVI Contributionsfor attribute information items
[schema error code]
The appropriatecase among the following:
1Ifthe item is not·valid·,thena list. Applications wishing to provideinformation as to the reason(s) for the·validation· failure are encouraged to record one or moreerror codes (seeOutcome Tabulations (normative) (§C)) herein.
2otherwise·absent·.
Schema Information Set Contribution: Attribute Declaration
If an attribute information item is·valid· with respect to an attributedeclaration as perAttribute Locally Valid (§3.2.4) then in the·post-schema-validation infoset· the attributeinformation item may, at processor option, have a property:
PSVI Contributionsfor attribute information items
[attribute declaration]
An·item isomorphic· to the declaration component itself.
Schema Information Set Contribution: Attribute Validated by Type
If clause3 ofAttribute Locally Valid (§3.2.4) applies withrespect to an attribute information item, in the·post-schema-validation infoset· the attributeinformation item has a property:
PSVI Contributionsfor attribute information items
Furthermore, the item has one of the following alternative sets of properties:

Either

PSVI Contributionsfor attribute information items
[type definition]
An·item isomorphic· to the relevant attribute declaration's{type definition} component.
[member type definition]
Ifand only if that type definition has{variety}union, then an·item isomorphic· to that member of its{member type definitions} which actually·validated· the attribute item's[normalized value].
or
PSVI Contributionsfor attribute information items
[type definition type]
simple.
[type definition namespace]
The{target namespace} of the·type definition·.
[type definition anonymous]
true if the{name} of the·type definition· is·absent·, otherwisefalse.
[type definition name]
The{name} of the·type definition·, if it is not·absent·. If it is·absent·, schema processors may, but need not,provide a value unique to the definition.
If the·type definition· has{variety}union, then calling[Definition:]   thatmember of the{member type definitions} which actually·validated· the attribute item's·normalized value· theactual member type definition, there are three additional properties:
PSVI Contributionsfor attribute information items
The first (·item isomorphic·) alternative above is provided for applications such as queryprocessors which need access to the full range of details about an item's·assessment·, for example the type hierarchy; the second, for lighter-weightprocessors for whom representing the significant parts of the type hierarchy asinformation items might be a significant burden.

Also, if the declaration has a{value constraint}, theitem has a property:

PSVI Contributionsfor attribute information items
If the attribute information item was not·strictly assessed·, then instead of the values specified above,
1 The item's[schema normalized value]property hasthe·initial value· of the item as its value;
2 The[type definition] and[member type definition] properties, or theiralternatives, are based on the·simple ur-type definition·.

3.2.6 Constraints on Attribute Declaration Schema Components

All attribute declarations (seeAttribute Declarations (§3.2)) must satisfy the following constraints.

Schema Component Constraint: Attribute Declaration Properties Correct
Schema Component Constraint: xmlns Not Allowed
The{name} of an attribute declaration must not matchxmlns.
Note: The{name} of an attribute is an·NCName·, which implicitlyprohibits attribute declarations of the formxmlns:*.
Schema Component Constraint: xsi: Not Allowed
The{target namespace} of an attribute declaration,whether local or top-level, must not matchhttp://www.w3.org/2001/XMLSchema-instance(unless it is one of the four built-in declarations given in the next section).
Note: This reinforces the special status of these attributes, so that they notonlyneed not be declared to be allowed in instances, butmust not be declared. It also removes any temptation to experiment with supplying global or fixed valuesfor e.g.xsi:type orxsi:nil, which would beseriously misleading, as they would have no effect.

3.2.7 Built-in Attribute Declarations

There are four attribute declarations present in everyschema by definition:

Attribute Declaration for the 'type' attribute
PropertyValue
{name}type
{target namespace}http://www.w3.org/2001/XMLSchema-instance
{type definition}The built-inQName simpletype definition
{scope}global
{value constraint}·absent·
{annotation}·absent·
Attribute Declaration for the 'nil' attribute
PropertyValue
{name}nil
{target namespace}http://www.w3.org/2001/XMLSchema-instance
{type definition}The built-inboolean simpletype definition
{scope}global
{value constraint}·absent·
{annotation}·absent·
Attribute Declaration for the 'schemaLocation' attribute
PropertyValue
{name}schemaLocation
{target namespace}http://www.w3.org/2001/XMLSchema-instance
{type definition}An anonymous simple type definition, as follows:
PropertyValue
{name}·absent·
{target namespace}http://www.w3.org/2001/XMLSchema-instance
{base type definition}The built in·simple ur-type definition·
{facets}·absent·
{variety}list
{item type definition}The built-inanyURI simpletype definition
{annotation}·absent·
{scope}global
{value constraint}·absent·
{annotation}·absent·
Attribute Declaration for the 'noNamespaceSchemaLocation' attribute
PropertyValue
{name}noNamespaceSchemaLocation
{target namespace}http://www.w3.org/2001/XMLSchema-instance
{type definition}The built-inanyURI simpletype definition
{scope}global
{value constraint}·absent·
{annotation}·absent·

previous sub-sectionnext sub-section3.3 Element Declarations

        3.3.1The Element Declaration Schema Component
        3.3.2XML Representation of Element Declaration Schema Components
        3.3.3Constraints on XML Representations of Element Declarations
        3.3.4Element Declaration Validation Rules
        3.3.5Element Declaration Information Set Contributions
        3.3.6Constraints on Element Declaration Schema Components

Element declarations provide for:

  • Local·validation· of element information item values using a type definition;
  • Specifying default or fixed values for an element information items;
  • Establishing uniquenesses and reference constraint relationships among the values of related elements andattributes;
  • Controlling the substitutability of elements through themechanism of·element substitution groups·.
Example
<xs:element name="PurchaseOrder" type="PurchaseOrderType"/><xs:element name="gift"> <xs:complexType>  <xs:sequence>   <xs:element name="birthday" type="xs:date"/>   <xs:element ref="PurchaseOrder"/>  </xs:sequence> </xs:complexType></xs:element>
XML representations of several different types of element declaration

3.3.1 The Element Declaration Schema Component

The element declaration schema component has the followingproperties:

{name}
An NCName as defined by[XML-Namespaces].
{target namespace}
Either·absent· ora namespace name, as defined in[XML-Namespaces].
{type definition}
Either a simple typedefinition or a complex type definition.
{scope}
Optional. Eitherglobal or a complex typedefinition.
{value constraint}
Optional. Apair consisting of a value and one ofdefault,fixed.
{nillable}
A boolean.
{identity-constraint definitions}
A setof constraint definitions.
{substitution group affiliation}
Optional. A top-levelelement definition.
{substitution group exclusions}
A subset of{extension,restriction}.
{disallowed substitutions}
A subset of {substitution,extension,restriction}.
{abstract}
A boolean.
{annotation}
Optional. An annotation.

The{name} property must match the local part of the namesof element information items being·validated·.

A{scope} ofglobal identifies element declarations available for use in contentmodels throughout the schema. Locally scoped declarations are available for use only within thecomplex type identified by the{scope} property. This property is·absent· in the case of declarations within named model groups: their scope is determined when they are used in the construction of complex type definitions.

A non-·absent· value of the{target namespace} property provides for·validation· ofnamespace-qualified element information items.·Absent· values of{target namespace}·validate· unqualified items.

An element information item is·valid·if it satisfies the{type definition}. For such anitem, schema information set contributions appropriate to the{type definition} are added to thecorresponding element information item in the·post-schema-validation infoset·.

If{nillable} istrue, then an element mayalso be·valid· if itcarries the namespace qualified attribute with[local name]nil from namespacehttp://www.w3.org/2001/XMLSchema-instance and valuetrue (seexsi:nil (§2.6.2)) even if it hasno text or element content despite a{content type} which wouldotherwise require content. Formal details of element·validation· are described inElement Locally Valid (Element) (§3.3.4).

{value constraint} establishes a default or fixed value for an element. Ifdefault is specified, and if the elementbeing·validated· is empty, then thecanonical form of the suppliedconstraint value becomes the[schema normalized value] of the·validated· element in the·post-schema-validation infoset·. Iffixed is specified, then the element's contentmust either be empty, in which casefixed behaves asdefault,or its value must match the supplied constraint value.

Note: The provision of defaults for elements goes beyond what is possible inXML 1.0 DTDs, and does not exactly correspond to defaults for attributes. Inparticular, an element with a non-empty{value constraint} whose simpletype definition includes the empty string in its lexical space willnonetheless never receive that value, because the{value constraint} will override it.

{identity-constraint definitions} express constraints establishing uniquenesses and reference relationships among the values of related elements andattributes. SeeIdentity-constraint Definitions (§3.11).

Element declarations are potential members of the substitution group, if any, identifiedby{substitution group affiliation}. Potential membership is transitive but not symmetric; an elementdeclaration is a potential member of any group of which its{substitution group affiliation} is a potential member. Actual membership may be blocked by the effects of{substitution group exclusions} or{disallowed substitutions}, see below.

An empty{substitution group exclusions} allows a declaration to be nominated asthe{substitution group affiliation} of other element declarations having the same{type definition} ortypes derived therefrom. The explicitvalues of{substitution group exclusions} rule out element declarations having types whichareextensions orrestrictions respectively of{type definition}. Ifboth values are specified, then the declaration may not be nominated as the{substitution group affiliation} of any other declaration.

The supplied values for{disallowed substitutions} determinewhether an element declaration appearing in a·content model· will be prevented from additionally·validating· elements (a) with anxsi:type (§2.6.1) that identifies anextension orrestriction of the type of the declared element, and/or (b) from·validating· elements which are in thesubstitution group headed by the declared element.If{disallowed substitutions} is empty, then all derived types and substitution group members are allowed.

Element declarations for which{abstract} istrue can appear incontent models only when substitution is allowed;such declarations may not themselves ever be used to·validate· element content.

SeeAnnotations (§3.13) for information on the role of the{annotation} property.

3.3.2 XML Representation of Element Declaration Schema Components

The XML representation for an element declaration schema component is an<element> element information item. It specifies a typedefinition for an element either by reference or explicitly, and may provideoccurrence and default information. The correspondences between theproperties of the information item andproperties of the component(s) it corresponds to are as follows:

XML Representation Summaryelement Element Information Item

<element
  abstract =boolean : false
  block = (#all | List of (extension |restriction |substitution))
  default =string
  final = (#all | List of (extension |restriction))
  fixed =string
  form = (qualified |unqualified)
  id =ID
  maxOccurs = (nonNegativeInteger |unbounded)  : 1
  minOccurs =nonNegativeInteger : 1
  name =NCName
  nillable =boolean : false
  ref =QName
  substitutionGroup =QName
  type =QName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, ((simpleType |complexType)?, (unique |key |keyref)*))
</element>

If the<element> element information item has<schema> as its parent, the corresponding schema component is as follows:
Element Declaration Schema Component
PropertyRepresentation
{name}The·actual value· of thename[attribute].
{target namespace}The·actual value· of thetargetNamespace[attribute] of the parent<schema>element information item, or·absent· if there is none.
{scope}global.
{type definition}The type definitioncorresponding to the<simpleType> or<complexType> element information item in the[children], if either is present, otherwise the type definition·resolved· to bythe·actual value· of thetype[attribute], otherwise the{type definition} of the element declaration·resolved· to by the·actual value· of thesubstitutionGroup[attribute], if present, otherwise the·ur-type definition·.
{nillable}The·actual value· of thenillable[attribute], if present, otherwisefalse.
{value constraint}If there is adefault or afixed[attribute], then a pair consisting of the·actual value· (with respect to the{type definition}, if it is a simple type definition, or the{type definition}'s{content type}, if that is asimple type definition, or else with respect to the built-instring simple type definition) of that[attribute] andeitherdefault orfixed, as appropriate, otherwise·absent·.
{identity-constraint definitions}A set consisting of theidentity-constraint-definitions corresponding to all the<key>,<unique> and<keyref> element information items in the[children], if any, otherwise the empty set.
{substitution group affiliation}The element declaration·resolved· to by the·actual value· of thesubstitutionGroup[attribute], if present, otherwise·absent·.
{disallowed substitutions}A set depending on the·actual value· of theblock[attribute], if present, otherwise on the·actual value· of theblockDefault[attribute] of the ancestor<schema> elementinformation item, if present, otherwise on the empty string. Call this theEBV (for effective block value). Then the value of this property is the appropriatecase among the following:
1IftheEBV is the empty string,thenthe empty set;
2IftheEBV is#all,then{extension,restriction,substitution};
3otherwisea set with members drawn from the set above, each being present orabsent depending on whether the·actual value· (which is a list) contains anequivalently named item.
Note: Although theblockDefault[attribute] of<schema> may include values other thanextension,restriction orsubstitution, those values are ignored in the determination of{disallowed substitutions} for element declarations (theyare used elsewhere).
{substitution group exclusions}As for{disallowed substitutions} above, but using thefinal andfinalDefault[attributes] in place of theblock andblockDefault[attributes] and with therelevant set being{extension,restriction}.
{abstract}The·actual value· of theabstract[attribute], if present, otherwisefalse.
{annotation}The annotation corresponding to the<annotation> element information item in the[children], if present, otherwise·absent·.
otherwise if the<element> element information item has<complexType> or<group> as an ancestor and theref[attribute] is absent, the corresponding schema componentsare as follows (unlessminOccurs=maxOccurs=0, in which case the itemcorresponds to no component at all):
Particle Schema Component
PropertyRepresentation
{min occurs}The·actual value· of theminOccurs[attribute], if present, otherwise1.
{max occurs}unbounded, if themaxOccurs[attribute] equalsunbounded, otherwise the·actual value· of themaxOccurs[attribute], if present, otherwise1.
{term}A (local) element declaration as given below.
An element declaration as in the first case above, with the exception of its{target namespace} and{scope} properties, which are as below:
Element Declaration Schema Component
PropertyRepresentation
{target namespace}Ifform is present and its·actual value· isqualified, or ifform is absent and the·actual value· ofelementFormDefault on the<schema>ancestor isqualified, then the·actual value· of thetargetNamespace[attribute] of the parent<schema>element information item, or·absent· if thereis none, otherwise·absent·.
{scope}If the<element> element information itemhas<complexType> as an ancestor, the complex definitioncorresponding to that item, otherwise (the<element> elementinformation item is within a named<group> definition),·absent·.
otherwise (the<element> element information item has<complexType> or<group> as an ancestor and theref[attribute] is present), the corresponding schema component is asfollows (unlessminOccurs=maxOccurs=0, in which case the itemcorresponds to no component at all):
Particle Schema Component
PropertyRepresentation
{min occurs}The·actual value· of theminOccurs[attribute], if present, otherwise1.
{max occurs}unbounded, if themaxOccurs[attribute] equalsunbounded, otherwise the·actual value· of themaxOccurs[attribute], if present, otherwise1.
{term}The (top-level) element declaration·resolved· to by the·actual value· of theref[attribute].

<element> corresponds to an element declaration, and allowsthe type definition of that declaration to be specified either by reference orby explicit inclusion.

<element>s within<schema> produceglobal element declarations;<element>s within<group> or<complexType> produce either particles which containglobal element declarations (if there's aref attribute) or local declarations (otherwise). For complete declarations, top-level or local, thetype attribute is used when the declaration can use abuilt-in or pre-declared type definition. Otherwise ananonymous<simpleType> or<complexType> is provided inline.

Element information items·validated· by a top-level declaration must be qualified with the{target namespace} of that declaration (if this is·absent·, the item must be unqualified). Control over whether element information items·validated· by a local declaration must be similarly qualified or notis provided by theform[attribute], whose default is providedby theelementFormDefault[attribute] on the enclosing<schema>, via its determination of{target namespace}.

As noted above the names for top-level element declarations are in a separate·symbol space· from the symbol spaces forthe names of type definitions, so there can (but neednot be) a simple or complex type definition with the same name as atop-level element. As with attribute names, the names of locally-scopedelement declarations with no{target namespace} reside in symbol spaces local to the type definition which containsthem.

Note that the above allows for two levels of defaulting for unspecifiedtype definitions. An<element> with no referenced or included type definition willcorrespond to an element declaration which has the same type definition as thehead of its substitution group if it identifies one, otherwise the·ur-type definition·. This has the important consequence that the minimum valid element declaration, that is, one with only aname 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.

See below atXML Representation of Identity-constraint Definition Schema Components (§3.11.2) for<key>,<unique> and<keyref>.

Example
<xs:element name="unconstrained"/><xs:element name="emptyElt"> <xs:complexType>  <xs:attribute ...>. . .</xs:attribute> </xs:complexType></xs:element><xs:element name="contextOne"> <xs:complexType>  <xs:sequence>   <xs:element name="myLocalElement" type="myFirstType"/>   <xs:element ref="globalElement"/>  </xs:sequence> </xs:complexType></xs:element><xs:element name="contextTwo"> <xs:complexType>  <xs:sequence>   <xs:element name="myLocalElement" type="mySecondType"/>   <xs:element ref="globalElement"/>  </xs:sequence> </xs:complexType></xs:element>
The first example above declares an element whose type, by default, is the·ur-type definition·. The second uses an embedded anonymous complextype definition.

The last two examples illustrate the use of local element declarations. Instances ofmyLocalElement withincontextOne will be constrained bymyFirstType,while those withincontextTwo will be constrained bymySecondType.

Note: The possibility that differing attribute declarations and/or content modelswould apply to elements with the same name in different contexts is anextension beyond the expressive power of a DTD in XML 1.0.
Example
 <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>
An example from a previous version of the schema for datatypes. Thefacet type is definedand thefacet element is declared to use it. Thefacet element is abstract -- it'sonly defined to stand as the head for a substitution group. Two furtherelements are declared, each a member of thefacet substitution group. Finally a type is defined which refers tofacet, therebyallowingeitherperiod orencoding (orany other member of the group).

3.3.3 Constraints on XML Representations of Element Declarations

Schema Representation Constraint: Element Declaration Representation OK
In addition to the conditions imposed on<element> elementinformation items by the schema for schemas:all of the following must be true:
1default andfixed must not both be present.
2 If the item's parent is not<schema>, thenall of the following must be true:
2.1 One ofref orname must be present, but not both.
2.2 Ifref is present, then all of<complexType>,<simpleType>,<key>,<keyref>,<unique>,nillable,default,fixed,form,block andtype must be absent,i.e. onlyminOccurs,maxOccurs,id areallowed in addition toref, along with<annotation>.
3type and either<simpleType> or<complexType> are mutually exclusive.
4 The corresponding particle and/or element declarations must satisfy the conditions setout inConstraints on Element Declaration Schema Components (§3.3.6) andConstraints on Particle Schema Components (§3.9.6).

3.3.4 Element Declaration Validation Rules

Validation Rule: Element Locally Valid (Element)
For an element information item to be locally·valid· with respect to anelement declarationall of the following must be true:
1The declaration must not be·absent·.
2 Its{abstract} must befalse.
3 The appropriatecase among the followingmust be true:
3.1If{nillable} isfalse,thenthere must be no attribute information item among the elementinformation item's[attributes] whose[namespace name] is identical tohttp://www.w3.org/2001/XMLSchema-instance and whose[local name] isnil.
3.2If{nillable} istrue and there is such an attributeinformation item and its·actual value· istrue ,thenall of the following must be true:
3.2.1 The element information item must have no character or element information item[children].
3.2.2 There must be nofixed{value constraint}.
4 If there is an attribute information item among the elementinformation item's[attributes] whose[namespace name] is identical tohttp://www.w3.org/2001/XMLSchema-instance and whose[local name] istype, thenall of the following must be true:
4.1 The·normalized value· of that attribute information item must be·valid· with respect to the built-inQName simple type, as defined byString Valid (§3.14.4);
4.2 The·local name· and·namespace name· (as defined inQName Interpretation (§3.15.3)), of the·actual value· of that attribute information item must resolve to a type definition, as defined inQName resolution (Instance) (§3.15.4) --[Definition:]  call this type definition thelocal type definition;
4.3 The·local type definition· must bevalidly derived from the{type definition} given theunion of the{disallowed substitutions} and the{type definition}'s{prohibited substitutions}, as defined inType Derivation OK (Complex) (§3.4.6) (if it is a complex type definition), or given{disallowed substitutions} as defined inType Derivation OK (Simple) (§3.14.6) (if it is a simple type definition).
[Definition:]  The phraseactual type definition occurs below. If the above three clauses are satisfied, thisshould be understood as referring to the·local typedefinition·, otherwise to the{type definition}.
5 The appropriatecase among the followingmust be true:
5.1Ifthe declaration has a{value constraint}, the item has neither element nor character[children] and clause3.2 has not applied,thenall of the following must be true:
5.2Ifthe declaration has no{value constraint} or the item has either element or character[children] or clause3.2 has applied,thenall of the following must be true:
5.2.1 The element information itemmust be·valid· with respect to the·actual type definition· as defined byElement Locally Valid (Type) (§3.3.4).
5.2.2 If there is afixed{value constraint} andclause3.2 has not applied,all of the following must be true:
5.2.2.1 The element information item must have no element informationitem[children].
5.2.2.2 The appropriatecase among the followingmust be true:
5.2.2.2.1Ifthe{content type} of the·actual type definition· ismixed,thenthe·initial value·of the item must match thecanonical lexical representation of the{value constraint} value.
5.2.2.2.2Ifthe{content type} of the·actual type definition· is a simple type definition,thenthe·actual value· of the item must match thecanonical lexical representation of the{value constraint} value.
6 The element information item must be·valid· with respect toeach of the{identity-constraint definitions} as perIdentity-constraint Satisfied (§3.11.4).
7 If the element information item is the·validation root·, it must be·valid· perValidation Root Valid (ID/IDREF) (§3.3.4).
Validation Rule: Element Locally Valid (Type)
For an element information item to be locally·valid· with respect to a type definitionall of the following must be true:
1The type definition must not be·absent·;
2 It must not have{abstract} with valuetrue.
3 The appropriatecase among the followingmust be true:
3.1Ifthe type definition is a simple typedefinition,thenall of the following must be true:
3.1.1 The element information item's[attributes] must be empty,excepting those whose[namespace name] is identical tohttp://www.w3.org/2001/XMLSchema-instance and whose[local name] is one oftype,nil,schemaLocation ornoNamespaceSchemaLocation.
3.1.2 The element information item must have no element information item[children].
3.1.3If clause3.2 ofElement Locally Valid (Element) (§3.3.4) did not apply, then the·normalized value· must be·valid· with respect to the type definition as defined byString Valid (§3.14.4).
3.2Ifthe type definition is a complex type definition,thenthe element information item must be·valid· with respect to the type definition as perElement Locally Valid (Complex Type) (§3.4.4);
Validation Rule: Validation Root Valid (ID/IDREF)
For an element information item which is the·validation root· to be·valid·all of the following must be true:
1 There must be noID/IDREF binding in the item's[ID/IDREF table] whose[binding] is theempty set.
2There must be noID/IDREF binding in the item's[ID/IDREF table] whose[binding] has morethan one member.

SeeID/IDREF Table (§3.15.5) for the definition ofID/IDREF binding.

Note: The first clause above applies when there is a reference to anundefined ID. The second applies when there is a multiply-defined ID. Theyare separated out to ensure that distinct error codes (seeOutcome Tabulations (normative) (§C)) are associated with these two cases.
Note: Although this rule applies at the·validationroot·, in practice processors, particularly streaming processors, maywish to detect and signal the clause2 case as it arises.
Note: This reconstruction of[XML 1.0 (Second Edition)]'sID/IDREFfunctionality is imperfect in that if the·validationroot· is not the document element of an XML document, the results willnot necessarily be the same as those a validating parser would give were thedocument to have a DTD with equivalent declarations.
Validation Rule: Schema-Validity Assessment (Element)
The schema-validity assessment of an element information item dependson its·validation· and the·assessment· of its element information itemchildren and associated attribute information items, if any.

So for an element information item's schema-validity to be assessedall of the following must be true:

1One of the following must be true:
1.1All of the following must be true:
1.1.1 A non-·absent· element declarationmust be known for it, becauseone of the following is true
1.1.1.1 A declaration was stipulated by the processor (seeAssessing Schema-Validity (§5.2)).
1.1.1.2 A declaration has been established as its·context-determined declaration·.
1.1.1.3All of the following must be true:
1.1.1.3.1 Its·context-determined declaration· isnotskip.
1.1.1.3.2 Its[local name] and[namespace name] resolve to an element declaration as defined byQName resolution (Instance) (§3.15.4).
1.1.2 Its·validity· with respect to thatdeclaration must have been evaluated as perElement Locally Valid (Element) (§3.3.4).
1.1.3 If that evaluation involved the evaluation ofElement Locally Valid (Type) (§3.3.4), clause1 thereof must be satisfied.
1.2All of the following must be true:
1.2.1 A non-·absent· type definition is known forit becauseone of the following is true
1.2.1.1 A type definition was stipulated by the processor(seeAssessing Schema-Validity (§5.2)).
1.2.1.2All of the following must be true:
1.2.1.2.1 There is an attribute information item among the elementinformation item's[attributes] whose[namespace name] is identical tohttp://www.w3.org/2001/XMLSchema-instance and whose[local name] istype.
1.2.1.2.2 The·normalized value· of that attribute information item is·valid· with respect to the built-inQName simple type, as defined byString Valid (§3.14.4).
1.2.1.2.3 The·local name· and·namespace name· (as defined inQName Interpretation (§3.15.3)), of the·actual value· of that attribute information item resolve to a type definition, as defined inQName resolution (Instance) (§3.15.4) --[Definition:]  call this type definition thelocal type definition.
1.2.1.2.4 If there is also a processor-stipulated type definition, the·local type definition· must bevalidly derived from that type definition given its{prohibited substitutions},as defined inType Derivation OK (Complex) (§3.4.6) (if it is a complex typedefinition), or given the empty set, as defined inType Derivation OK (Simple) (§3.14.6) (if it is a simple type definition).
1.2.2 The element information item's·validity· with respect to the·local type definition· (if present and validly derived)or the processor-stipulated type definition (if no·localtype definition· is present) has been evaluated as perElement Locally Valid (Type) (§3.3.4).
2 The schema-validity of all the element information items among its[children] has been assessed as perSchema-Validity Assessment (Element) (§3.3.4), and theschema-validity of all the attribute information items among its[attributes] has been assessed as perSchema-Validity Assessment (Attribute) (§3.2.4).

[Definition:]  If either case ofclause1 above holds, the element information item has beenstrictly assessed.

If the item cannot be·strictlyassessed·, because neither clause1.1 nor clause1.2 above are satisfied,[Definition:]  an element information item'sschema validity may belaxly assessed if its·context-determined declaration· is notskip by·validating· with respect to the·ur-type definition· as perElement Locally Valid (Type) (§3.3.4).

Note: In general if clause1.1 above holds clause1.2 does not, and vice versa. When anxsi:type[attribute] is involved, however, clause1.2 takes precedence,as is made clear inElement Locally Valid (Element) (§3.3.4).
Note: The{name} and{target namespace} properties are notmentioned above because they are checked during particle·validation·, as perElement Sequence Locally Valid (Particle) (§3.9.4).

3.3.5 Element Declaration Information Set Contributions

Schema Information Set Contribution: Assessment Outcome (Element)
If the schema-validity of an element information item has been assessedas perSchema-Validity Assessment (Element) (§3.3.4), then in the·post-schema-validation infoset· it has properties as follows:
PSVI Contributionsfor element information items
[validation context]
The nearest ancestor element informationitem with a[schema information] property (or this element item itself if it has such a property).
[validity]
The appropriatecase among the following:
1Ifit was·strictlyassessed·,then the appropriatecase among the following:
1.1Ifall of the following are true
1.1.2 Neither its[children] nor its[attributes] contains an information item (element or attribute respectively) whose[validity] isinvalid.
1.1.3 Neither its[children] nor its[attributes] contains an information item (element or attribute respectively) with a·context-determined declaration· ofmustFind whose[validity]isnotKnown.
,thenvalid;
1.2otherwiseinvalid..
2otherwisenotKnown.
[validation attempted]
The appropriatecase among the following:
1Ifit was·strictly assessed· and neither its[children] nor its[attributes] contains an information item (element or attributerespectively) whose[validation attempted] is notfull,thenfull;
2Ifit was not·strictly assessed· and neither its[children] nor its[attributes] contains an information item (element or attributerespectively) whose[validation attempted] is notnone,thennone;
3otherwisepartial.
Schema Information Set Contribution: Validation Failure (Element)
If the local·validity·, as defined byElement Locally Valid (Element) (§3.3.4) above and/orElement Locally Valid (Type) (§3.3.4)below, of an element information item has been assessed,in the·post-schema-validation infoset· the item has aproperty:
PSVI Contributionsfor element information items
[schema error code]
The appropriatecase among the following:
1Ifthe item is not·valid·,thena list. Applications wishing to provideinformation as to the reason(s) for the·validation· failure are encouraged to record one or moreerror codes (seeOutcome Tabulations (normative) (§C)) herein.
2otherwise·absent·.
Schema Information Set Contribution: Element Declaration
If an element information item is·valid· with respect to an elementdeclaration as perElement Locally Valid (Element) (§3.3.4) then in the·post-schema-validation infoset·the elementinformation item must, at processor option, have either:
PSVI Contributionsfor element information items
[element declaration]
an·item isomorphic· to the declaration component itself
or
PSVI Contributionsfor element information items
[nil]
true if clause3.2 ofElement Locally Valid (Element) (§3.3.4) above is satisfied,otherwisefalse
Schema Information Set Contribution: Element Validated by Type
If an element information item is·valid· with respect to a·type definition·as perElement Locally Valid (Type) (§3.3.4), in the·post-schema-validation infoset· the item has a property:
PSVI Contributionsfor element information items
[schema normalized value]
The appropriatecase among the following:
1Ifclause3.2 ofElement Locally Valid (Element) (§3.3.4) andElement Default Value (§3.3.5) above havenot applied and either the·type definition· is a simple type definition or its{content type} is a simple type definition,thenthe·normalized value· of the item as·validated·.
2otherwise·absent·.
Furthermore, the item has one of the following alternative sets of properties:

Either

PSVI Contributionsfor element information items
[type definition]
An·item isomorphic· to the·type definition· component itself.
[member type definition]
Ifand only if that type definition is asimple type definition with{variety}union, ora complex type definition whose{content type} is asimple typedefinition with{variety}union, then an·item isomorphic· to that member of theunion's{member type definitions} which actually·validated· the element item's·normalized value·.
or
PSVI Contributionsfor element information items
[type definition type]
simple orcomplex, depending on the·type definition·.
[type definition namespace]
The{target namespace} of the·type definition·.
[type definition anonymous]
true if the{name} of the·type definition· is·absent·, otherwisefalse.
[type definition name]
The{name} of the·type definition·, if it is not·absent·. If it is·absent·, schema processors may, but need not,provide a value unique to the definition.
If the·type definition· is asimple type definition or its{content type} is asimple type definition, and that typedefinition has{variety}union, then calling[Definition:]   thatmember of the{member type definitions} which actually·validated· the element item's·normalized value· theactual member type definition, there are three additional properties:
PSVI Contributionsfor element information items
The first (·item isomorphic·) alternative above is provided for applications such as queryprocessors which need access to the full range of details about an item's·assessment·, for example the type hierarchy; the second, for lighter-weightprocessors for whom representing the significant parts of the type hierarchy asinformation items might be a significant burden.

Also, if the declaration has a{value constraint}, the item has a property:

PSVI Contributionsfor element information items
Note that if an element is·laxly assessed·, then the[type definition] and[member type definition] properties, or theiralternatives, are based on the·ur-type definition·.
Schema Information Set Contribution: Element Default Value
If the local·validity·, as defined byElement Locally Valid (Element) (§3.3.4)above, of an element information item has been assessed,in the·post-schema-validation infoset· the item has aproperty:
PSVI Contributionsfor element information items
[schema specified]
The appropriatecase among the following:
1Ifthe item is·valid· with respect to an elementdeclaration as perElement Locally Valid (Element) (§3.3.4) and the{value constraint} is present, but clause3.2ofElement Locally Valid (Element) (§3.3.4) above is not satisfied and the item has no element or character information item[children],thenschema. Furthermore, the·post-schema-validation infoset· has thecanonical lexical representation of the{value constraint} value as theitem's[schema normalized value]property.
2otherwiseinfoset.

3.3.6 Constraints on Element Declaration Schema Components

All element declarations (seeElement Declarations (§3.3)) must satisfy the following constraint.

Schema Component Constraint: Element Declaration Properties Correct
All of the following must be true:
3 If there is a non-·absent·{substitution group affiliation}, then{scope} must beglobal.
4 If there is a{substitution group affiliation}, the{type definition} of the element declaration mustbe validly derived from the{type definition} of the{substitution group affiliation}, given the value of the{substitution group exclusions} of the{substitution group affiliation}, as defined inType Derivation OK (Complex) (§3.4.6) (if the{type definition} is complex) or as defined inType Derivation OK (Simple) (§3.14.6) (if the{type definition} is simple).
5 If the{type definition} or{type definition}'s{content type} is or is derived fromID then there must not be a{value constraint}.
Note: The use ofID as a typedefinition for elements goes beyond XML 1.0, and should be avoided if backwardscompatibility is desired.
6 Circular substitution groups are disallowed. That is, itmust not be possible to return to an element declaration by repeatedly followingthe{substitution group affiliation} property.

The following constraints define relations appealed to elsewhere in this specification.

Schema Component Constraint: Element Default Valid (Immediate)
For a string to be a valid default with respect to a type definition the appropriatecase among the followingmust be true:
2Ifthe type definition is a complex type definition,thenall of the following must be true:
2.1 its{content type} must be a simple type definitionormixed.
2.2 The appropriatecase among the followingmust be true:
2.2.1Ifthe{content type} is a simple type definition,thenthe string must be·valid· with respect to that simple type definition as defined byString Valid (§3.14.4).
2.2.2Ifthe{content type} ismixed,thenthe{content type}'s particle must be·emptiable· as defined byParticle Emptiable (§3.9.6).
Schema Component Constraint: Substitution Group OK (Transitive)
For an element declaration (call itD) to be validlysubstitutable for another element declaration (call itC)subject to a blocking constraint (a subset of{substitution,extension,restriction}, the value ofa{disallowed substitutions})one of the following must be true:
1D andC are the same element declaration.
2All of the following must be true:
2.1 The blocking constraint does not containsubstitution.
2.3 The set of all{derivation method}sinvolved in the derivation ofD's{type definition} fromC's{type definition} does not intersect with the unionof the blocking constraint,C's{prohibited substitutions} (ifCis complex, otherwise the empty set) and the{prohibited substitutions} (respectively the empty set) of any intermediate{type definition}sin the derivation ofD's{type definition} fromC's{type definition}.
Schema Component Constraint: Substitution Group
[Definition:]  Every elementdeclaration (call thisHEAD)in the{element declarations} of a schema defines asubstitution group, a subset of those{element declarations}, as follows:

DefineP, the potential substitution group forHEAD, as follows:

1 The element declaration itself is inP;
2P is closed with respect to{substitution group affiliation}, thatis, if any element declaration in the{element declarations} has a{substitution group affiliation} inP, then that element is also inP itself.
HEAD's actual·substitutiongroup· is then the set consisting of each member ofPsuch thatall of the following must be true:
1 Its{abstract} isfalse.
2 It is validly substitutable forHEAD subject toHEAD's{disallowed substitutions} as theblocking constraint, as defined inSubstitution Group OK (Transitive) (§3.3.6).

previous sub-sectionnext sub-section3.4 Complex Type Definitions

        3.4.1The Complex Type Definition Schema Component
        3.4.2XML Representation of Complex Type Definitions
        3.4.3Constraints on XML Representations of Complex Type Definitions
        3.4.4Complex Type Definition Validation Rules
        3.4.5Complex Type Definition Information Set Contributions
        3.4.6Constraints on Complex Type Definition Schema Components
        3.4.7Built-in Complex Type Definition

Complex Type Definitions provide for:

  • Constraining element information items by providingAttribute Declaration (§2.2.2.3)s governing the appearance and content of[attributes]
  • Constraining element information item[children] to be empty,or to conform to a specified element-only or mixed content model, or elseconstraining the character information item[children] to conform to aspecified simple type definition.
  • Using the mechanisms ofType Definition Hierarchy (§2.2.1.1) to derive a complex type from another simple or complex type.
  • Specifying·post-schema-validation infoset contributions· for elements.
  • Limiting the ability to derive additional types from a given complex type.
  • Controlling the permission to substitute, in an instance, elements of a derivedtype for elements declared in a content model to be of a given complex type.
Example
<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>
The XML representation of a complex type definition.

3.4.1 The Complex Type Definition Schema Component

A complex type definition schema component has the followingproperties:

{name}
Optional. An NCName as defined by[XML-Namespaces].
{target namespace}
Either·absent· or a namespace name, as defined in[XML-Namespaces].
{base type definition}
Either a simple type definition or a complex type definition.
{derivation method}
Eitherextension orrestriction.
{final}
A subset of {extension,restriction}.
{abstract}
A boolean
{attribute uses}
A set of attribute uses.
{attribute wildcard}
Optional. A wildcard.
{content type}
One ofempty, a simple type definition or a pairconsisting of a·content model· (I.e. aParticle (§2.2.3.2)) and one ofmixed,element-only.
{prohibited substitutions}
A subset of {extension,restriction}.
{annotations}
A set of annotations.

Complex types definitions are identified by their{name} and{target namespace}. Exceptfor anonymous complex type definitions (those with no{name}), sincetype definitions (i.e. both simple and complex type definitions taken together) must be uniquely identified within an·XMLSchema·, no complex type definition can have the same name as anothersimple or complex type definition. Complex type{name}s and{target namespace}sare provided for reference frominstances (seexsi:type (§2.6.1)), and for use in the XMLrepresentation of schema components(specifically in<element>). SeeReferences to schema components across namespaces (§4.2.3) for the use of componentidentifiers when importing one schema into another.

Note: The{name} of a complex type is notipsofacto the[(local) name] of the element information items·validated· by that definition. The connection between a name and a type definition is described inElement Declarations (§3.3).

As described inType Definition Hierarchy (§2.2.1.1), each complex type is derived from a{base type definition} which is itself either aSimple Type Definition (§2.2.1.2) or aComplex Type Definition (§2.2.1.3).{derivation method} specifies the means of derivation as eitherextension orrestriction (seeType Definition Hierarchy (§2.2.1.1)).

A complex type with an empty specification for{final} can be used as a{base type definition} for other types derived by either ofextension or restriction; the explicit valuesextension, andrestriction prevent furtherderivations by extension and restriction respectively. If all values are specified, then[Definition:]  the complex type is said to befinal, because nofurther derivations are possible. Finality isnotinherited, that is, a type definition derived by restriction from a typedefinition which is final for extension is not itself, in the absence of anyexplicitfinal attribute of its own, final for anything.

Complex types for which{abstract} istrue mustnot be used as the{type definition} for the·validation· of element information items. It follows that they must not be referenced from anxsi:type (§2.6.1) attribute in an instance document. Abstract complex types can beused as{base type definition}s, or even as the{type definition}s of element declarations, provided in every case a concrete derived type definition is used for·validation·, either viaxsi:type (§2.6.1) or the operation of a substitution group.

{attribute uses} are a set of attribute uses. SeeElement Locally Valid (Complex Type) (§3.4.4)andAttribute Locally Valid (§3.2.4) for details of attribute·validation·.

{attribute wildcard}s provide a more flexible specification for·validation· ofattributes not explicitly included in{attribute uses}.Informally, the specific valuesof{attribute wildcard} are interpreted as follows:

  • any:[attributes] can include attributes with any qualified or unqualified name.
  • a set whosemembers are either namespace names or·absent·:[attributes] caninclude any attribute(s) from the specified namespace(s). If·absent· is included in the set, then any unqualified attributes are (also) allowed.
  • 'not' and a namespace name:[attributes] cannot include attributes from the specified namespace.
  • 'not' and·absent·:[attributes] cannot includeunqualified attributes.

SeeElement Locally Valid (Complex Type) (§3.4.4) andWildcard allows Namespace Name (§3.10.4) for formaldetails of attribute wildcard·validation·.

{content type} determines the·validation· of[children] of element information items. Informally:

{prohibited substitutions} determinewhether an element declaration appearing in a·content model· is prevented from additionally·validating· element items with anxsi:type (§2.6.1) attribute thatidentifies a complex type definition derived byextension orrestriction from this definition, or element items ina substitution group whose type definition is similarly derived:If{prohibited substitutions} is empty,then all such substitutions are allowed, otherwise, the derivation method(s) itnames are disallowed.

SeeAnnotations (§3.13) for information on the role of the{annotations} property.

3.4.2 XML Representation of Complex Type Definitions

The XML representation for a complex type definition schema component is a<complexType> element information item.

The XML representation for complex type definitions witha simple type definition{content type} is significantly differentfrom that of those with other{content type}s, and thisis reflected in the presentation below, which displays first the elementsinvolved in the first case, then those for the second. The property mapping is shown once for each case.

XML Representation SummarycomplexType Element Information Item

<complexType
  abstract =boolean : false
  block = (#all | List of (extension |restriction))
  final = (#all | List of (extension |restriction))
  id =ID
  mixed =boolean : false
  name =NCName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (simpleContent |complexContent | ((group |all |choice |sequence)?, ((attribute |attributeGroup)*,anyAttribute?))))
</complexType>

Whichever alternative for the content of<complexType> ischosen, the following property mappings apply:
Complex Type Definition Schema Component
PropertyRepresentation
{name}The·actual value· of thename[attribute] if present, otherwise·absent·.
{target namespace}The·actual value· of thetargetNamespace[attribute] of the<schema> ancestorelement information item if present, otherwise·absent·.
{abstract}The·actual value· of theabstract[attribute], if present, otherwisefalse.
{prohibited substitutions}A set corresponding to the·actual value· of theblock[attribute], if present, otherwise on the·actual value· of theblockDefault[attribute] of the ancestor<schema> elementinformation item, if present, otherwise on the empty string. Call this theEBV (for effective block value). Then the value of this property is the appropriatecase among the following:
1IftheEBV is the empty string,thenthe empty set;
2IftheEBV is#all,then{extension,restriction};
3otherwisea set with members drawn from the set above, each being present orabsent depending on whether the·actual value· (which is a list) contains anequivalently named item.
Note: Although theblockDefault[attribute] of<schema> may include values other thanrestriction orextension, those values are ignored in the determination of{prohibited substitutions} for complex type definitions (theyare used elsewhere).
{final}As for{prohibited substitutions} above, but using thefinal andfinalDefault[attributes] in place of theblock andblockDefault[attributes].
{annotations}The annotations corresponding to the<annotation> element information item in the[children], if present, in the<simpleContent> and<complexContent>[children], if present, and in their<restriction> and<extension>[children], if present, otherwise·absent·.
When the<simpleContent> alternative is chosen, the followingelements are relevant, and the remaining property mappings are as below. Note that either<restriction> or<extension> must be chosen as thecontent of<simpleContent>.

<simpleContent
  id =ID
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (restriction |extension))
</simpleContent>

<restriction
  base =QName
  id =ID
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (simpleType?, (minExclusive |minInclusive |maxExclusive |maxInclusive |totalDigits |fractionDigits |length |minLength |maxLength |enumeration |whiteSpace |pattern)*)?, ((attribute |attributeGroup)*,anyAttribute?))
</restriction>

<extension
  base =QName
  id =ID
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, ((attribute |attributeGroup)*,anyAttribute?))
</extension>

<attributeGroup
  id =ID
  ref =QName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?)
</attributeGroup>

<anyAttribute
  id =ID
  namespace = ((##any |##other) | List of (anyURI | (##targetNamespace |##local)) )  : ##any
  processContents = (lax |skip |strict) : strict
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?)
</anyAttribute>

Complex Type Definition with simple content Schema Component
PropertyRepresentation
{base type definition}The type definition·resolved· to by the·actual value· of thebase[attribute]
{derivation method}If the<restriction> alternativeis chosen, thenrestriction, otherwise (the<extension> alternativeis chosen)extension.
{attribute uses}A union of sets of attribute uses as follows
1The set of attribute uses corresponding to the<attribute>[children], if any.
2The{attribute uses} of theattribute groups·resolved· to by the·actual value·s of theref[attribute] of the<attributeGroup>[children], if any.
3 if the type definition·resolved· to by the·actual value· of thebase[attribute] is a complex type definition, the{attribute uses} of that type definition, unlessthe<restriction> alternative is chosen, in which case some members ofthat type definition's{attribute uses} may not beincluded, namely those whose{attribute declaration}'s{name} and{target namespace} are the same asone of the following:
3.1 the{name} and{target namespace} of the{attribute declaration} of an attribute use in the set per clause1 or clause2 above;
3.2 what would have been the{name} and{target namespace} of the{attribute declaration} of an attribute use in the set per clause1 above but for the·actual value· of theuse[attribute] of the relevant<attribute> among the[children] of<restriction> beingprohibited.
{attribute wildcard}
1[Definition:]  Let thelocal wildcard be defined as the appropriatecase among the following:
1.1Ifthere is an<anyAttribute> present,thena wildcard basedon the·actual value·s of thenamespace andprocessContents[attributes] and the<annotation>[children], exactly as for the wildcardcorresponding to an<any> element as set out inXML Representation of Wildcard Schema Components (§3.10.2);
1.2otherwise·absent·.
2[Definition:]  Let thecomplete wildcard be defined as the appropriatecase among the following:
2.1Ifthere are no<attributeGroup>[children] correspondingto attribute groups with non-·absent·{attribute wildcard}s,thenthe·local wildcard·.
2.2Ifthere are one or more<attributeGroup>[children] correspondingto attribute groups with non-·absent·{attribute wildcard}s,then the appropriatecase among the following:
2.2.1Ifthere is an<anyAttribute> present,thena wildcard whose{process contents} and{annotation} are those of the·localwildcard·, and whose{namespace constraint} is the intensional intersection of the{namespace constraint} of the·local wildcard·and of the{namespace constraint}s of all the non-·absent·{attribute wildcard}s of the attribute groups corresponding to the<attributeGroup>[children], as defined inAttribute Wildcard Intersection (§3.10.6).
2.2.2Ifthere is no<anyAttribute> present,thena wildcard whose properties are as follows:
{process contents}
The{process contents} of the first non-·absent·{attribute wildcard} of an attribute group among theattribute groups corresponding to the<attributeGroup>[children].
{namespace constraint}
The intensional intersection of the{namespace constraint}s of all the non-·absent·{attribute wildcard}s of the attribute groups corresponding to the<attributeGroup>[children], as defined inAttribute Wildcard Intersection (§3.10.6).
{annotation}
·absent·.
3 The value is then determined by the appropriatecase among the following:
3.1Ifthe<restriction> alternative is chosen,thenthe·complete wildcard·;
3.2Ifthe<extension> alternative is chosen,then
3.2.1[Definition:]  let thebasewildcard be defined as the appropriatecase among the following:
3.2.1.1Ifthe type definition·resolved· to by the·actual value· of thebase[attribute] is a complex type definitionwith an{attribute wildcard},thenthat{attribute wildcard}.
3.2.1.2otherwise·absent·.
3.2.2 The value is then determined by the appropriatecase among the following:
3.2.2.1Ifthe·base wildcard· is non-·absent·,then the appropriatecase among the following:
3.2.2.1.2otherwisea wildcard whose{process contents} and{annotation} are those of the·completewildcard·, and whose{namespace constraint} is theintensional union of the{namespace constraint} of the·complete wildcard·and of the·base wildcard·, as defined inAttribute Wildcard Union (§3.10.6).
{content type} the appropriatecase among the following:
1Ifthe type definition·resolved· to by the·actual value· of thebase[attribute] is a complex type definition whose own{content type} is asimple type definition and the<restriction> alternative is chosen,thenstarting from either
1.1the simple type definition corresponding to the<simpleType> amongthe[children] of<restriction> if thereis one;
1.2otherwise (<restriction> has no<simpleType> among its[children]), the simple type definition which is the{content type} of the type definition·resolved· to by the·actual value· of thebase[attribute]
a simple type definition which restricts the simple type definition identified inclause1.1 or clause1.2 with aset of facet components corresponding to the appropriate element informationitems among the<restriction>'s[children] (i.e. those which specify facets, if any), asdefined inSimple Type Restriction (Facets) (§3.14.6);
2Ifthe type definition·resolved· to by the·actual value· of thebase[attribute] is a complex type definitionwhose own{content type} ismixed and a particle whichis·emptiable·, as defined inParticle Emptiable (§3.9.6) and the<restriction> alternative is chosen,thenstarting from the simple type definition corresponding to the<simpleType> amongthe[children] of<restriction> (whichmust be present)a simple type definition which restricts that simple type definition with aset of facet components corresponding to the appropriate element informationitems among the<restriction>'s[children] (i.e. those which specify facets, if any), asdefined inSimple Type Restriction (Facets) (§3.14.6);
3Ifthe type definition·resolved· to by the·actual value· of thebase[attribute] is a complex type definition(whose own{content type} must be asimple type definition, see below) and the<extension> alternative is chosen,thenthe{content type} of that complex type definition;
4otherwise(the type definition·resolved· to by the·actual value· of thebase[attribute] is a simple type definition andthe<extension> alternative is chosen), thenthat simple type definition.
When the<complexContent> alternative is chosen, the followingelements are relevant (as are the<attributeGroup> and<anyAttribute> elements, not repeated here), and the additional property mappings are as below. Note that either<restriction> or<extension> must be chosen as thecontent of<complexContent>, but their content models aredifferent in this case from the case above when they occur as children of<simpleContent>.
The property mappings below arealso used in the case wherethe third alternative (neither<simpleContent> nor<complexContent>) is chosen. This case is understood as shorthand for complex content restricting the·ur-type definition·, and the details of the mappings should be modified as necessary.

<complexContent
  id =ID
  mixed =boolean
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (restriction |extension))
</complexContent>

<restriction
  base =QName
  id =ID
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (group |all |choice |sequence)?, ((attribute |attributeGroup)*,anyAttribute?))
</restriction>

<extension
  base =QName
  id =ID
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, ((group |all |choice |sequence)?, ((attribute |attributeGroup)*,anyAttribute?)))
</extension>

Complex Type Definition with complex content Schema Component
PropertyRepresentation
{base type definition}The type definition·resolved· to by the·actual value· of thebase[attribute]
{derivation method}If the<restriction> alternativeis chosen, thenrestriction, otherwise (the<extension> alternativeis chosen)extension.
{attribute uses}A union of sets of attribute uses as follows:
1The set of attribute uses corresponding to the<attribute>[children], if any.
2The{attribute uses} of theattribute groups·resolved· to by the·actual value·s of theref[attribute] of the<attributeGroup>[children], if any.
3 The{attribute uses} of the type definition·resolved· to by the·actual value· of thebase[attribute], unlessthe<restriction> alternativeis chosen, in which case some members ofthat type definition's{attribute uses} may not beincluded, namely those whose{attribute declaration}'s{name} and{target namespace} are the same asone of the following:
3.1 The{name} and{target namespace} of the{attribute declaration} of an attribute use in the set per clause1 or clause2 above;
3.2 what would have been the{name} and{target namespace} of the{attribute declaration} of an attribute use in the set per clause1 above but for the·actual value· of theuse[attribute] of the relevant<attribute> among the[children] of<restriction> beingprohibited.
{attribute wildcard}As above for the<simpleContent> alternative.
{content type}
1[Definition:]  Let theeffective mixed be the appropriatecase among the following:
1.1Ifthemixed[attribute] is present on<complexContent>,thenits·actual value·;
1.2Ifthemixed[attribute] is present on<complexType>,thenits·actual value·;
1.3otherwisefalse.
2[Definition:]  Let theeffectivecontent bethe appropriatecase among the following:
2.1Ifone of the following is true
2.1.1 There is no<group>,<all>,<choice> or<sequence> among the[children];
2.1.2 There is an<all> or<sequence> amongthe[children] with no[children] of its own excluding<annotation>;
2.1.3 There is a<choice> amongthe[children] with no[children] of its own excluding<annotation> whoseminOccurs[attribute] has the·actual value·0;
,then the appropriatecase among the following:
2.1.4Ifthe·effective mixed· istrue,thenA particle whose properties are as follows:
{min occurs}
1
{max occurs}
1
{term}
A model group whose{compositor} issequence and whose{particles} is empty.
.
2.1.5otherwiseempty
2.2otherwisethe particle corresponding tothe<all>,<choice>,<group> or<sequence> among the[children].
3 Then the value of the property is the appropriatecase among the following:
3.1Ifthe<restriction> alternative is chosen,then the appropriatecase among the following:
3.1.1Ifthe·effective content· isempty ,thenempty;
3.1.2otherwisea pair consisting of
3.1.2.1mixed if the·effective mixed· istrue, otherwiseelementOnly
3.2Ifthe<extension> alternative is chosen,then the appropriatecase among the following:
3.2.1Ifthe·effectivecontent· isempty,thenthe{content type} of the type definition·resolved· toby the·actual value· of thebase[attribute]
3.2.2Ifthe type definition·resolved· toby the·actual value· of thebase[attribute] has a{content type} ofempty,thena pair as per clause3.1.2 above;
3.2.3otherwisea pair ofmixed orelementOnly (determined as perclause3.1.2.1 above) and a particle whose properties are as follows:
{min occurs}
1
{max occurs}
1
{term}
A model group whose{compositor} issequence and whose{particles} are the particle ofthe{content type} of the type definition·resolved· toby the·actual value· of thebase[attribute] followed by the·effective content·.
Note: Aside from the simple coherence requirements enforced above, constrainingtype definitions identified as restrictions to actuallyberestrictions, that is, to·validate· asubset of the items which are·validated· by their base type definition, is enforced inConstraints on Complex Type Definition Schema Components (§3.4.6).
Note: Theonly substantive function of the valueprohibited for theuse attribute of an<attribute> is in establishingthe correspondence between a complex type defined by restriction and its XMLrepresentation. It serves to preventinheritance of an identically named attribute use from the{base type definition}. Such an<attribute> does not correspond to any component, and hence there is no interaction with either explicit or inherited wildcards in the operation ofComplex Type Definition Validation Rules (§3.4.4) orConstraints on Complex Type Definition Schema Components (§3.4.6).

Careful consideration of the above concrete syntax reveals thata type definition need consist of no more than a name, i.e. that<complexType name="anyThing"/> is allowed.

Example
<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="xs:anyType">   <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>
Three approaches to defining a type for length: one withcharacter data content constrained by reference to a built-in datatype, and one attribute, the other two using twoelements.length3 is the abbreviated alternative tolength2: they correspond to identical type definition components.
Example
<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>
A type definition for personal names, and a definition derived byextension which adds a single element; an element declaration referencing thederived definition, and a·valid· instance thereof.
Example
<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>
A simplified type definitionderived from the base type from the previous example by restriction, eliminating one optional daughter andfixing another to occur exactly once; an element declared by reference to it,and a·valid· instance thereof.
Example
<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>
A further illustration of the abbreviated form, with themixed attribute appearing oncomplexType itself.

3.4.3 Constraints on XML Representations of Complex Type Definitions

Schema Representation Constraint: Complex Type Definition Representation OK
In addition to the conditions imposed on<complexType> elementinformation items by the schema for schemas,all of the following must be true:
1 If the<complexContent> alternative is chosen, the type definition·resolved· toby the·actual value· of thebase[attribute] must be a complex type definition;
2 If the<simpleContent> alternative is chosen,all of the following must be true:
2.1 The type definition·resolved· toby the·actual value· of thebase[attribute] must beone of the following:
2.1.1 a complex typedefinition whose{content type} is a simple type definition;
2.1.2only if the<restriction> alternative is also chosen, a complex typedefinition whose{content type} ismixed and a particlewhich is·emptiable·, as defined inParticle Emptiable (§3.9.6);
2.1.3 only if the<extension> alternative is also chosen, a simple type definition.
2.2 If clause2.1.2 above is satisfied, then there must be a<simpleType> among the[children] of<restriction>.
Note: Although not explicitly ruled out either here or inSchema for Schemas (normative) (§A), specifying<xs:complexType . . .mixed='true' when the<simpleContent> alternative is chosen has no effect on the corresponding component, and should be avoided. This may be ruled out in a subsequent version of this specification.
3 The corresponding complex type definition component must satisfy the conditions setout inConstraints on Complex Type Definition Schema Components (§3.4.6);
4 If clause2.2.1 or clause2.2.2 in the correspondence specification above for{attribute wildcard} is satisfied, the intensional intersection must be expressible, as defined inAttribute Wildcard Intersection (§3.10.6).

3.4.4 Complex Type Definition Validation Rules

Validation Rule: Element Locally Valid (Complex Type)
For an element information item to be locally·valid· with respect to a complex type definitionall of the following must be true:
1{abstract} isfalse.
2 If clause3.2 ofElement Locally Valid (Element) (§3.3.4) did notapply, then the appropriatecase among the followingmust be true:
2.1Ifthe{content type} isempty,thenthe elementinformation item has no character or element information item[children].
2.2Ifthe{content type} is a simpletype definition,thenthe element information item has no elementinformation item[children], and the·normalized value· of the element information item is·valid· with respect to that simple type definition as defined byString Valid (§3.14.4).
2.3Ifthe{content type} iselement-only,thentheelement information item has no character information item[children] otherthan those whose[character code] is defined as awhite spacein[XML 1.0 (Second Edition)].
2.4Ifthe{content type} iselement-only ormixed,thenthe sequence of the element information item's elementinformation item[children], if any, taken in order, is·valid· withrespect to the{content type}'s particle, as defined inElement Sequence Locally Valid (Particle) (§3.9.4).
3For each attribute information item in the element informationitem's[attributes] excepting those whose[namespace name] is identical tohttp://www.w3.org/2001/XMLSchema-instance and whose[local name] is one oftype,nil,schemaLocation ornoNamespaceSchemaLocation, the appropriatecase among the followingmust be true:
3.1Ifthere is among the{attribute uses} anattribute use with an{attribute declaration} whose{name} matches the attribute information item's[local name] and whose{target namespace} is identical to the attribute information item's[namespace name] (where an·absent·{target namespace} is taken to be identical to a[namespace name] with no value),thenthe attribute information must be·valid· with respect to that attribute use as perAttribute Locally Valid (Use) (§3.5.4). In this case the{attribute declaration} of that attribute use is the·context-determined declaration· for the attribute information item with respect toSchema-Validity Assessment (Attribute) (§3.2.4) andAssessment Outcome (Attribute) (§3.2.5).
3.2otherwiseall of the following must be true:
3.2.1 There must be an{attribute wildcard}.
3.2.2 Theattribute information item must be·valid· with respect to it as defined inItem Valid (Wildcard) (§3.10.4).
4 The{attribute declaration} of each attribute use in the{attribute uses} whose{required} istrue matches one of the attribute information items in the element information item's[attributes] as per clause3.1 above.
5 Let[Definition:]  thewildIDs be the set of allattribute information item to which clause3.2 applied and whose·validation· resulted ina·context-determined declaration· ofmustFind or no·context-determineddeclaration· at all, and whose[local name] and[namespace name] resolve (as defined byQName resolution (Instance) (§3.15.4)) to an attribute declaration whose{type definition} is or is derived fromID. Thenall of the following must be true:
5.1 There must be no more than one item in·wild IDs·.
5.2 If·wild IDs· is non-empty, there must not be any attribute uses among the{attribute uses} whose{attribute declaration}'s{type definition} is or is derived fromID.
Note: This clause serves to ensure that even via attributewildcards no element has more than one attribute of type ID, and that even whenan element legitimately lacks a declared attribute of type ID, awildcard-validated attribute must not supply it. That is, if an element has atype whose attribute declarations include one of type ID, it either has thatattribute or no attribute of type ID.
Note: When an{attribute wildcard} is present, this doesnot introduce any ambiguity with respect to how attributeinformation items forwhich an attribute use is present amongst the{attribute uses} whose name and target namespace match are·assessed·. In such cases the attribute usealways takes precedence, and the·assessment· of such items stands or falls entirely on the basis of the attribute use and its{attribute declaration}. This follows from the details of clause3.

3.4.5 Complex Type Definition Information Set Contributions

Schema Information Set Contribution: Attribute Default Value
For each attribute use in the{attribute uses} whose{required} isfalse and whose{value constraint} is not·absent· but whose{attribute declaration} does not match one of the attribute information items in the element information item's[attributes] as per clause3.1 ofElement Locally Valid (Complex Type) (§3.4.4) above, the·post-schema-validation infoset· has an attribute information item whose properties are as below added to the[attributes] of the element information item.
[local name]
The{attribute declaration}'s{name}.
[namespace name]
The{attribute declaration}'s{target namespace}.
[schema normalized value]
Thecanonical lexical representation of the·effective value constraint· value.
[schema default]
Thecanonical lexical representation of the·effective value constraint· value.
[validation context]
The nearest ancestor element information item with a[schema information] property.
[validity]
valid.
[validation attempted]
full.
[schema specified]
schema.
The added items should also either have[type definition] (and[member type definition] if appropriate) properties, or their lighter-weight alternatives, as specified inAttribute Validated by Type (§3.2.5).

3.4.6 Constraints on Complex Type Definition Schema Components

All complex type definitions (seeComplex Type Definitions (§3.4)) must satisfy the following constraints.

Schema Component Constraint: Complex Type Definition Properties Correct
All of the following must be true:
2 If the{base type definition} is a simple typedefinition, the{derivation method} must beextension.
3 Circular definitions are disallowed, except for the·ur-type definition·. That is, it must be possible to reach the·ur-type definition· by repeatedly following the{base type definition}.
4 Two distinct attribute declarations in the{attribute uses} must not have identical{name}s and{target namespace}s.
5 Two distinct attribute declarations in the{attribute uses}must not have{type definition}s which are or are derived fromID.
Schema Component Constraint: Derivation Valid (Extension)
If the{derivation method} isextension, the appropriatecase among the followingmust be true:
1Ifthe{base type definition} is a complex typedefinition,thenall of the following must be true:
1.1 The{final} of the{base type definition} must not containextension.
1.2Its{attribute uses} must be a subsetof the{attribute uses} of the complex typedefinition itself, that is, for every attribute use in the{attribute uses} of the{base type definition}, there must be an attribute use in the{attribute uses} of the complextype definition itself whose{attribute declaration} has the same{name},{target namespace} and{type definition} as its attribute declaration.
1.3 If it has an{attribute wildcard}, the complextype definition must also have one, and the base type definition's{attribute wildcard}'s{namespace constraint} must be a subset of the complex type definition's{attribute wildcard}'s{namespace constraint}, as defined byWildcard Subset (§3.10.6).
1.4One of the following must be true:
1.4.1 The{content type} ofthe{base type definition} and the{content type} of the complex type definition itself must be thesame simple type definition.
1.4.2 The{content type} of both the{base type definition} and the complex type definition itselfmust beempty.
1.4.3All of the following must be true:
1.4.3.1 The{content type} of the complex type definition itself mustspecify a particle.
1.4.3.2One of the following must be true:
1.4.3.2.1 The{content type} of the{base type definition}must beempty.
1.4.3.2.2All of the following must be true:
1.4.3.2.2.1 Both{content type}s must bemixed or both must beelement-only.
1.4.3.2.2.2 The particle of the complex typedefinition must be a·validextension· of the{base type definition}'s particle,as defined inParticle Valid (Extension) (§3.9.6).
1.5 It must in principle be possible to derive the complex typedefinition in two steps, the first an extension and thesecond a restriction (possibly vacuous), from that type definition among itsancestors whose{base type definition} is the·ur-type definition·.
Note: This requirement ensures that nothing removed by a restrictionis subsequently added back by an extension. It is trivial to check if theextension in question is the only extension in its derivation, or if there areno restrictions bar the first from the·ur-typedefinition·.

Constructing the intermediate type definition to check thisconstraint is straightforward: simply re-order the derivation to put all theextension steps first, then collapse them into a single extension. If theresulting definition can be the basis for a valid restriction to the desireddefinition, the constraint is satisfied.

2Ifthe{base type definition} is a simple typedefinition,thenall of the following must be true:
2.1 The{content type} must be the same simple typedefinition.
2.2 The{final} of the{base type definition} must not containextension.
[Definition:]  If thisconstraintDerivation Valid (Extension) (§3.4.6) holds of a complex type definition, it is avalidextension of its{base type definition}.
Schema Component Constraint: Derivation Valid (Restriction, Complex)
If the{derivation method} isrestrictionall of the following must be true:
1 The{base type definition} must be a complex typedefinition whose{final} does not containrestriction.
2For each attribute use (call thisR) in the{attribute uses} the appropriatecase among the followingmust be true:
2.1Ifthere is an attribute use in the{attribute uses} of the{base type definition} (call thisB) whose{attribute declaration} has the same{name} and{target namespace},thenall of the following must be true:
2.1.1one of the following must be true:
2.1.1.1B's{required} isfalse.
2.1.1.2R's{required} istrue.
2.1.2R's{attribute declaration}'s{type definition} must be validly derived fromB's{type definition} given theempty set as defined inType Derivation OK (Simple) (§3.14.6).
2.1.3[Definition:]  Let theeffective value constraint of an attribute use beits{value constraint}, if present, otherwiseits{attribute declaration}'s{value constraint}. Thenone of the following must be true:
2.1.3.2R's·effective valueconstraint· isfixed with the same string asB's.
2.2otherwisethe{base type definition} musthave an{attribute wildcard} and the{target namespace} of theR's{attribute declaration} must be·valid· with respect to that wildcard, as defined inWildcard allows Namespace Name (§3.10.4).
3For each attribute use in the{attribute uses} ofthe{base type definition} whose{required} istrue, there must be an attribute use with an{attribute declaration} with the same{name} and{target namespace} as its{attribute declaration} in the{attribute uses} of the complex type definitionitself whose{required} istrue.
4If there is an{attribute wildcard},all of the following must be true:
4.1 The{base type definition} must also have one.
4.3 Unless the{base type definition} is the·ur-type definition·, the complextype definition's{attribute wildcard}'s{process contents} must be identicalto or stronger than the{base type definition}'s{attribute wildcard}'s{process contents}, wherestrict is stronger thanlax is stronger thanskip.
5One of the following must be true:
5.2All of the following must be true:
5.2.1 The{content type} of the complex type definitionmust be a simple type definition
5.2.2One of the following must be true:
5.2.2.1 The{content type} of the{base type definition} must be a simple typedefinition from whichthe{content type} is validly derived given the empty set as defined inType Derivation OK (Simple) (§3.14.6).
5.2.2.2 The{base type definition} must bemixedand have a particle which is·emptiable· as defined inParticle Emptiable (§3.9.6).
5.3All of the following must be true:
5.3.1 The{content type} of the complex type itselfmust beempty
5.3.2One of the following must be true:
5.3.2.1 The{content type} of the{base type definition} must also beempty.
5.3.2.2 The{content type} of the{base type definition} must beelementOnly ormixed and have a particle which is·emptiable· as defined inParticle Emptiable (§3.9.6).
5.4All of the following must be true:
5.4.1One of the following must be true:
5.4.1.1 The{content type} of the complex typedefinition itself must beelement-only
5.4.1.2 The{content type} of the complextype definition itself and of the{base type definition} must bemixed
5.4.2 The particle of the complex type definition itselfmust be a·valid restriction· of the particle of the{content type} of the{base type definition} as defined inParticle Valid (Restriction) (§3.9.6).
Note: Attempts to derive complex type definitions whose{content type} iselement-only by restrictinga{base type definition} whose{content type}isempty are not ruled out by this clause. However if the complextype definition itself has a non-pointless particle it will fail to satisfyParticle Valid (Restriction) (§3.9.6). On the other hand some typedefinitions with pointlesselement-only content, for example an empty<sequence>, will satisfyParticle Valid (Restriction) (§3.9.6)with respect to anempty{base type definition}, andso be valid restrictions.
[Definition:]  If thisconstraintDerivation Valid (Restriction, Complex) (§3.4.6) holds of a complex type definition, it is avalidrestriction of its{base type definition}.
Note: To restrict a complex type definition with a simple base type definitiontoempty, use a simple type definition with afixed value ofthe empty string: this preserves the type information.

The following constraint defines a relation appealed to elsewhere in this specification.

Schema Component Constraint: Type Derivation OK (Complex)
For a complex type definition (call itD, for derived) to be validlyderived from a type definition (call thisB, for base) givena subset of {extension,restriction}all of the following must be true:
2One of the following must be true:
2.1B andD must be the same typedefinition.
2.2B must beD's{base type definition}.
2.3All of the following must be true:
2.3.2 The appropriatecase among the followingmust be true:
2.3.2.1IfD's{base type definition} is complex,thenit must be validly derivedfromB given the subset as defined by this constraint.
2.3.2.2IfD's{base type definition} is simple,thenit must be validly derivedfromB given the subset as defined inType Derivation OK (Simple) (§3.14.6).
Note: This constraint is used to check that when someone uses a type in acontext where another type was expected (either viaxsi:type orsubstitution groups), that the type used is actually derived from the expectedtype, and that that derivation does not involve a form of derivation which wasruled out by the expected type.

Note:

The wording of clause
2.1 above appeals to a notion of component identity whichis only incompletely defined by this version of this specification.In some cases, the wording of this specification does make clear therules for component identity. These cases include:
  • When they are both top-level components with the same component type,namespace name, and local name;
  • When they are necessarily the same type definition (for example, whenthe two types definitions in question are the type definitions associated withtwo attribute or element declarations, which are discovered to be the samedeclaration);
  • When they are the same by construction (for example, when an element'stype definition defaults to being the same type definition as that of itssubstitution-group head or when a complex type definition inherits an attributedeclaration from its base type definition).

In other cases two conforming implementations may disagree as to whethercomponents are identical.

3.4.7 Built-in Complex Type Definition

There is a complex type definition nearly equivalent to the·ur-type definition· present in everyschema by definition. It has the following properties:

Complex Type Definition of the Ur-Type
PropertyValue
{name}anyType
{target namespace}http://www.w3.org/2001/XMLSchema
{base type definition}Itself
{derivation method}restriction
{content type}A pair consisting ofmixed and aparticle with the following properties:
PropertyValue
{min occurs}1
{max occurs}1
{term}a model group withthe following properties:
PropertyValue
{compositor}sequence
{particles} a list containing one particle with the following properties:
PropertyValue
{min occurs}0
{max occurs}unbounded
{term}a wildcard with the following properties:
PropertyValue
{namespace constraint}any
{process contents}lax
{attribute uses}The empty set
{attribute wildcard} a wildcard with the following properties::
PropertyValue
{namespace constraint}any
{process contents}lax
{final}The empty set
{prohibited substitutions}The empty set
{abstract}false

Themixed content specification together with thelax wildcard and attribute specification produce the defining property for the·ur-type definition·, namely thatevery typedefinition is (eventually) a restrictionof the·ur-type definition·: its permissions and requirements are(nearly) the least restrictive possible.

Note: This specification does not provide an inventory of built-in complextype definitions for use in user schemas. A preliminary library of complex typedefinitions is available which includes both mathematical (e.g.rational) and utility (e.g.array) type definitions. In particular, there is atext type definition which is recommended for useas the type definition in element declarations intended for general textcontent, as it makes sensible provision for various aspects ofinternationalization. For more details, see the schema document for the typelibrary at its namespace name:http://www.w3.org/2001/03/XMLSchema/TypeLibrary.xsd.

previous sub-sectionnext sub-section3.5 AttributeUses

        3.5.1The Attribute Use Schema Component
        3.5.2XML Representation of Attribute Use Components
        3.5.3Constraints on XML Representations of Attribute Uses
        3.5.4Attribute Use Validation Rules
        3.5.5Attribute Use Information Set Contributions
        3.5.6Constraints on Attribute Use Schema Components

An attribute use is a utility component which controls the occurrence anddefaulting behavior of attribute declarations. It plays the same role forattribute declarations in complex types that particles play for element declarations.

Example
<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>
XML representations which all involve attribute uses, illustrating some ofthe possibilities for controlling occurrence.

3.5.1 The Attribute Use Schema Component

The attribute use schema component has the following properties:

{required}
A boolean.
{attribute declaration}
An attribute declaration.
{value constraint}
Optional. A pairconsisting of a value and one ofdefault,fixed.

{required} determines whether this use of an attributedeclaration requires an appropriate attribute information item to be present, ormerely allows it.

{attribute declaration} provides the attribute declaration itself,which will in turn determine the simple type definition used.

{value constraint} allows for local specification of adefault or fixed value. This must be consistent with that of the{attribute declaration}, in that if the{attribute declaration} specifies a fixed value, the only allowed{value constraint} is the same fixed value.

3.5.2 XML Representation of Attribute Use Components

Attribute uses correspond to all uses of<attribute> whichallow ause attribute. These in turn correspond totwo components in each case, an attribute use and its{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 inXML Representation of Attribute Declaration Schema Components (§3.2.2).

3.5.3 Constraints on XML Representations of Attribute Uses

None as such.

3.5.4 Attribute Use Validation Rules

Validation Rule: Attribute Locally Valid (Use)
For an attribute information item to be·valid· with respect to an attribute use its·normalized value· must match thecanonical lexical representation of the attribute use's{value constraint} value, if it is present andfixed.

3.5.5 Attribute Use Information Set Contributions

None as such.

3.5.6 Constraints on Attribute Use Schema Components

All attribute uses (seeAttributeUses (§3.5)) must satisfy the following constraints.

Schema Component Constraint: Attribute Use Correct

previous sub-sectionnext sub-section3.6 Attribute Group Definitions

        3.6.1The Attribute Group Definition Schema Component
        3.6.2XML Representation of Attribute Group Definition Schema Components
        3.6.3Constraints on XML Representations of Attribute Group Definitions
        3.6.4Attribute Group Definition Validation Rules
        3.6.5Attribute Group Definition Information SetContributions
        3.6.6Constraints on Attribute Group Definition Schema Components

A schema can name a group of attribute declarations so that they may be incorporated as agroup into complex type definitions.

Attribute group definitions do not participate in·validation· as such, but the{attribute uses} and{attribute wildcard} of one ormore complex type definitions may be constructed in whole or part by referenceto an attribute group. Thus, attribute group definitions provide areplacement for some uses of XML'sparameter entity facility.Attribute group definitions are provided primarily for reference from the XMLrepresentation of schema components(see<complexType> and<attributeGroup>).

Example
<xs:attributeGroup name="myAttrGroup">    <xs:attribute . . ./>    . . .</xs:attributeGroup><xs:complexType name="myelement">    . . .    <xs:attributeGroup ref="myAttrGroup"/></xs:complexType>
XML representations for attribute group definitions. The effect is as if the attributedeclarations in the group were present in the type definition.

3.6.1 The Attribute Group Definition Schema Component

The attribute group definition schema component has thefollowing properties:

{name}
An NCName as defined by[XML-Namespaces].
{target namespace}
Either·absent· or a namespace name, as defined in[XML-Namespaces].
{attribute uses}
A set of attribute uses.
{attribute wildcard}
Optional. A wildcard.
{annotation}
Optional. An annotation.

Attribute groups are identified by their{name} and{target namespace}; attribute group identities must be unique within an·XML Schema·. SeeReferences to schema components across namespaces (§4.2.3) for the use of componentidentifiers when importing one schema into another.

{attribute uses} is a set attribute uses, allowingfor local specification of occurrence and default or fixed values.

{attribute wildcard} provides for an attribute wildcard to be included in anattribute group.See above underComplex Type Definitions (§3.4) for theinterpretation ofattribute wildcards during·validation·.

SeeAnnotations (§3.13) for information on the role of the{annotation} property.

3.6.2 XML Representation of Attribute Group Definition Schema Components

The XML representation for an attribute group definition schema component is an<attributeGroup> element information item. It provides fornaming a group of attribute declarations and an attribute wildcard for use by reference in the XML representation ofcomplex type definitions and other attribute group definitions. The correspondences between theproperties of the information item andproperties of the component it corresponds to are as follows:

XML Representation SummaryattributeGroup Element Information Item

<attributeGroup
  id =ID
  name =NCName
  ref =QName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, ((attribute |attributeGroup)*,anyAttribute?))
</attributeGroup>

When an<attributeGroup> appears as a daughter of<schema> or<redefine>, it corresponds to an attribute group definition asbelow. When it appears as a daughter of<complexType> or<attributeGroup>, it does not correspond to any component as such.
Attribute Group Definition Schema Component
PropertyRepresentation
{name}The·actual value· of thename[attribute]
{target namespace}The·actual value· of thetargetNamespace[attribute] of the parentschemaelement information item.
{attribute uses}The union of the set of attribute uses corresponding to the<attribute>[children], if any, with the{attribute uses} of theattribute groups·resolved· to by the·actual value·s of theref[attribute] of the<attributeGroup>[children], if any.
{attribute wildcard}As for the·complete wildcard· as described inXML Representation of Complex Type Definitions (§3.4.2).
{annotation}The annotation corresponding to the<annotation> element information item in the[children], if present, otherwise·absent·.

The example above illustrates a pattern whichrecurs in the XML representation of schemas: The same element, in this caseattributeGroup, serves both todefine and to incorporate by reference. In the first case thename attribute is required, in the second therefattribute is required, and the element must be empty. These two are mutually exclusive, and also conditionedby context: the defining form, with aname, must occur at the toplevel of a schema, whereas the referring form, with aref, mustoccur within a complex type definition or an attribute group definition.

3.6.3 Constraints on XML Representations of Attribute Group Definitions

Schema Representation Constraint: Attribute Group Definition Representation OK
In addition to the conditions imposed on<attributeGroup> elementinformation items by the schema for schemas,all of the following must be true:
1 The corresponding attribute group definition, if any, must satisfy the conditions setout inConstraints on Attribute Group Definition Schema Components (§3.6.6).
2 If clause2.2.1 or clause2.2.2 in the correspondence specification inXML Representation of Complex Type Definitions (§3.4.2) for{attribute wildcard}, as referenced above, is satisfied, the intensional intersection must be expressible, as defined inAttribute Wildcard Intersection (§3.10.6).
3 Circular group reference is disallowed outside<redefine>. That is, unless this element information item's parent is<redefine>, then among the[children], if any, there must not be an<attributeGroup> withref[attribute] which resolves to the component corresponding to this<attributeGroup>. Indirect circularity is also ruled out. That is, whenQName resolution (Schema Document) (§3.15.3) is applied to a·QName· arising from any<attributeGroup>s with aref[attribute] among the[children], it must not be the case that a·QName· isencountered at any depth which resolves to thecomponent corresponding to this<attributeGroup>.

3.6.4 Attribute Group Definition Validation Rules

None as such.

3.6.5 Attribute Group Definition Information SetContributions

None as such.

3.6.6 Constraints on Attribute Group Definition Schema Components

All attribute group definitions (seeAttribute Group Definitions (§3.6)) must satisfy the following constraint.

Schema Component Constraint: Attribute Group Definition Properties Correct

previous sub-sectionnext sub-section3.7 Model Group Definitions

        3.7.1The Model Group Definition Schema Component
        3.7.2XML Representation of Model Group Definition Schema Components
        3.7.3Constraints on XML Representations of Model Group Definitions
        3.7.4Model Group Definition Validation Rules
        3.7.5Model Group Definition Information Set Contributions
        3.7.6Constraints on Model Group Definition Schema Components

A model group definition associates a name and optional annotations with aModel Group (§2.2.3.1).By reference to the name, the entire model group can be incorporated by reference into a{term}.

Model group definitions are providedprimarily for reference from theXML Representation of Complex Type Definitions (§3.4.2) (see<complexType>and<group>). Thus, model group definitions provide areplacement for some uses of XML'sparameter entity facility.

Example
<xs:group name="myModelGroup"> <xs:sequence>  <xs:element ref="someThing"/>  . . . </xs:sequence></xs:group><xs:complexType name="trivial"> <xs:group ref="myModelGroup"/> <xs:attribute .../></xs:complexType><xs:complexType name="moreSo"> <xs:choice>  <xs:element ref="anotherThing"/>  <xs:group ref="myModelGroup"/> </xs:choice> <xs:attribute .../></xs:complexType>
A minimal model group is defined and used by reference, first as the wholecontent model, then as one alternative in a choice.

3.7.1 The Model Group Definition Schema Component

The model group definition schema component has the followingproperties:

{name}
An NCName as defined by[XML-Namespaces].
{target namespace}
Either·absent· or a namespace name, as defined in[XML-Namespaces].
{model group}
A model group.
{annotation}
Optional. An annotation.

Model group definitions are identified by their{name} and{target namespace}; model group identities must be unique within an·XML Schema·. SeeReferences to schema components across namespaces (§4.2.3) for the use of componentidentifiers when importing one schema into another.

Model group definitionsper se do not participate in·validation·, but the{term} ofa particle may correspond in whole or in partto a model group from a model group definition.

{model group} is theModel Group (§2.2.3.1) for which the model group definition provides a name.

SeeAnnotations (§3.13) for information on the role of the{annotation} property.

3.7.2 XML Representation of Model Group Definition Schema Components

The XML representation for a model group definition schema component is a<group> element information item. It provides fornaming a model group for use by reference in the XML representation ofcomplex type definitions and model groups. The correspondences between theproperties of the information item andproperties of the component it corresponds to are as follows:

XML Representation Summarygroup Element Information Item

<group
  id =ID
  maxOccurs = (nonNegativeInteger |unbounded)  : 1
  minOccurs =nonNegativeInteger : 1
  name =NCName
  ref =QName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (all |choice |sequence)?)
</group>

If there is aname[attribute] (in which case theitem will have<schema> or<redefine> as parent), then the item corresponds toa model group definition component with properties as follows:
Model Group Definition Schema Component
PropertyRepresentation
{name}The·actual value· of thename[attribute]
{target namespace}The·actual value· of thetargetNamespace[attribute] of the parentschemaelement information item.
{model group}A model group which is the{term} of aparticle corresponding to the<all>,<choice> or<sequence> among the[children] (there must be one).
{annotation}The annotation corresponding to the<annotation> element information item in the[children], if present, otherwise·absent·.
Otherwise, the item will have aref[attribute],in which case it corresponds to a particle component with properties as follows (unlessminOccurs=maxOccurs=0, in which case the itemcorresponds to no component at all):
Particle Schema Component
PropertyRepresentation
{min occurs}The·actual value· of theminOccurs[attribute], if present, otherwise1.
{max occurs}unbounded, if themaxOccurs[attribute] equalsunbounded, otherwise the·actual value· of themaxOccurs[attribute], if present, otherwise1.
{term}The{model group} of themodel group definition·resolved· to by the·actual value· of theref[attribute]

The name of this section is slightly misleading, in that the second, un-named,case above (with aref and noname) is not really a named modelgroup at all, but a reference to one. Also note that in the first (named)case above no reference is made tominOccurs ormaxOccurs: this is because the schema for schemas does not allowthem on the child of<group> when it is named. This in turn isbecause the{min occurs} and{max occurs} ofthe particles whichrefer to the definition are what count.

Given the constraints on its appearance in content models, an<all> should only occur as the only item in the[children] of a named model group definition or a content model: seeConstraints on Model Group Schema Components (§3.8.6).

3.7.3 Constraints on XML Representations of Model Group Definitions

Schema Representation Constraint: Model Group Definition Representation OK
In addition to the conditions imposed on<group> elementinformation items by the schema for schemas, the corresponding model group definition, if any, must satisfy the conditions setout inConstraints on Model Group Schema Components (§3.8.6).

3.7.4 Model Group Definition Validation Rules

None as such.

3.7.5 Model Group Definition Information Set Contributions

None as such.

3.7.6 Constraints on Model Group Definition Schema Components

All model group definitions (seeModel Group Definitions (§3.7)) must satisfy the following constraint.

Schema Component Constraint: Model Group Definition Properties Correct

previous sub-sectionnext sub-section3.8 Model Groups

        3.8.1The Model Group Schema Component
        3.8.2XML Representation of Model Group Schema Components
        3.8.3Constraints on XML Representations of Model Groups
        3.8.4Model Group Validation Rules
        3.8.5Model Group Information Set Contributions
        3.8.6Constraints on Model Group Schema Components

When the[children] of element information items are not constrainedto beempty or by reference to a simple type definition(Simple Type Definitions (§3.14)), the sequence of elementinformation item[children] content may be specified inmore detail with a model group. Because the{term} property of a particle can be amodel group, and model groups contain particles, model groups can indirectly contain other model groups; the grammar for content modelsis therefore recursive.

Example
<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>
XML representations for the three kinds of model group, the third nestedinside the second.

3.8.1 The Model Group Schema Component

The model group schema component has the followingproperties:

{compositor}
One ofall,choice orsequence.
{particles}
A list of particles
{annotation}
Optional. An annotation.

specifies a sequential (sequence),disjunctive (choice) or conjunctive (all) interpretation ofthe{particles}. This in turn determines whether the elementinformation item[children]·validated· by the model group must:

  • (sequence) correspond, in order, to the specified{particles};
  • (choice) corresponded to exactly one of the specified{particles};
  • (all) contain all and only exactly zero or one of eachelement specified in{particles}. The elements can occur in anyorder. In this case, to reduce implementation complexity,{particles} is restricted to contain local and top-level elementdeclarations only, with{min occurs}=0 or1,{max occurs}=1.

When two or more particles contained directly or indirectly in the{particles} of a model group have identically namedelement declarations as their{term}, the type definitions of those declarations must be thesame. By 'indirectly' is meant particles within the{particles}of a group which is itself the{term} of a directly containedparticle, and so on recursively.

SeeAnnotations (§3.13) for information on the role of the{annotation} property.

3.8.2 XML Representation of Model Group Schema Components

The XML representation for a model group schema component iseither an<all>, a<choice> or a<sequence>element information item. The correspondences between theproperties of those information items andproperties of the component they correspond to are as follows:

XML Representation Summaryall Element Information Item

<all
  id =ID
  maxOccurs =1 : 1
  minOccurs = (0 |1) : 1
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?,element*)
</all>

<choice
  id =ID
  maxOccurs = (nonNegativeInteger |unbounded)  : 1
  minOccurs =nonNegativeInteger : 1
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (element |group |choice |sequence |any)*)
</choice>

<sequence
  id =ID
  maxOccurs = (nonNegativeInteger |unbounded)  : 1
  minOccurs =nonNegativeInteger : 1
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (element |group |choice |sequence |any)*)
</sequence>

Each of the above items corresponds to a particle containing a modelgroup, with properties as follows (unlessminOccurs=maxOccurs=0, in which case the itemcorresponds to no component at all):
Particle Schema Component
PropertyRepresentation
{min occurs}The·actual value· of theminOccurs[attribute], if present, otherwise1.
{max occurs}unbounded, if themaxOccurs[attribute] equalsunbounded, otherwise the·actual value· of themaxOccurs[attribute], if present, otherwise1.
{term}A model group as given below:
Model Group Schema Component
PropertyRepresentation
{compositor}One ofall,choice,sequence depending on the element information item.
{particles}A sequence of particlescorresponding to all the<all>,<choice>,<sequence>,<any>,<group> or<element> items among the[children],in order.
{annotation}The annotation corresponding to the<annotation> element information item in the[children], if present, otherwise·absent·.

3.8.3 Constraints on XML Representations of Model Groups

Schema Representation Constraint: Model Group Representation OK
In addition to the conditions imposed on<all>,<choice> and<sequence> elementinformation items by the schema for schemas, the corresponding particle and model group must satisfy the conditions setout inConstraints on Model Group Schema Components (§3.8.6) andConstraints on Particle Schema Components (§3.9.6).

3.8.4 Model Group Validation Rules

Validation Rule: Element Sequence Valid
[Definition:]  Define apartition of a sequence as a sequence of sub-sequences, some orall of which may be empty, such that concatenating all the sub-sequences yieldsthe original sequence.

For a sequence (possibly empty) of element information items to belocally·valid· with respect toa model group the appropriatecase among the followingmust be true:

1Ifthe{compositor} issequence,thenthere must be a·partition· of the sequence inton sub-sequences wheren is the length of{particles} such that each of the sub-sequences in order is·valid·with respect to the corresponding particle in the{particles} as defined inElement Sequence Locally Valid (Particle) (§3.9.4).
2Ifthe{compositor} ischoice,thenthere must be aparticle among the{particles} such that the sequence is·valid· with respect to that particle as defined inElement Sequence Locally Valid (Particle) (§3.9.4).
3Ifthe{compositor} isall,thenthere must be a·partition· of the sequence inton sub-sequences wheren is the length of{particles} such that there is a one-to-one mapping between the sub-sequences and the{particles} where each sub-sequence is·valid· with respect to the corresponding particle as defined inElement Sequence Locally Valid (Particle) (§3.9.4).

Nothing in the above should be understood as ruling out groups whose{particles} is empty: although no sequence can be·valid·with respect to such a group whose{compositor} ischoice, the empty sequenceis·valid· with respectto empty groups whose{compositor} issequence orall.

Note: The above definition is implicitly non-deterministic, and should not betaken as a recipé for implementations. Note in particular that when{compositor} isall, particles is restricted to a listof local and top-level element declarations (seeConstraints on Model Group Schema Components (§3.8.6)). A much simpler implementation is possible than would arise from a literal interpretation of the definition above; informally, the content is·valid· when each declared element occurs exactly once (or at most once, if{min occurs} is0), and each is·valid· with respect to its corresponding declaration. The elements can occur in arbitrary order.

3.8.5 Model Group Information Set Contributions

None as such.

3.8.6 Constraints on Model Group Schema Components

All model groups (seeModel Groups (§3.8)) must satisfy the following constraints.

Schema Component Constraint: Model Group Correct
All of the following must be true:
2 Circular groups are disallowed. That is, within the{particles} of a group there must not be at anydepth a particle whose{term} is thegroup itself.
Schema Component Constraint: All Group Limited
When a model group has{compositor}all, thenall of the following must be true:
1 It appears only as the value of one or both of the following properties:
1.1 the{model group} property of a model group definition.
1.2 the{term} property of a particle with{max occurs}=1which is part of a pair which constitutes the{content type} of acomplex type definition.
2 The{max occurs} of all the particles in the{particles} of the group must be0 or1.
Schema Component Constraint: Element Declarations Consistent
If the{particles} contains, either directly, indirectly(that is, within the{particles} of a contained model group,recursively) or·implicitly· two or moreelement declaration particles with the same{name} and{target namespace}, then all their type definitions must bethe same top-level definition, that is,all of the following must be true:
1 all their{type definition}s must have a non-·absent·{name}.
2 all their{type definition}s must have the same{name}.
3 all their{type definition}s must have the same{target namespace}.

[Definition:]  A listof particlesimplicitly contains an element declaration if amember of the list contains thatelement declaration in its·substitution group·.

Schema Component Constraint: Unique Particle Attribution
A content model must be formed such thatduring·validation· of an element informationitem sequence, the particle componentcontained directly, indirectly or·implicitly· therein with which to attempt to·validate· 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.
Note: This constraint reconstructs for XML Schema the equivalent constraints of[XML 1.0 (Second Edition)] and SGML. Given the presence of element substitution groups and wildcards, the concise expression of this constraint is difficult,seeAnalysis of the Unique Particle Attribution Constraint (non-normative) (§H) for further discussion.

Since this constraint is expressed at the component level, itapplies to content models whose origins (e.g. via type derivation andreferences to named model groups) are no longer evident. So particles atdifferent points in the content model are always distinct from one another,even if they originated from the same named model group.

Note: Because locally-scoped element declarations may or may not have a{target namespace}, the scope of declarations isnot relevant to enforcing either of the two preceding constraints.

The following constraints define relations appealed to elsewhere in this specification.

Schema Component Constraint: Effective Total Range (all and sequence)
The effective total range of a particle whose{term} is a group whose{compositor} isall orsequence is a pair of minimum and maximum, as follows:
minimum
The product of the particle's{min occurs} and thesum of the{min occurs} of every wildcard or elementdeclaration particle in the group's{particles} and the minimumpart of the effective total range of each of the group particles in the group's{particles} (or0 if there are no{particles}).
maximum
unbounded if the{max occurs} of any wildcard or elementdeclaration particle in the group's{particles} or the maximumpart of the effective total range of any of the group particles in the group's{particles} isunbounded, or if any of those is non-zeroand the{max occurs} of the particle itself isunbounded,otherwise the product of the particle's{max occurs} and thesum of the{max occurs} of every wildcard or elementdeclaration particle in the group's{particles} and the maximumpart of the effective total range of each of the group particles in the group's{particles} (or0 if there are no{particles}).
Schema Component Constraint: Effective Total Range (choice)
The effective total range of a particle whose{term} is a group whose{compositor} ischoice is a pair of minimum and maximum, as follows:
minimum
The product of the particle's{min occurs} and theminimum of the{min occurs} of every wildcard or elementdeclaration particle in the group's{particles} and the minimumpart of the effective total range of each of the group particles in the group's{particles} (or0 if there are no{particles}).
maximum
unbounded if the{max occurs} of any wildcard or elementdeclaration particle in the group's{particles} or the maximumpart of the effective total range of any of the group particles in the group's{particles} isunbounded, or if any of those is non-zeroand the{max occurs} of the particle itself isunbounded,otherwise the product of the particle's{max occurs} and themaximum of the{max occurs} of every wildcard or elementdeclaration particle in the group's{particles} and the maximumpart of the effective total range of each of the group particles in the group's{particles} (or0 if there are no{particles}).

previous sub-sectionnext sub-section3.9 Particles

        3.9.1The Particle Schema Component
        3.9.2XML Representation of Particle Components
        3.9.3Constraints on XML Representations of Particles
        3.9.4Particle Validation Rules
        3.9.5Particle Information Set Contributions
        3.9.6Constraints on Particle Schema Components

As described inModel Groups (§3.8), particles contribute to the definitionof content models.

Example
<xs:element ref="egg" minOccurs="12" maxOccurs="12"/><xs:group ref="omelette" minOccurs="0"/><xs:any maxOccurs="unbounded"/>
XML representations which all involve particles, illustrating some ofthe possibilities for controlling occurrence.

3.9.1 The Particle Schema Component

The particle schema component has the following properties:

{min occurs}
A non-negativeinteger.
{max occurs}
Either a non-negative integerorunbounded.
{term}
One of a model group, a wildcard, or an element declaration.

In general, multiple elementinformation item[children], possibly with intervening character[children] if the content typeismixed, can be·validated· withrespect to a single particle. When the{term} is an elementdeclaration or wildcard,{min occurs} determines the minimum number of such element[children] that can occur. The number of such children must be greater than or equal to{min occurs}. If{min occurs} is0, then occurrence of such children is optional.

Again, when the{term} is an elementdeclaration or wildcard, the number of such element[children] must be less than or equal to any numeric specification of{max occurs}; if{max occurs} isunbounded, then there is noupper bound on the number of such children.

When the{term} is a model group, the permittedoccurrence range is determined by a combination of{min occurs} and{max occurs} and the occurrence ranges of the{term}'s{particles}.

3.9.2 XML Representation of Particle Components

Particles correspond to all three elements (<element> not immediately within<schema>,<group> not immediately within<schema> and<any>) which allowminOccurs andmaxOccurs attributes. These in turn correspond totwo components in each case, a particle and its{term}. The appropriate mapping is described inXML Representation of Element Declaration Schema Components (§3.3.2),XML Representation of Model Group Schema Components (§3.8.2) andXML Representation of Wildcard Schema Components (§3.10.2) respectively.

3.9.3 Constraints on XML Representations of Particles

None as such.

3.9.4 Particle Validation Rules

Validation Rule: Element Sequence Locally Valid (Particle)
For a sequence (possibly empty) of element information items to belocally·valid·with respect to a particle the appropriatecase among the followingmust be true:
1Ifthe{term} is a wildcard,thenall of the following must be true:
1.1 The length of the sequence must be greater than or equal to the{min occurs}.
1.2 If{max occurs} is a number, the length of the sequence must be less than or equal to the{max occurs}.
1.3 Each elementinformation item in the sequence must be·valid· with respect to the wildcard as defined byItem Valid (Wildcard) (§3.10.4).
2Ifthe{term} is an element declaration,thenall of the following must be true:
2.1 The length of the sequence must be greater than or equal to the{min occurs}.
2.2 If{max occurs} is a number, the length of the sequence must be less than or equal to the{max occurs}.
2.3 For each elementinformation item in the sequenceone of the following must be true:
2.3.1 The element declaration is local (i.e. its{scope} must not beglobal), its{abstract} isfalse, the element informationitem's[namespace name] is identical to the element declaration's{target namespace} (where an·absent·{target namespace} is taken to be identical to a[namespace name] with no value) and the element informationitem's[localname] matches the element declaration's{name}.

In this case the element declaration is the·context-determined declaration· for the element information item with respect toSchema-Validity Assessment (Element) (§3.3.4) andAssessment Outcome (Element) (§3.3.5).

2.3.2 The element declaration is top-level (i.e. its{scope} isglobal),{abstract} isfalse, the element informationitem's[namespace name] is identical to the element declaration's{target namespace} (where an·absent·{target namespace} is taken to be identical to a[namespace name] with no value) and the element informationitem's[localname] matches the element declaration's{name}.

In this case the element declaration is the·context-determined declaration· for the element information item with respect toSchema-Validity Assessment (Element) (§3.3.4) andAssessment Outcome (Element) (§3.3.5).

2.3.3The element declaration is top-level (i.e. its{scope} isglobal), its{disallowed substitutions} does not containsubstitution,the[local] and[namespace name] of the element information item resolve to an element declaration, asdefined inQName resolution (Instance) (§3.15.4) --[Definition:]  call this declaration thesubstituting declaration and the·substituting declaration· together with the particle's element declaration's{disallowed substitutions} is validly substitutable for the particle's element declaration as defined inSubstitution Group OK (Transitive) (§3.3.6).

In this case the·substituting declaration· is the·context-determined declaration· for the element information item with respect toSchema-Validity Assessment (Element) (§3.3.4) andAssessment Outcome (Element) (§3.3.5).

3Ifthe{term} is a model group,thenall of the following must be true:
3.1 There is a·partition· of the sequence inton sub-sequences such thatn is greater than or equal to{min occurs}.
3.2 If{max occurs} is a number,nmust be less than or equal to{max occurs}.
3.3 Each sub-sequence in the·partition· is·valid· with respect to that model group as defined inElement Sequence Valid (§3.8.4).
Note: Clauses clause1 and clause2.3.3 do notinteract: an element information item validatable by a declaration with a substitution group head in adifferent namespace isnot validatable by a wildcard which acceptsthe head's namespace but not its own.

3.9.5 Particle Information Set Contributions

None as such.

3.9.6 Constraints on Particle Schema Components

All particles (seeParticles (§3.9)) must satisfy the following constraints.

Schema Component Constraint: Particle Correct
All of the following must be true:
2 If{max occurs} is notunbounded, that is, it has anumeric value, thenall of the following must be true:
2.1{min occurs} must not be greater than{max occurs}.
2.2{max occurs} must be greater than or equal to 1.

The following constraints define relations appealed to elsewhere in this specification.

Schema Component Constraint: Particle Valid (Extension)
[Definition:]  For a particle(call itE, for extension) to be avalid extension ofanother particle (call itB, for base)one of the following must be true:
1 They are the same particle.
2E's{min occurs}={max occurs}=1 and its{term} is asequence group whose{particles}' first member is a particle all of whose properties, recursively, are identical to those ofB, with the exception of{annotation} properties.

The approach to defining a type by restricting another type definitionset out here is designed to ensure that types defined in this way areguaranteed to be a subset of the type they restrict. This is accomplished byrequiring a clear mapping between the components of the base type definition and therestricting type definition. Permissible mappings are set out below via a setof recursive definitions, bottoming out in the obvious cases, e.g. where an(restricted) element declaration corresponds to another (base) elementdeclaration with the same name and type but the same or wider range of occurrence.

Note: The structural correspondence approach to guaranteeing the subsetrelation set out here is necessarily verbose, but has the advantage of beingcheckable in a straightforward way. The working group solicits feedback on howdifficult this is in practice, and on whether other approaches are found to be viable.
Schema Component Constraint: Particle Valid (Restriction)
[Definition:]  For a particle (call itR, for restriction) to be avalid restriction ofanother particle (call itB, for base)one of the following must be true:
1 They are the same particle.
2 depending on the kind of particle, per the table below, with thequalifications thatall of the following must be true:
2.1 Any top-level element declaration particle (inR orB) which is the{substitution group affiliation} of one or more other element declarationsand whose·substitution group·contains at least one element declaration other than itself istreated as if it were achoice group whose{min occurs} and{max occurs} are those of the particle, and whose{particles} consists ofone particle with{min occurs} and{max occurs} of1 for each of the declarations in its·substitution group·.
2.2 Any pointless occurrences of<sequence>,<choice> or<all> are ignored, where pointlessness is understood as follows:
<sequence>
One of the following must be true:
2.2.1{particles} is empty.
2.2.2All of the following must be true:
2.2.2.1 The particle within which this<sequence>appears has{max occurs} and{min occurs} of1.
2.2.2.2One of the following must be true:
2.2.2.2.1 The<sequence>'s{particles}has only one member.
2.2.2.2.2 The particle within which this<sequence>appears is itself among the{particles} of a<sequence>.
<all>
One of the following must be true:
2.2.1{particles} is empty.
2.2.2{particles} has only one member.
<choice>
One of the following must be true:
2.2.1{particles} is empty and theparticle within which this<choice> appears has{min occurs} of0.
2.2.2All of the following must be true:
2.2.2.1 The particle within which this<choice>appears has{max occurs} and{min occurs} of1.
2.2.2.2One of the following must be true:
2.2.2.2.1 The<choice>'s{particles}has only one member.
2.2.2.2.2 The particle within which this<choice>appears is itself among the{particles} of a<choice>.
Base Particle
eltanyallchoicesequence
Derived ParticleeltNameAnd- TypeOKNSCompatRecurse- AsIfGroupRecurse- AsIfGroupRecurseAs- IfGroup
anyForbiddenNSSubsetForbiddenForbiddenForbidden
allForbiddenNSRecurse- CheckCardinalityRecurseForbiddenForbidden
choiceForbiddenNSRecurse- CheckCardinalityForbiddenRecurseLaxForbidden
seq- uenceForbiddenNSRecurse- CheckCardinalityRecurse- UnorderedMapAndSumRecurse
Schema Component Constraint: Occurrence Range OK
For a particle's occurrence range to be a valid restriction of another'soccurrence rangeall of the following must be true:
1 Its{min occurs} is greater than or equal to theother's{min occurs}.
2one of the following must be true:
2.1 The other's{max occurs} isunbounded.
2.2 Both{max occurs} are numbers, and the particle's is less than or equal to theother's.
Schema Component Constraint: Particle Restriction OK (Elt:Elt -- NameAndTypeOK)
For an element declaration particle to be a·valid restriction· of another element declaration particleall of the following must be true:
1 The declarations'{name}s and{target namespace}s are the same.
2R's occurrence range is a validrestriction ofB's occurrence range as defined byOccurrence Range OK (§3.9.6).
3One of the following must be true:
3.1 BothB's declaration's{scope} andR's declaration's{scope} areglobal.
3.2All of the following must be true:
3.2.1 EitherB's{nillable} istrue orR's{nillable} isfalse.
3.2.2 eitherB's declaration's{value constraint} isabsent, or isnotfixed, orR's declaration's{value constraint} isfixed with the same value.
3.2.3R's declaration's{identity-constraint definitions} isa subset ofB's declaration's{identity-constraint definitions},if any.
3.2.4R's declaration's{disallowed substitutions} isa superset ofB's declaration's{disallowed substitutions}.
3.2.5R's{type definition} is validly derived given{extension,list,union} fromB's{type definition} as defined byType Derivation OK (Complex) (§3.4.6) orType Derivation OK (Simple) (§3.14.6), as appropriate.
Note: The above constraint on{type definition} means that inderiving a type by restriction, any contained type definitions must themselves beexplicitly derived by restriction from the corresponding type definitions in thebase definition, or be one of the member types of acorresponding union..
Schema Component Constraint: Particle Derivation OK (Elt:Any -- NSCompat)
For an element declaration particle to be a·valid restriction· of a wildcard particleall of the following must be true:
1 The element declaration's{target namespace} is·valid· with respect to the wildcard's{namespace constraint} asdefined byWildcard allows Namespace Name (§3.10.4).
2R's occurrence range is a validrestriction ofB's occurrence range as defined byOccurrence Range OK (§3.9.6).
Schema Component Constraint: Particle Derivation OK (Elt:All/Choice/Sequence -- RecurseAsIfGroup)
For an element declaration particle to be a·valid restriction· of a group particle (all,choice orsequence)a group particle of the variety corresponding toB's, with{min occurs} and{max occurs} of1 and with{particles} consisting of a single particlethe same as the element declaration must be a·valid restriction· of the group as defined byParticle Derivation OK (All:All,Sequence:Sequence -- Recurse) (§3.9.6),Particle Derivation OK (Choice:Choice -- RecurseLax) (§3.9.6) orParticle Derivation OK (All:All,Sequence:Sequence -- Recurse) (§3.9.6), depending on whether the group isall,choice orsequence.
Schema Component Constraint: Particle Derivation OK (Any:Any -- NSSubset)
For a wildcard particle to be a·valid restriction· of another wildcard particleall of the following must be true:
1R's occurrence range must be a validrestriction ofB's occurrence range as defined byOccurrence Range OK (§3.9.6).
2R's{namespace constraint} must be an intensionalsubset ofB's{namespace constraint} as defined byWildcard Subset (§3.10.6).
3 UnlessB is the content model wildcard ofthe·ur-type definition·,R's{process contents} must be identicalto or stronger thanB's{process contents}, wherestrict is stronger thanlax is stronger thanskip.

Note:

The exception to the third clause above for derivations fromthe
·ur-type definition· is necessary asits wildcards have a{process contents} oflax, sowithout this exception, no use of wildcards with{process contents} ofskip would be possible.
Schema Component Constraint: Particle Derivation OK (All/Choice/Sequence:Any -- NSRecurseCheckCardinality)
For a group particle to be a·valid restriction· of a wildcard particleall of the following must be true:
1 Every member of the{particles} of the group is a·valid restriction· of the wildcardas defined byParticle Valid (Restriction) (§3.9.6).
2 The effective total range of the group, as defined byEffective Total Range (all and sequence) (§3.8.6) (ifthe group isall orsequence) orEffective Total Range (choice) (§3.8.6) (if it ischoice) is a validrestriction ofB's occurrence range as defined byOccurrence Range OK (§3.9.6).
Schema Component Constraint: Particle Derivation OK (All:All,Sequence:Sequence -- Recurse)
For anall orsequence group particle to be a·valid restriction· of another group particle with the same{compositor}all of the following must be true:
1R's occurrence range is a validrestriction ofB's occurrence range as defined byOccurrence Range OK (§3.9.6).
2 There is a complete·order-preserving· functional mapping from the particles in the{particles} ofR to the particles in the{particles} ofB such thatall of the following must be true:
2.1 Each particle in the{particles} ofR is a·valid restriction· of theparticle in the{particles} ofB it maps to as definedbyParticle Valid (Restriction) (§3.9.6).
2.2 All particles in the{particles} ofB whichare not mapped to by any particle in the{particles} ofRare·emptiable· as defined byParticle Emptiable (§3.9.6).
Note: Although the·validation· semantics of anall group does notdepend on the order of its particles, derivedall groups are required tomatch the order of their base in order to simplify checking that the derivation is OK.
[Definition:]  A complete functional mapping isorder-preserving if each particler in the domainR maps to aparticleb in the rangeB which follows (not necessarilyimmediately) the particle in the rangeB mapped to by the predecessor ofr, if any, where"predecessor" and "follows" are defined with respectto the order of the lists which constituteR andB.
Schema Component Constraint: Particle Derivation OK (Choice:Choice -- RecurseLax)
For achoice group particle to be a·valid restriction· of anotherchoice group particleall of the following must be true:
1R's occurrence range is a validrestriction ofB's occurrence range as defined byOccurrence Range OK (§3.9.6);
2 There is a complete·order-preserving· functional mapping from the particles in the{particles} ofR to the particles in the{particles} ofB such that each particle in the{particles} ofR is a·valid restriction· of theparticle in the{particles} ofB it maps to as definedbyParticle Valid (Restriction) (§3.9.6).
Note: Although the·validation· semantics of achoice group does notdepend on the order of its particles, derivedchoice groups arerequired tomatch the order of their base in order to simplify checking that the derivation is OK.
Schema Component Constraint: Particle Derivation OK (Sequence:All -- RecurseUnordered)
For asequence group particle to be a·valid restriction· of anall group particleall of the following must be true:
1R's occurrence range is a validrestriction ofB's occurrence range as defined byOccurrence Range OK (§3.9.6).
2 There is a complete functional mapping from the particles in the{particles} ofR to the particles in the{particles} ofB such thatall of the following must be true:
2.1 No particle in the{particles} ofB is mappedto by more than one of the particles in the{particles} ofR;
2.2 Each particle in the{particles} ofR is a·valid restriction· of theparticle in the{particles} ofB it maps to as definedbyParticle Valid (Restriction) (§3.9.6);
2.3 All particles in the{particles} ofB whichare not mapped to by any particle in the{particles} ofRare·emptiable· as defined byParticle Emptiable (§3.9.6).
Note: Although this clause allows reordering, because of the limits on thecontents ofall groups the checking process can still be deterministic.
Schema Component Constraint: Particle Derivation OK (Sequence:Choice -- MapAndSum)
For asequence group particle to be a·valid restriction· of achoice group particleall of the following must be true:
1 There is a complete functional mapping from the particles in the{particles} ofR to the particles in the{particles} ofB such that each particle in the{particles} ofR is a·valid restriction· of theparticle in the{particles} ofB it maps to as definedbyParticle Valid (Restriction) (§3.9.6).
2 The pair consisting of the product of the{min occurs} ofR and the length of its{particles} andunbounded if{max occurs} isunbounded otherwise the product of the{max occurs} ofR and the length of its{particles} is a validrestriction ofB's occurrence range as defined byOccurrence Range OK (§3.9.6).
Note: This clause is in principle more restrictive than absolutelynecessary, but in practice will cover all the likely cases, and is much easierto specify than the fully general version.
Note: This case allows the "unfolding" of iterated disjunctionsinto sequences. It may be particularly useful when the disjunction is animplicit one arising from the use of substitution groups.
Schema Component Constraint: Particle Emptiable
[Definition:]  For a particle to beemptiableone of the following must be true:
1 Its{min occurs} is0.
2 Its{term} is a group and the minimum part of theeffective total range of that group, as defined byEffective Total Range (all and sequence) (§3.8.6) (ifthe group isall orsequence) orEffective Total Range (choice) (§3.8.6) (if it ischoice), is0.

previous sub-sectionnext sub-section3.10 Wildcards

        3.10.1The Wildcard Schema Component
        3.10.2XML Representation of Wildcard Schema Components
        3.10.3Constraints on XML Representations of Wildcards
        3.10.4Wildcard Validation Rules
        3.10.5Wildcard Information Set Contributions
        3.10.6Constraints on Wildcard Schema Components

In order to exploit the full potential for extensibility offered by XMLplus namespaces, more provision is needed than DTDs allow for targeted flexibility in contentmodels and attribute declarations. A wildcard provides for·validation· ofattribute and element information items dependent on their namespacename, but independently of their local name.

Example
<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"/>
XML representations of the four basic types of wildcard, plus one attribute wildcard.

3.10.1 The Wildcard Schema Component

The wildcard schema component has the following properties:

{namespace constraint}
One ofany; a pair ofnot and a namespace nameor·absent·; or a set whosemembers are either namespace names or·absent·.
{process contents}
One ofskip,lax orstrict.
{annotation}
Optional. An annotation.

{namespace constraint} provides for·validation· of attribute and element items that:

  1. (any) have any namespace or are not namespace-qualified;
  2. (not and a namespace name) are namespace-qualified with a namespaceother than the specified namespace name;
  3. (not and·absent·) are namespace-qualified;
  4. (a set whosemembers are either namespace names or·absent·) have any of thespecified namespaces and/or, if·absent· is included in the set, are unqualified.

{process contents} controls the impact on·assessment·of the information items allowed by wildcards, as follows:

strict
There must be a top-level declaration for the item available, or the itemmust have anxsi:type, and the itemmust be·valid· as appropriate.
skip
No constraints at all: the item must simply be well-formed XML.
lax
If the item has a uniquelydetermined declaration available, it must be·valid· with respect tothat definition, that is,·validate·if youcan, don't worry if you can't.

SeeAnnotations (§3.13) for information on the role of the{annotation} property.

3.10.2 XML Representation of Wildcard Schema Components

The XML representation for a wildcard schema component is an<any> or<anyAttribute> element information item. The correspondences between theproperties of an<any> information item andproperties of the components it corresponds to are as follows (see<complexType> and<attributeGroup> for the correspondences for<anyAttribute>):

XML Representation Summaryany Element Information Item

<any
  id =ID
  maxOccurs = (nonNegativeInteger |unbounded)  : 1
  minOccurs =nonNegativeInteger : 1
  namespace = ((##any |##other) | List of (anyURI | (##targetNamespace |##local)) )  : ##any
  processContents = (lax |skip |strict) : strict
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?)
</any>

A particle containing a wildcard, with properties as follows (unlessminOccurs=maxOccurs=0, in which case the itemcorresponds to no component at all):
Particle Schema Component
PropertyRepresentation
{min occurs}The·actual value· of theminOccurs[attribute], if present, otherwise1.
{max occurs}unbounded, if themaxOccurs[attribute] equalsunbounded, otherwise the·actual value· of themaxOccurs[attribute], if present, otherwise1.
{term}A wildcard as given below:
Wildcard Schema Component
PropertyRepresentation
{namespace constraint}Dependent on the·actual value· of thenamespace[attribute]: if absent, thenany, otherwise as follows:
##any
any
##other
a pair ofnot and the·actual value· of thetargetNamespace[attribute] of the<schema> ancestorelement information item if present, otherwise·absent·.
otherwise
a set whose members are namespace names corresponding to thespace-delimited substrings of the string, except
1 if one suchsubstring is##targetNamespace, the corresponding member is the·actual value· of thetargetNamespace[attribute] of the<schema> ancestorelement information item if present, otherwise·absent·.
2 if one suchsubstring is##local, the corresponding member is·absent·.
{process contents}The·actual value· of theprocessContents[attribute], if present, otherwisestrict.
{annotation}The annotation corresponding to the<annotation> element information item in the[children], if present, otherwise·absent·.

Wildcards are subject to the same ambiguity constraints(Unique Particle Attribution (§3.8.6)) as othercontent model particles: If an instance element could match either an explicitparticle and a wildcard, or one of two wildcards, within the content model of atype, that model is in error.

3.10.3 Constraints on XML Representations of Wildcards

Schema Representation Constraint: Wildcard Representation OK
In addition to the conditions imposed on<any> elementinformation items by the schema for schemas, the corresponding particle and model group must satisfy the conditions setout inConstraints on Model Group Schema Components (§3.8.6) andConstraints on Particle Schema Components (§3.9.6).

3.10.4 Wildcard Validation Rules

Validation Rule: Item Valid (Wildcard)
For an element or attribute information item to be locally·valid· with respect to a wildcardconstraint its[namespace name] must be·valid· with respect to the wildcard constraint, as defined inWildcard allows Namespace Name (§3.10.4).

When this constraint applies the appropriatecase among the followingmust be true:

Validation Rule: Wildcard allows Namespace Name
For a value which is either a namespace name or·absent· to be·valid· with respect to a wildcard constraint (thevalue of a{namespace constraint})one of the following must be true:
1 The constraint must beany.
2All of the following must be true:
2.1 The constraint is a pair ofnot and a namespace name or·absent· ([Definition:]  call this thenamespace test).
2.2 The value must not be identical to the·namespace test·.
2.3 The value must not be·absent·.
3 The constraint is a set, and the value is identical to one of the members of the set.

3.10.5 Wildcard Information Set Contributions

None as such.

3.10.6 Constraints on Wildcard Schema Components

All wildcards (seeWildcards (§3.10)) must satisfy the following constraint.

Schema Component Constraint: Wildcard Properties Correct

The following constraints define a relation appealed to elsewhere in this specification.

Schema Component Constraint: Wildcard Subset
For a namespace constraint (call itsub) to be an intensional subset ofanother namespace constraint (call itsuper)one of the following must be true:
1super must beany.
3All of the following must be true:
3.1sub must be a set whose members are either namespace names or·absent·.
3.2One of the following must be true:
3.2.1super must be the same set or a superset thereof.
3.2.2super must be a pair ofnot and a value (a namespace name or·absent·)and neither that value nor·absent· must be insub's set.
Schema Component Constraint: Attribute Wildcard Union
For a wildcard's{namespace constraint} value to be the intensionalunion of two other such values (call themO1 andO2): the appropriatecase among the followingmust be true:
1IfO1 andO2 are the same value,thenthat value must be the value.
2IfeitherO1 orO2 isany,thenany must be the value.
3IfbothO1 andO2 are sets of (namespace namesor·absent·),thenthe union of those sets must be the value.
4Ifthe two are negations of different values (namespace names or·absent·),thena pair ofnot and·absent· must be the value.
5IfeitherO1 orO2 is a pair ofnotand a namespace name and the other is a set of (namespace names or·absent·) (call this setS),then The appropriatecase among the followingmust be true:
5.1Ifthe setS includes both the negated namespace name and·absent·,thenany must be the value.
5.2Ifthe setS includes the negated namespace name but not·absent·,thena pair ofnot and·absent· must be the value.
5.3Ifthe setS includes·absent·but not the negated namespace name,thenthe union is not expressible.
5.4Ifthe setS does not include either the negated namespacename or·absent·,thenwhichever ofO1 orO2 is a pair ofnotand a namespace name must be the value.
6IfeitherO1 orO2 is a pair ofnotand·absent· and the other is a set of(namespace names or·absent·) (again, call thissetS),then The appropriatecase among the followingmust be true:
6.1Ifthe setS includes·absent·,thenany must be the value.
6.2Ifthe setS does not include·absent·,thena pair ofnot and·absent· must be the value.
In the case where there are more than two values, the intensionalunion is determined by identifying the intensional union of twoof the values as above, then the intensional union of that value withthe third (providing the first union was expressible), and so on as required.
Schema Component Constraint: Attribute Wildcard Intersection
For a wildcard's{namespace constraint} value to be the intensionalintersection of two other such values (call themO1 andO2): the appropriatecase among the followingmust be true:
1IfO1 andO2 are the same value,thenthat value must be the value.
2IfeitherO1 orO2 isany,thentheother must be the value.
3IfeitherO1 orO2 is a pair ofnotand a value (a namespace name or·absent·) and the other is a set of (namespace names or·absent·),thenthat set,minus the negated value if it was in the set, minus·absent· if it was in the set, must be the value.
4IfbothO1 andO2 are sets of (namespace namesor·absent·),thenthe intersection of those sets must be the value.
5Ifthe two are negations of different namespace names,thenthe intersection is not expressible.
6Ifthe one is a negation of a namespace name and the other is anegation of·absent·,thenthe one which is the negation of a namespace name must be the value.
In the case where there are more than two values, the intensionalintersection is determined by identifying the intensional intersection of twoof the values as above, then the intensional intersection of that value withthe third (providing the first intersection was expressible), and so on as required.

previous sub-sectionnext sub-section3.11 Identity-constraint Definitions

        3.11.1The Identity-constraint Definition Schema Component
        3.11.2XML Representation of Identity-constraint Definition Schema Components
        3.11.3Constraints on XML Representations of Identity-constraint Definitions
        3.11.4Identity-constraint Definition Validation Rules
        3.11.5Identity-constraint Definition Information Set Contributions
        3.11.6Constraints on Identity-constraint Definition Schema Components

Identity-constraint definition components provide for uniqueness andreference constraints with respect to the contents of multiple elements and attributes.

Example
<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>
XML representations for the three kinds of identity-constraint definitions.

3.11.1 The Identity-constraint Definition Schema Component

The identity-constraint definition schema component has the followingproperties:

{name}
An NCName as defined by[XML-Namespaces].
{target namespace}
Either·absent· or a namespace name, as defined in[XML-Namespaces].
{identity-constraint category}
One ofkey,keyref orunique.
{selector}
A restricted XPath ([XPath]) expression.
{fields}
A non-empty list of restricted XPath ([XPath]) expressions.
{referenced key}
Required if{identity-constraint category} iskeyref, forbiddenotherwise. An identity-constraint definition with{identity-constraint category}equal tokey orunique.
{annotation}
Optional. A set of annotations.

Identity-constraint definitions are identified by their{name} and{target namespace}; Identity-constraint definition identities must be unique within an·XML Schema·. SeeReferences to schema components across namespaces (§4.2.3) for the use of componentidentifiers when importing one schema into another.

Informally,{identity-constraint category} identifies the Identity-constraint definition as playing one ofthree roles:

  • (unique) the Identity-constraint definition asserts uniqueness, with respect to the contentidentified by{selector}, of the tuples resulting fromevaluation of the{fields} XPath expression(s).
  • (key) the Identity-constraint definition asserts uniqueness as forunique.key further asserts that all selected contentactually has such tuples.
  • (keyref) the Identity-constraint definition asserts a correspondence, with respect to the contentidentified by{selector}, of the tuples resulting fromevaluation of the{fields} XPath expression(s), with those of the{referenced key}.

These constraints are specified along side the specification of types for theattributes and elements involved, i.e. something declared as of type integermay also serve as a key. Each constraint declaration has a name, which exists in asingle symbol space for constraints. The equality and inequality conditionsappealed to in checking these constraints apply to thevalue ofthe fields selected, so that for example3.0 and3would be conflicting keys if they were both number, but non-conflicting ifthey were both strings, or one was a string and one a number. Values ofdiffering type can only be equal if one type is derived from the other, and thevalue is in the value space of both.

Overall the augmentations to XML'sID/IDREF mechanism are:

  • Functioning as a part of an identity-constraint is in addition to, not instead of,having a type;
  • Not just attribute values, but also element content and combinationsof values and content can be declared to be unique;
  • Identity-constraints are specified to hold within the scope of particular elements;
  • (Combinations of) attribute values and/or element content can bedeclared to be keys, that is, not only unique, but always present and non-nillable;
  • The comparison betweenkeyref{fields} andkey orunique{fields} is by value equality,not by string equality.

{selector} specifies a restricted XPath ([XPath]) expression relative toinstances of the element being declared. This must identify a node set ofsubordinate elements (i.e. contained within the declared element) to which the constraint applies.

{fields} specifies XPath expressions relative to eachelement selected by a{selector}. This must identifya single node (element or attribute) whose content or value, which must beof a simple type, is used in the constraint. It is possible to specify anordered list of{fields}s, to cater to multi-field keys,keyrefs, and uniqueness constraints.

In order to reduce the burden on implementers, in particularimplementers of streaming processors, only restricted subsets of XPathexpressions are allowed in{selector} and{fields}. The details are given inConstraints on Identity-constraint Definition Schema Components (§3.11.6).

Note: Provision for multi-field keys etc. goes beyond what is supported byxsl:key.

SeeAnnotations (§3.13) for information on the role of the{annotation} property.

3.11.2 XML Representation of Identity-constraint Definition Schema Components

The XML representation for an identity-constraint definition schema component iseither a<key>, a<keyref> or a<unique>element information item. The correspondences between theproperties of those information items andproperties of the component they correspond to are as follows:

XML Representation Summaryunique Element Information Item

<unique
  id =ID
  name =NCName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (selector,field+))
</unique>

<key
  id =ID
  name =NCName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (selector,field+))
</key>

<keyref
  id =ID
  name =NCName
  refer =QName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (selector,field+))
</keyref>

<selector
  id =ID
  xpath =a subset of XPath expression, see below
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?)
</selector>

<field
  id =ID
  xpath =a subset of XPath expression, see below
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?)
</field>

Identity-constraint Definition Schema Component
PropertyRepresentation
{name}The·actual value· of thename[attribute]
{target namespace}The·actual value· of thetargetNamespace[attribute] of the parentschemaelement information item.
{identity-constraint category}One ofkey,keyref orunique, depending on the item.
{selector}A restricted XPath expression corresponding to the·actual value· ofthexpath[attribute] of the<selector> element information item among the[children]
{fields}A sequence of XPath expressions, corresponding to the·actual value·s of thexpath[attribute]s of the<field> element information item[children], in order.
{referenced key}If the item is a<keyref>, theidentity-constraint definition·resolved· to by the·actual value· of therefer[attribute], otherwise·absent·.
{annotation}The annotations corresponding to the<annotation> element information item in the[children], if present, and in the<selector> and<field>[children], if present, otherwise·absent·.
Example
<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>
Astate element is defined, whichcontains acode child and somevehicle andpersonchildren. Avehicle in turn has aplateNumber attribute,which is an integer, and astate attribute. State'scodes are a key for them within the document. Vehicle'splateNumbers are a key for them within states, andstate andplateNumber is asserted to be akey forvehicle within the document as a whole. Furthermore, aperson element hasan emptycar child, withregState andregPlate attributes, which are then asserted together to refer tovehicles via thecarRef constraint. The requirementthat avehicle'sstate match its containingstate'scode is not expressed here.

3.11.3 Constraints on XML Representations of Identity-constraint Definitions

Schema Representation Constraint: Identity-constraint Definition Representation OK
In addition to the conditions imposed on<key>,<keyref> and<unique> elementinformation items by the schema for schemas, the corresponding identity-constraint definition must satisfy the conditions setout inConstraints on Identity-constraint Definition Schema Components (§3.11.6).

3.11.4 Identity-constraint Definition Validation Rules

Validation Rule: Identity-constraint Satisfied
For an element information item to be locally·valid· with respect to an identity-constraintall of the following must be true:
1 The{selector}, with the element information item as thecontext node, evaluates to a node-set (as defined in[XPath]).[Definition:]  Call this thetarget node set.
2 Each node in the·target node set· iseither the context node oranelement node among its descendants.
3 For each node in the·target node set· all of the{fields}, with that node as the contextnode, evaluate to either an empty node-set or a node-set with exactly onemember, which must have a simple type.[Definition:]  Call the sequence of thetype-determined values (as defined in[XML Schemas: Datatypes]) of the[schema normalized value] of the element and/or attribute information items in those node-sets in order thekey-sequence of the node.
4[Definition:]  Call the subset of the·target node set· forwhich all the{fields} evaluate to a node-set with exactly onemember which is an element or attribute node with a simple type thequalified node set. The appropriatecase among the followingmust be true:
4.1Ifthe{identity-constraint category} isunique,thenno two members of the·qualified nodeset· have·key-sequences· whose membersare pairwise equal, as defined byEqual in[XML Schemas: Datatypes].
4.2Ifthe{identity-constraint category} iskey,thenall of the following must be true:
4.2.1 The·target node set· and the·qualified nodeset· are equal, that is, every member of the·target node set· is also a member of the·qualified nodeset· andvice versa.
4.2.2 No two members of the·qualified nodeset· have·key-sequences· whose membersare pairwise equal, as defined byEqual in[XML Schemas: Datatypes].
4.2.3No element member of the·key-sequence· of anymember of the·qualified nodeset· was assessed as·valid· by reference to an elementdeclaration whose{nillable} istrue.
4.3Ifthe{identity-constraint category} iskeyref,thenfor each member of the·qualified nodeset· (call this thekeyref member), there must be a·node table· associated with the{referenced key} in the[identity-constraint table]of the element information item (seeIdentity-constraint Table (§3.11.5), which must beunderstood as logically prior to this clause of this constraint, below) andthere must be an entry in that table whose·key-sequence· is equal to thekeyref member's·key-sequence· member formember, as defined byEqual in[XML Schemas: Datatypes].
Note: The use of[schema normalized value] in the definitionof·key sequence· above means thatdefault orfixed value constraints may play a part in·key sequence·s.
Note: Because the validation ofkeyref (see clause4.3) depends on findingappropriate entries in a element information item's·nodetable·, and·node tables· are assembledstrictly recursively from the node tables of descendants, only elementinformation items within the sub-tree rooted at the element information itembeing·validated· can be referenced successfully.
Note: Although this specification defines a·post-schema-validation infoset·contribution which would enable schema-aware processors to implement clause4.2.3 above (Element Declaration (§3.3.5)), processors are not required toprovide it. This clause can be read as if in the absence of this infoset contribution, thevalue of the relevant{nillable} property must be available.

3.11.5 Identity-constraint Definition Information Set Contributions

Schema Information Set Contribution: Identity-constraint Table
[Definition:]  Aneligibleidentity-constraint of an element information item is one such that clause4.1 or clause4.2 ofIdentity-constraint Satisfied (§3.11.4) is satisfiedwith respect to that item and that constraint,or such that any of the element information item[children] of that item have an[identity-constraint table] property whose value has an entry for that constraint.

[Definition:]  Anode table is a setof pairs each consisting ofa·key-sequence· and an element node.

Whenever an element information item has one or more·eligible identity-constraints·, in the·post-schema-validation infoset· that element information item has a property as follows:

PSVI Contributionsfor element information items
[identity-constraint table]
oneIdentity-constraint Bindinginformation item for each·eligible identity-constraint·, withproperties as follows:
PSVI Contributionsfor Identity-constraint Binding information items
[definition]
The·eligible identity-constraint·.
[node table]
A·node table· with one entry for every·key-sequence· (call itk) and node (call itn) such thatone of the following must be true:
1There is an entry in one of the·nodetables· associated with the[definition] in anIdentity-constraint Bindinginformation item in at least one of the[identity-constraint table]s of the element information item[children] of the elementinformation item whose·key-sequence· isk and whose node isn;
provided no two entries have the same·key-sequence· but distinct nodes. Potential conflicts are resolved by not including any conflicting entries which would have owed their inclusion to clause1 above. Note that if all the conflicting entries arose under clause1 above, this means no entry at all will appear for the offending·key-sequence·.
Note: The complexity of the above arises from the fact thatkeyref identity-constraints may be defined on domains distinct from theembedded domain of the identity-constraint they reference, or the domains may be thesame but self-embedding at some depth. In either case the·nodetable· for the referenced identity-constraint needs to propagate upwards, withconflict resolution.

TheIdentity-constraint Bindinginformation item, unlike others in thisspecification, is essentially an internal bookkeeping mechanism. It is introduced tosupport the definition ofIdentity-constraint Satisfied (§3.11.4) above. Accordingly, conformant processors may, but arenot required to,expose them via[identity-constraint table] properties in the·post-schema-validation infoset·.In other words, the above constraints may be read as saying·validation· ofidentity-constraints proceedsas if such infoset items existed.

3.11.6 Constraints on Identity-constraint Definition Schema Components

All identity-constraint definitions (seeIdentity-constraint Definitions (§3.11)) must satisfy the following constraint.

Schema Component Constraint: Identity-constraint Definition Properties Correct
Schema Component Constraint: Selector Value OK
All of the following must be true:
1 The{selector} must be a valid XPathexpression, as defined in[XPath].
2One of the following must be true:
2.1 It must conform to the following extended BNF:
[1]   Selector   ::=   Path ( '|'Path )*
[2]   Path   ::=   ('.//')?Step ( '/'Step )*
[3]   Step   ::=   '.' |NameTest
[4]   NameTest   ::=   QName | '*' |NCName ':' '*'
2.2 It must be an XPath expression involving thechild axis whose abbreviated form isas given above.
For readability, whitespace may be used in selector XPath expressions even though notexplicitly allowed by the grammar:whitespace may be freely added within patterns before or after anytoken.
[5]   token   ::=   '.' | '/' | '//' | '|' | '@' |NameTest
[6]   whitespace   ::=   S

When tokenizing, the longest possible token is always returned.

Schema Component Constraint: Fields Value OK
All of the following must be true:
1 Each member of the{fields} must be a valid XPathexpression, as defined in[XPath].
2One of the following must be true:
2.1 It must conform to the extended BNF givenabove forSelector, with the following modification:
[7]   Path   ::=   ('.//')? (Step '/' )* (Step | '@'NameTest )
This production differs from the one above in allowing the finalstep to match an attribute node.
2.2 It must be an XPath expression involving thechild and/orattribute axes whose abbreviated form isas given above.
For readability, whitespace may be used in field XPath expressions even though notexplicitly allowed by the grammar:whitespace may be freely added within patterns before or after anytoken.

When tokenizing, the longest possible token is always returned.

previous sub-sectionnext sub-section3.12 Notation Declarations

        3.12.1The Notation Declaration Schema Component
        3.12.2XML Representation of Notation Declaration Schema Components
        3.12.3Constraints on XML Representations of Notation Declarations
        3.12.4Notation Declaration Validation Rules
        3.12.5Notation Declaration Information Set Contributions
        3.12.6Constraints on Notation Declaration Schema Components

Notation declarations reconstruct XML 1.0 NOTATION declarations.

Example
<xs:notation name="jpeg" public="image/jpeg" system="viewer.exe">
The XML representation of a notation declaration.

3.12.1 The Notation Declaration Schema Component

The notation declaration schema component has the followingproperties:

{name}
An NCName as defined by[XML-Namespaces].
{target namespace}
Either·absent· or a namespace name, as defined in[XML-Namespaces].
{system identifier}
Optional if{public identifier} is present. A URI reference.
{public identifier}
Optional if{system identifier} is present. A public identifier, as defined in[XML 1.0 (Second Edition)].
{annotation}
Optional. An annotation.

Notation declarations do not participate in·validation· as such.They are referenced in the course of·validating· strings as members oftheNOTATION simple type.

SeeAnnotations (§3.13) for information on the role of the{annotation} property.

3.12.2 XML Representation of Notation Declaration Schema Components

The XML representation for a notation declaration schema component isa<notation>element information item. The correspondences between theproperties of that information item andproperties of the component it corresponds to are as follows:

XML Representation Summarynotation Element Information Item

<notation
  id =ID
  name =NCName
  public =token
  system =anyURI
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?)
</notation>

Notation Declaration Schema Component
PropertyRepresentation
{name}The·actual value· of thename[attribute]
{target namespace}The·actual value· of thetargetNamespace[attribute] of the parentschemaelement information item.
{system identifier}The·actual value· of thesystem[attribute], if present, otherwise·absent·.
{public identifier}The·actual value· of thepublic[attribute]
{annotation}The annotation corresponding to the<annotation> element information item in the[children], if present, otherwise·absent·.
Example
<xs:notation name="jpeg"             public="image/jpeg" system="viewer.exe" /><xs:element name="picture"> <xs:complexType>  <xs:simpleContent>   <xs:extension base="xs:hexBinary">    <xs:attribute name="pictype">     <xs:simpleType>      <xs:restriction base="xs:NOTATION">       <xs:enumeration value="jpeg"/>       <xs:enumeration value="png"/>       . . .      </xs:restriction>     </xs:simpleType>    </xs:attribute>   </xs:extension>  </xs:simpleContent> </xs:complexType></xs:element><picture pictype="jpeg">...</picture>

3.12.3 Constraints on XML Representations of Notation Declarations

Schema Representation Constraint: Notation Definition Representation OK
In addition to the conditions imposed on<notation> elementinformation items by the schema for schemas, the corresponding notation definition must satisfy the conditions setout inConstraints on Notation Declaration Schema Components (§3.12.6).

3.12.4 Notation Declaration Validation Rules

None as such.

3.12.5 Notation Declaration Information Set Contributions

Schema Information Set Contribution: Validated with Notation
Whenever an attribute information item is·valid· with respect to aNOTATION, in the·post-schema-validation infoset· its parent element information item either has a property as follows:
PSVI Contributionsfor element information items
[notation]
An·item isomorphic· to the notation declaration whose{name} and{target namespace} match the·local name· and·namespace name· (as defined inQName Interpretation (§3.15.3)) of the attribute item's·actual value·
or has a pair of properties as follows:
PSVI Contributionsfor element information items
[notation system]
The value of the{system identifier} of that notation declaration.
[notation public]
The value of the{public identifier} of that notation declaration.
Note: For compatibility, only one such attribute should appear on any givenelement. If more than one such attributedoes appear, which onesupplies the infoset property or properties above is not defined.

3.12.6 Constraints on Notation Declaration Schema Components

All notation declarations (seeNotation Declarations (§3.12)) must satisfy the following constraint.

Schema Component Constraint: Notation Declaration Correct

previous sub-sectionnext sub-section3.13 Annotations

        3.13.1The Annotation Schema Component
        3.13.2XML Representation of Annotation Schema Components
        3.13.3Constraints on XML Representations of Annotations
        3.13.4Annotation Validation Rules
        3.13.5Annotation Information Set Contributions
        3.13.6Constraints on Annotation Schema Components

Annotations provide for human- and machine-targeted annotations ofschema components.

Example
<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>
XML representations of three kinds of annotation.

3.13.1 The Annotation Schema Component

The annotation schema component has the followingproperties:

{application information}
A sequence of element information items.
{user information}
A sequence of element information items.
{attributes}
A sequence of attributeinformation items.

{user information} is intended for human consumption,{application information} for automatic processing. In bothcases, provision is made for an optional URI reference to supplement the localinformation, as the value of thesource attribute of therespective element information items.·Validation· doesnot involve dereferencing these URIs, when present. In the case of{user information}, indication should be given as to the identity of the (human) language used in the contents, using thexml:lang attribute.

{attributes} ensures that when schema authors takeadvantage of the provision for adding attributes from namespaces other than theXML Schema namespace to schema documents, they are available within the componentscorresponding to the element items where such attributes appear.

Annotations do not participate in·validation· as such. Providedan annotation itself satisfies all relevant·SchemaComponent Constraints· itcannot affect the·validation· of element information items.

3.13.2 XML Representation of Annotation Schema Components

Annotation of schemas and schema components, with material for human orcomputer consumption, is provided for by allowing application information andhuman information at the beginning of most major schema elements, and anywhereat the top level of schemas. The XML representation for an annotation schema component isan<annotation>element information item. The correspondences between theproperties of that information item andproperties of the component it corresponds to are as follows:

XML Representation Summaryannotation Element Information Item

<annotation
  id =ID
  {any attributes with non-schema namespace . . .}>
  Content:(appinfo |documentation)*
</annotation>

<appinfo
  source =anyURI
  {any attributes with non-schema namespace . . .}>
  Content:({any})*
</appinfo>

<documentation
  source =anyURI
  xml:lang =language
  {any attributes with non-schema namespace . . .}>
  Content:({any})*
</documentation>

Annotation Schema Component
PropertyRepresentation
{application information}A sequence of the<appinfo> elementinformation items from among the[children], in order, if any, otherwise theempty sequence.
{user information}A sequence of the<documentation> elementinformation items from among the[children], in order, if any, otherwise theempty sequence.
{attributes}A sequence of attribute information items, namelythose allowed by the attribute wildcard in the type definition for the<annotation> item itself or for the enclosing items which correspond to the component within which the annotation component is located.

The annotation component corresponding to the<annotation>element in the example above will have one element item in each of its{user information} and{application information} and one attribute item in its{attributes}.

3.13.3 Constraints on XML Representations of Annotations

Schema Representation Constraint: Annotation Definition Representation OK
In addition to the conditions imposed on<annotation> elementinformation items by the schema for schemas, the corresponding annotation must satisfy the conditions setout inConstraints on Annotation Schema Components (§3.13.6).

3.13.4 Annotation Validation Rules

None as such.

3.13.5 Annotation Information Set Contributions

None as such: the addition of annotations to the·post-schema-validation infoset· iscovered by the·post-schema-validation infoset· contributions of the enclosing components.

3.13.6 Constraints on Annotation Schema Components

All annotations (seeAnnotations (§3.13)) must satisfy the following constraint.

Schema Component Constraint: Annotation Correct

previous sub-sectionnext sub-section3.14 Simple Type Definitions

        3.14.1(non-normative) The Simple Type Definition Schema Component
        3.14.2(non-normative) XML Representation of Simple Type Definition Schema Components
        3.14.3(non-normative) Constraints on XML Representations of Simple Type Definitions
        3.14.4Simple Type Definition Validation Rules
        3.14.5Simple Type Definition Information SetContributions
        3.14.6Constraints on Simple Type DefinitionSchema Components
        3.14.7Built-in Simple Type Definition
Note: This section consists of a combination of non-normative versions ofnormative material from[XML Schemas: Datatypes], for local cross-referencepurposes, and normative material relating to the interface between schemacomponents defined in this specification and the simple type definition component.

Simple type definitions provide for constraining character information item[children] of element and attributeinformation items.

Example
<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>
The XML representation of a simple type definition.

3.14.1 (non-normative) The Simple Type Definition Schema Component

The simple type definition schema component has the following properties:

{name}
Optional. An NCName as defined by[XML-Namespaces].
{target namespace}
Either·absent· or a namespace name, as defined in[XML-Namespaces].
{base type definition}
A simple type definition, which may be the·simple ur-type definition·.
{facets}
A set of constrainingfacets.
{fundamental facets}
A set offundamental facets.
{final}
A subset of {extension,list,restriction,union}.
{variety}
One of {atomic,list,union}. Depending on the value of{variety}, further properties aredefined as follows:
atomic
{primitive type definition}
Abuilt-in primitive simple type definition.
list
{item type definition}
Asimple type definition.
union
{member type definitions}
A non-empty sequence ofsimple type definitions.
{annotation}
Optional. Anannotation.

Simple types are identified by their{name} and{target namespace}. Exceptfor anonymous simple types (those with no{name}), sincetype definitions (i.e. both simple and complex type definitions taken together) must be uniquely identified within an·XMLSchema·, no simple type definition can have the same name as anothersimple or complex type definition. Simple type{name}s and{target namespace}sare provided for reference frominstances (seexsi:type (§2.6.1)), and for use in the XMLrepresentation of schema components(specifically in<element> and<attribute>). SeeReferences to schema components across namespaces (§4.2.3) for the use of componentidentifiers when importing one schema into another.

Note: The{name} of a simple type is notipsofacto the[(local) name] of the element or attribute information items·validated· by that definition. The connection between a name and a type definition is described inElement Declarations (§3.3) andAttribute Declarations (§3.2).

A simple type definition with an empty specification for{final} can be used as the{base type definition} for other types derived by either ofextension or restriction, or as the{item type definition} inthe definition of a list, or in the{member type definitions} ofa union; the explicit valuesextension,restriction,list andunion prevent furtherderivations by extension (to yield a complex type) and restriction (to yield asimple type) and use in constructing lists and unions respectively.

{variety} determines whether the simple type corresponds toanatomic,list orunion type as defined by[XML Schemas: Datatypes].

As described inType Definition Hierarchy (§2.2.1.1), every simple type definition isa·restriction· of some other simpletype (the{base type definition}), which is the·simple ur-type definition· if and only if the typedefinition in question is one of the built-in primitive datatypes, or a list orunion type definition which is not itself derived by restriction from alist or union respectively. Eachatomic type is ultimately a restriction of exactly one suchbuilt-in primitive datatype, which is its{primitive type definition}.

{facets} for each simple type definition are selected from those defined in[XML Schemas: Datatypes]. Foratomic definitions, these are restricted to those appropriate forthe corresponding{primitive type definition}. Therefore, the valuespace and lexical space (i.e. what is·validated· by any atomic simple type) is determined by thepair ({primitive type definition},{facets}).

As specified in[XML Schemas: Datatypes],list simple type definitions·validate· space separated tokens, each ofwhich conforms to a specified simple type definition, the{item type definition}. The item type specifiedmust not itself be alist type, and must be one of the types identified in[XML Schemas: Datatypes] as asuitable item type for a list simple type. In this case the{facets}apply to the list itself, and are restricted to those appropriate for lists.

Aunion simple type definition·validates· strings which satisfy atleast one of its{member type definitions}. As in the case oflist, the{facets}apply to the union itself, and are restricted to those appropriate for unions.

The·simple ur-type definition·mustnot be named as the·base type definition· of any user-defined atomic simple type definitions: as it has no constraining facets, this would be incoherent.

SeeAnnotations (§3.13) for information on the role of the{annotation} property.

3.14.2 (non-normative) XML Representation of Simple Type Definition Schema Components

Note: This section reproduces a version of material from[XML Schemas: Datatypes], for local cross-reference purposes.
XML Representation SummarysimpleType Element Information Item

<simpleType
  final = (#all | List of (list |union |restriction))
  id =ID
  name =NCName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (restriction |list |union))
</simpleType>

<restriction
  base =QName
  id =ID
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?, (simpleType?, (minExclusive |minInclusive |maxExclusive |maxInclusive |totalDigits |fractionDigits |length |minLength |maxLength |enumeration |whiteSpace |pattern)*))
</restriction>

<list
  id =ID
  itemType =QName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?,simpleType?)
</list>

<union
  id =ID
  memberTypes = List ofQName
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?,simpleType*)
</union>

Simple Type Definition Schema Component
PropertyRepresentation
{name}The·actual value· of thename[attribute] if present, otherwise·absent·.
{target namespace}The·actual value· of thetargetNamespace[attribute] of the<schema> ancestorelement information item if present, otherwise·absent·.
{base type definition} The appropriatecase among the following:
1Ifthe<restriction> alternative is chosen,thenthe type definition·resolved· to by the·actual value· of thebase[attribute] of<restriction>, if present, otherwise thetype definition corresponding to the<simpleType> amongthe[children] of<restriction>.
2Ifthe<list> or<union> alternative is chosen,thenthe·simple ur-type definition·.
{final}As for the{prohibited substitutions} property ofcomplex type definitions, but using thefinal andfinalDefault[attributes] in place of theblock andblockDefault[attributes] and with therelevant set being{extension,restriction,list,union}.
{variety}If the<list> alternative is chosen,thenlist, otherwise if the<union> alternative ischosen, thenunion, otherwise (the<restriction>alternative is chosen), then the{variety} of the{base type definition}.
If the{variety} isatomic, the followingadditional property mappings also apply:
Atomic Simple Type Definition Schema Component
PropertyRepresentation
{primitive type definition}The built-in primitive typedefinition from which the{base type definition} is derived.
{facets}A set of facet components·constituting a restriction·of the{facets} of the{base type definition} with respect to aset of facet components corresponding to the appropriate element information items among the[children] of<restriction> (i.e. those which specify facets, if any), asdefined inSimple Type Restriction (Facets) (§3.14.6).
If the{variety} islist, the followingadditional property mappings also apply:
List Simple Type Definition Schema Component
PropertyRepresentation
{item type definition} The appropriatecase among the following:
1Ifthe<list> alternative is chosen,thenthe type definition·resolved· to by the·actual value· of theitemType[attribute] of<list>, if present, otherwise thetype definition corresponding to the<simpleType> amongthe[children] of<list>.
2Ifthe<restriction> option is chosen,thenthe{item type definition} of the{base type definition}.
{facets}If the<restriction> alternative ischosen, a set of facet components·constituting a restriction·of the{facets} of the{base type definition} with respect to aset of facet components corresponding to the appropriate element information items among the[children] of<restriction> (i.e. those which specify facets, if any), asdefined inSimple Type Restriction (Facets) (§3.14.6), otherwise the empty set.
If the{variety} isunion, the followingadditional property mappings also apply:
Union Simple Type Definition Schema Component
PropertyRepresentation
{member type definitions}The appropriatecase among the following:
1Ifthe<union> alternative is chosen,then[Definition:]  define theexplicit members as the type definitions·resolved· to by theitems in the·actual value· of thememberTypes[attribute], if any, followed by thetype definitions corresponding to the<simpleType>s among the[children] of<union>, if any. The actual value is then formed by replacing any union type definitionin the·explicit members· with the members oftheir{member type definitions}, in order.
{facets}If the<restriction> alternative ischosen, a set of facet components·constituting a restriction·of the{facets} of the{base type definition} with respect to aset of facet components corresponding to the appropriate element information items among the[children] of<restriction> (i.e. those which specify facets, if any), asdefined inSimple Type Restriction (Facets) (§3.14.6), otherwise the empty set.

3.14.3 Constraints on XML Representations of Simple Type Definitions

Schema Representation Constraint: Simple Type Definition Representation OK
In addition to the conditions imposed on<simpleType> elementinformation items by the schema for schemas,all of the following must be true:
1 The corresponding simple type definition, if any, must satisfy the conditions setout inConstraints on Simple Type DefinitionSchema Components (§3.14.6).
2 If the<restriction> alternative is chosen, eitherit must have abase[attribute] or a<simpleType>among its[children], but not both.
3 If the<list> alternative is chosen, eitherit must have anitemType[attribute] or a<simpleType>among its[children], but not both.
4 Circular union type definition is disallowed. That is, if the<union> alternative is chosen, there must not be any entries in thememberTypes[attribute] at any depth which resolve to the component corresponding to the<simpleType>.

3.14.4 Simple Type Definition Validation Rules

Validation Rule: String Valid
For a string to be locally·valid· with respect to a simple type definitionall of the following must be true:
1 It is schema-valid with respect to that definition as defined byDatatype Valid in[XML Schemas: Datatypes].
2 The appropriatecase among the followingmust be true:
2.1IfThe definition isENTITY or is validlyderived fromENTITY given the empty set,as defined inType Derivation OK (Simple) (§3.14.6),thenthe string must be a·declaredentity name·.
2.2IfThe definition isENTITIES or is validlyderived fromENTITIES given the empty set,as defined inType Derivation OK (Simple) (§3.14.6),thenevery whitespace-delimited substring of the string must be a·declaredentity name·.
2.3otherwiseno further condition applies.

[Definition:]  A string is adeclared entity name if it is equal to the[name] of some unparsed entityinformation item in the value of the[unparsedEntities] property of the document information itemat the root of the infoset containing the element or attribute information itemwhose·normalized value· the string is.

3.14.5 Simple Type Definition Information SetContributions

None as such.

3.14.6 Constraints on Simple Type DefinitionSchema Components

All simple type definitions other than the·simple ur-typedefinition· and the built-in primitive datatype definitions (seeSimple Type Definitions (§3.14)) must satisfy both the following constraints.

Schema Component Constraint: Simple Type Definition Properties Correct
All of the following must be true:
2 All simple type definitions must be derivedultimately from the·simple ur-typedefinition (so· circular definitions are disallowed). That is, it must be possible to reach a built-inprimitive datatype or the·simple ur-type definition· by repeatedly following the{base type definition}.
3 The{final} of the{base type definition} must not containrestriction.
Schema Component Constraint: Derivation Valid (Restriction, Simple)
The appropriatecase among the followingmust be true:
1Ifthe{variety} isatomic,thenall of the following must be true:
1.1 The{base type definition} must be an atomic simple typedefinition or a built-inprimitive datatype.
1.2 The{final} of the{base type definition} must not containrestriction.
1.3 For each facet in the{facets} (call thisDF)all of the following must be true:
1.3.1DF must be an allowed constraining facet for the{primitive type definition}, as specified in the appropriatesubsection of3.2 Primitive datatypes.
1.3.2 If there is a facet of the same kind in the{facets} of the{base type definition} (callthisBF),then theDF's{value} must be a valid restriction ofBF's{value} asdefined in[XML Schemas: Datatypes].
2Ifthe{variety} islist,thenall of the following must be true:
2.1 The{item type definition} must have a{variety} ofatomic orunion (in which case all the{member type definitions} must beatomic).
2.2
2.3 The appropriatecase among the followingmust be true:
2.3.1Ifthe{base type definition}is the·simple ur-type definition· ,thenall of the following must be true:
2.3.1.1 The{final} of the{item type definition} must not containlist.
2.3.1.2 The{facets} must only contain thewhiteSpace facet component.
2.3.2otherwiseall of the following must be true:
2.3.2.1 The{base type definition} must have a{variety} oflist.
2.3.2.2 The{final} of the{base type definition} must not containrestriction.
2.3.2.3 The{item type definition} mustbe validly derived from the{base type definition}'s{item type definition} given the empty set, as defined inType Derivation OK (Simple) (§3.14.6).
2.3.2.4 Onlylength,minLength,maxLength,whiteSpace,pattern andenumeration facet components are allowed amongthe{facets}.
2.3.2.5 For each facet in the{facets} (call thisDF), if there is a facet of the same kind in the{facets} of the{base type definition} (callthisBF),then theDF's{value} must be a valid restriction ofBF's{value} asdefined in[XML Schemas: Datatypes].
The first case above will apply when a list is derived byspecifying an item type, the second when derived by restriction from another list.
3Ifthe{variety} isunion,thenall of the following must be true:
3.1 The{member type definitions} must all have{variety} ofatomic orlist.
3.2
3.3 The appropriatecase among the followingmust be true:
3.3.1Ifthe{base type definition}is the·simple ur-type definition· ,thenall of the following must be true:
3.3.1.1 All of the{member type definitions} musthave a{final} which does not containunion.
3.3.1.2 The{facets} must be empty.
3.3.2otherwiseall of the following must be true:
3.3.2.1 The{base type definition} must have a{variety} ofunion.
3.3.2.2 The{final} of the{base type definition} must not containrestriction.
3.3.2.3 The{member type definitions}, in order, mustbe validly derived from the corresponding type definitions in the{base type definition}'s{member type definitions} given the empty set, as defined inType Derivation OK (Simple) (§3.14.6).
3.3.2.4 Onlypattern andenumeration facet components are allowed amongthe{facets}.
3.3.2.5 For each facet in the{facets} (call thisDF), if there is a facet of the same kind in the{facets} of the{base type definition} (callthisBF),then theDF's{value} must be a valid restriction ofBF's{value} asdefined in[XML Schemas: Datatypes].
The first case above will apply when a union is derived byspecifying one or more member types, the second when derived by restriction from another union.
[Definition:]  If thisconstraintDerivation Valid (Restriction, Simple) (§3.14.6) holds of a simple type definition, it is avalidrestriction of its·base type definition·.

The following constraint defines relations appealed to elsewhere in this specification.

Schema Component Constraint: Type Derivation OK (Simple)
For a simple type definition (call itD, for derived) to be validlyderived from a type definition (call thisB, for base) given asubset of {extension,restriction,list,union} (of whichonlyrestriction is actually relevant)one of the following must be true:
1They are the same typedefinition.
2All of the following must be true:
2.1restriction is not in thesubset, or in the{final} of its own{base type definition};
2.2One of the following must be true:
2.2.2D's·base type definition· is not the·ur-type definition· and is validly derivedfromB given the subset, as defined by this constraint.
2.2.3D's{variety} islist orunion andBis the·simple ur-type definition·.
2.2.4B's{variety} isunion andD is validly derivedfrom a type definition inB's{member type definitions} given the subset, as defined by this constraint.
Note: With respect to clause1, see the Note on identity atthe end of (§3.4.6) above.
Schema Component Constraint: Simple Type Restriction (Facets)
For a simple type definition (call itR) to restrict another simple typedefinition (call itB) with aset of facets (call thisS)all of the following must be true:
1 The{variety} ofR is the same as that ofB.
2 If{variety} isatomic, the{primitive type definition} ofR is the same as that ofB.
3The{facets} ofR are the union ofS andthe{facets} ofB, eliminating duplicates. To eliminateduplicates, when a facet of the same kind occurs in bothS andthe{facets} ofB, the one in the{facets}ofB is not included, with the exception ofenumeration andpattern facets, for which multiple occurrences with distinct values are allowed.

Additional constraint(s) may apply depending on the kind of facet, seethe appropriate sub-section of4.3Constraining Facets

[Definition:]  Ifclause3 above holds, the{facets} ofRconstitute a restriction of the{facets} ofB with respect toS.

3.14.7 Built-in Simple Type Definition

There is a simple type definition nearly equivalent to the·simple ur-type definition· present in everyschema by definition. It has the following properties:

Simple Type Definition of the Ur-Type
PropertyValue
{name}anySimpleType
{target namespace}http://www.w3.org/2001/XMLSchema
{base type definition}·the ur-type definition·
{final}The empty set
{variety}·absent·

The·simple ur-type definition· 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{base type definition} properties, and the·ur-type definition·, which isits{base type definition}. This is why the·simple ur-type definition· is exempted from the first clause ofSimple Type Definition Properties Correct (§3.14.6), which wouldotherwise bar it because of its derivation from a complex type definition and absence of{variety}.

Simple type definitions for all the built-in primitive datatypes, namelystring,boolean,float,double,number,dateTime,duration,time,date,gMonth,gMonthDay,gDay,gYear,gYearMonth,hexBinary,base64Binary,anyURI (see thePrimitiveDatatypes section of[XML Schemas: Datatypes]) are present by definition in every schema. Allare in the XML Schema{target namespace} (namespacenamehttp://www.w3.org/2001/XMLSchema), have anatomic{variety} with an empty{facets} and the·simple ur-type definition· astheir·base type definition· and themselves as{primitive type definition}.

Similarly, simple type definitions for all the built-in deriveddatatypes (see theDerivedDatatypes section of[XML Schemas: Datatypes]) are present by definition in every schema, withproperties as specified in[XML Schemas: Datatypes] and as represented in XML inSchema for Schemas (normative) (§A).

previous sub-section3.15 Schemas as a Whole

        3.15.1The Schema Itself
        3.15.2XML Representations of Schemas
        3.15.3Constraints on XML Representations of Schemas
        3.15.4Validation Rules for Schemas as a Whole
        3.15.5Schema Information Set Contributions
        3.15.6Constraints on Schemas as a Whole

A schema consists of a set of schema components.

Example
<xs:schema    xmlns:xs="http://www.w3.org/2001/XMLSchema"    targetNamespace="http://www.example.com/example">  . . .</xs:schema>
The XML representation of the skeleton of a schema.

3.15.1 The Schema Itself

At the abstract level, the schema itself is just a container for its components.

{type definitions}
A set ofnamed simple and complex type definitions.
{attribute declarations}
A set ofnamed (top-level) attribute declarations.
{element declarations}
A set ofnamed (top-level) element declarations.
{attribute group definitions}
A set of namedattribute group definitions.
{model group definitions}
A set of namedmodel group definitions.
{notation declarations}
A set ofnotation declarations.
{annotations}
A set of annotations.

3.15.2 XML Representations of Schemas

A schema is represented in XML by one or more·schema documents·, that is, one or more<schema> element information items. A·schema document· contains representations for a collection of schema components, e.g. type definitions and element declarations, which have a common{target namespace}. A·schema document· which has one or more<import> element information items corresponds to a schema with components with more than one{target namespace}, seeImport Constraints and Semantics (§4.2.3).

XML Representation Summaryschema Element Information Item

<schema
  attributeFormDefault = (qualified |unqualified) : unqualified
  blockDefault = (#all | List of (extension |restriction |substitution))  : ''
  elementFormDefault = (qualified |unqualified) : unqualified
  finalDefault = (#all | List of (extension |restriction |list |union))  : ''
  id =ID
  targetNamespace =anyURI
  version =token
  xml:lang =language
  {any attributes with non-schema namespace . . .}>
  Content:((include |import |redefine |annotation)*, (((simpleType |complexType |group |attributeGroup) |element |attribute |notation),annotation*)*)
</schema>

Schema Schema Component
PropertyRepresentation
{type definitions}The simple and complex type definitionscorresponding to all the<simpleType> and<complexType> element information items in the[children], if any, plus any included or imported definitions, seeAssembling a schema for a single target namespace from multiple schema definition documents (§4.2.1) andReferences to schema components across namespaces (§4.2.3).
{attribute declarations}The (top-level) attribute declarationscorresponding to all the<attribute> element information items in the[children], if any, plus any included or imported declarations, seeAssembling a schema for a single target namespace from multiple schema definition documents (§4.2.1) andReferences to schema components across namespaces (§4.2.3).
{element declarations}The (top-level) element declarationscorresponding to all the<element> element information items in the[children], if any, plus any included or imported declarations, seeAssembling a schema for a single target namespace from multiple schema definition documents (§4.2.1) andReferences to schema components across namespaces (§4.2.3).
{attribute group definitions}The attribute group definitionscorresponding to all the<attributeGroup> element information items in the[children], if any, plus any included or imported definitions, seeAssembling a schema for a single target namespace from multiple schema definition documents (§4.2.1) andReferences to schema components across namespaces (§4.2.3).
{model group definitions}The model group definitionscorresponding to all the<group> element information items in the[children], if any, plus any included or imported definitions, seeAssembling a schema for a single target namespace from multiple schema definition documents (§4.2.1) andReferences to schema components across namespaces (§4.2.3).
{notation declarations}The notation declarationscorresponding to all the<notation> element information items in the[children], if any, plus any included or imported declarations, seeAssembling a schema for a single target namespace from multiple schema definition documents (§4.2.1) andReferences to schema components across namespaces (§4.2.3).
{annotations}The annotationscorresponding to all the<annotation> element information items in the[children], if any.

Note that none of the attribute information items displayed abovecorrespond directly to properties of schemas. TheblockDefault,finalDefault,attributeFormDefault,elementFormDefaultandtargetNamespace attributes are appealed to in the sub-sections above, as they provideglobal information applicable to many representation/component correspondences. Theother attributes (id andversion) are for userconvenience, and this specification defines no semantics for them.

The definition of the schema abstract data model inXML Schema Abstract Data Model (§2.2) makes clear that most components have a{target namespace}. Most components corresponding to representations within a given<schema> element information item will have a{target namespace} which corresponds to thetargetNamespace attribute.

Since the empty string is not a legal namespace name, supplyingan empty string fortargetNamespace is incoherent, and isnot the sameas not specifying it at all. The appropriate form of schema documentcorresponding to a·schema· whose components have no{target namespace} is one which has notargetNamespace attribute specified at all.

Note: The XML namespaces Recommendation discusses only instance document syntax forelements and attributes; it therefore provides no direct framework for managingthe names of type definitions, attribute group definitions, and so on.Nevertheless, the specification applies the target namespace facility uniformly to allschema components, i.e. not only declarations but also definitions have a{target namespace}.

Although the example schema at the beginning of this section might be a complete XML document,<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) documentat all: it could correspond to an element information item constructed 'byhand', for instance via a DOM-conformant API.

Aside from<include> and<import>, which do not correspond directly to any schema component at all, each of the element informationitems which may appear in the content of<schema> corresponds toa schema component, and all except<annotation> are named. Thesections belowpresent each such item in turn, setting out thecomponents to which it may correspond.

3.15.2.1 References to Schema Components

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(References to schema components across namespaces (§4.2.3)) from an external schema (which may,but need not, correspond to an actual schema document). The formof all such references is a·QName·.

[Definition:]  AQName is a namewith an optional namespace qualification, as defined in[XML-Namespaces]. When used in connection with the XMLrepresentation of schema components or references to them, this refers to thesimple typeQName as defined in[XML Schemas: Datatypes].

[Definition:]  AnNCName is a namewith no colon, as defined in[XML-Namespaces]. When used in connection with the XMLrepresentation of schema components in this specification, this refers to thesimple typeNCName as defined in[XML Schemas: Datatypes].

In each of the XMLrepresentation expositions in the following sections, an attribute is shown ashaving typeQName if and only if it isinterpreted as referencing a schema component.

Example
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"            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>
The first of these is most probably a local reference, i.e. a referenceto a typedefinition corresponding to a<complexType> element information itemlocated elsewhere in the schema document, the other two refer to typedefinitions from schemas for other namespaces and assume that their namespaceshave been declared for import. SeeReferences to schema components across namespaces (§4.2.3) for a discussion of importing.
3.15.2.2 References to Schema Components from Elsewhere

The names of schema components such as type definitions and elementdeclarations are not of typeID: they are notunique within a schema, just within a symbol space. This means that simplefragment identifiers will not always work to reference schema components from outsidethe context of schema documents.

There is currently no provision in the definition of the interpretationof fragment identifiers for thetext/xml MIME type, which is theMIME type for schemas, for referencingschema components as such. However,[XPointer] provides a mechanism which maps well onto thenotion of symbol spaces as it is reflected in the XML representation of schema components. A fragment identifier of the form#xpointer(xs:schema/xs:element[@name="person"]) will uniquely identifythe representation of a top-level element declaration with nameperson, and similar fragmentidentifiers can obviously be constructed for the other global symbol spaces.

Short-form fragment identifiers may also be used in some cases, that iswhen a DTD or XML Schema is available for the schema in question, and theprovision of anid attribute for the representations of all primary and secondary schemacomponents, whichis of typeID, has been exploited.

It is a matter for applications to specify whether they interpretdocument-level references of either of the above varieties as being to the relevant element information item (i.e. withoutspecial recognition of the relation of schema documents to schema components) or as being to thecorresponding schema component.

3.15.3 Constraints on XML Representations of Schemas

Schema Representation Constraint: QName Interpretation
Where the type of an attribute information item in a document involved in·validation· isidentified as·QName·, its·actual value· is composed of a[Definition:]  local name and a[Definition:]  namespace name. Its·actual value· is determined based on its·normalized value· andthe containing element information item's[in-scopenamespaces] following[XML-Namespaces]:

The appropriatecase among the followingmust be true:

1Ifits·normalized value· is prefixed,thenall of the following must be true:
1.1 There must be a namespace in the[in-scopenamespaces] whose[prefix] matches the prefix.
1.2 its·namespace name· is the[namespacename] of that namespace.
1.3 Its·local name· is the portion ofits·normalized value· after the colon (':').
2otherwise(its·normalized value· is unprefixed)all of the following must be true:
2.2 The appropriatecase among the followingmust be true:
2.2.1Ifthere is a namespace in the[in-scopenamespaces] whose[prefix] has no value,thenits·namespace name· is the[namespacename] of that namespace.
2.2.2otherwiseits·namespace name· is·absent·.

In the absence of the[in-scope namespaces] property in the infoset for the schema document in question, processors must reconstruct equivalent information as necessary, using the[ namespace attributes] of the containing element information item and its ancestors.

[Definition:]  Whenever the wordresolve in any form is used in thischapter in connection with a·QName· in aschema document, thefollowing definitionQName resolution (Schema Document) (§3.15.3) should be understood:

Schema Representation Constraint: QName resolution (Schema Document)
For a·QName·to resolve to a schema component of a specified kindall of the following must be true:
1 That component is a member of the value of the appropriateproperty of the schema which corresponds to the schemadocument within which the·QName·appears, that is the appropriatecase among the followingmust be true:
1.1Ifthe kind specified is simple or complex type definition,thenthe property is the{type definitions}.
1.2Ifthe kind specified is attribute declaration,thenthe property is the{attribute declarations}.
1.3Ifthe kind specified is element declaration,thenthe property is the{element declarations}.
1.4Ifthe kind specifiedis attribute group,thenthe property is the{attribute group definitions}.
1.5Ifthe kind specified ismodel group,thenthe property is the{model group definitions}.
1.6Ifthe kind specified is notation declaration,thenthe property is the{notation declarations}.
2 Thecomponent's{name} matches the·localname· of the·QName·;
3 The component's{target namespace} is identical to the·namespace name· of the·QName·;
4 The appropriatecase among the followingmust be true:
4.1Ifthe·namespace name· of the·QName· is·absent·,thenone of the following must be true:
4.1.1 The<schema> element information item of the schema document containing the·QName· has notargetNamespace[attribute].
4.1.2 The<schema> element information item of the that schema document contains an<import> elementinformation item with nonamespace[attribute].
4.2otherwisethe·namespace name· of the·QName· isthe same asone of the following:
4.2.1 The·actual value· of thetargetNamespace[attribute] ofthe<schema> element information item of the schema document containing the·QName·.
4.2.2 The·actual value· of thenamespace[attribute] of some<import> element information item contained in the<schema> element information item of that schema document.
.

3.15.4 Validation Rules for Schemas as a Whole

As the discussion above atSchema Component Details (§3) makes clear, at the level of schema components and·validation·, reference to components by name is normally not involved. In afew cases, however, qualified names appearing in information items being·validated· must be resolved to schema components by such lookup. The followingconstraint is appealed to in these cases.

Validation Rule: QName resolution (Instance)
A pair of a local name and a namespace name (or·absent·)resolve to a schema component of a specified kind in the context of·validation· by appeal to the appropriateproperty of the schema being used for the·assessment·. Each such property indexes components by name. The property to use is determined by the kind of component specified, that is, the appropriatecase among the followingmust be true:
1Ifthe kind specified is simple or complex type definition,thenthe property is the{type definitions}.
2Ifthe kind specified is attribute declaration,thenthe property is the{attribute declarations}.
3Ifthe kind specified is element declaration,thenthe property is the{element declarations}.
4Ifthe kind specifiedis attribute group,thenthe property is the{attribute group definitions}.
5Ifthe kind specified ismodel group,thenthe property is the{model group definitions}.
6Ifthe kind specified is notation declaration,thenthe property is the{notation declarations}.
The component resolved to is the entry in the table whose{name} matches the local name of the pair and whose{target namespace} is identical to the namespace name of the pair.

3.15.5 Schema Information Set Contributions

Schema Information Set Contribution: Schema Information
Schema components provide a wealth of information about the basis of·assessment·, which may well be of relevance tosubsequent processing. Reflecting component structure into a form suitable forinclusion in the·post-schema-validation infoset· is the way this specification provides for making thisinformation available.

Accordingly,[Definition:]   by anitem isomorphic 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.

Processors must add a property in the·post-schema-validation infoset·to the element information item at which·assessment· began, as follows:

PSVI Contributionsfor element information items
[schema information]
A set ofnamespace schema information information items, one for each namespace name which appears as the{target namespace} of any schema component in the schema used for thatassessment, and one for·absent· if any schemacomponent in the schema had no{target namespace}. Eachnamespace schema information information item has thefollowing properties and values:
PSVI Contributionsfor namespace schema information information items
[schema namespace]
A namespacename or·absent·.
[schema components]
A (possiblyempty) set of schema component information items, each one an·item isomorphic· to a component whose{targetnamespace} is the sibling[schema namespace]property above, drawn from the schema used for·assessment·.
[schema documents]
A(possibly empty) set ofschema document information items, withproperties and values as follows, for each schema document whichcontributed components to the schema, and whosetargetNamespace matches the sibling[schema namespace] property above (or whosetargetNamespace was·absent·but that contributed components to that namespace by being<include>dby a schema document with thattargetNamespace as perAssembling a schema for a single target namespace from multiple schema definition documents (§4.2.1)):
PSVI Contributionsfor schema document information items
[document location]
Either a URI reference, if available, otherwise·absent·
[document]
A documentinformation item, if available, otherwise·absent·.
The{schema components} property is provided forprocessors which wish to provide a single access point to thecomponents of the schema which was used during·assessment·. Lightweight processors are free to leave it empty, but if itis provided, it must contain at a minimum all the top-level (i.e. named) components which actually figured in the·assessment·, either directly or (because an anonymous component which figured is contained within) indirectly.
Schema Information Set Contribution: ID/IDREF Table
In the·post-schema-validation infoset· a set ofID/IDREF binding information items is associatedwith the·validation root· element informationitem:
PSVI Contributionsfor element information items
[ID/IDREF table]
A (possibly empty) set ofID/IDREF binding information items, as specified below.
[Definition:]  Let theeligible item set be the set of consisting of every attribute or elementinformation item for whichall of the following are true
1 its[validation context] is the·validation root·;
2 it was successfully·validated· with respect to an attributedeclaration as perAttribute Locally Valid (§3.2.4) or element declaration as perElement Locally Valid (Element) (§3.3.4) (as appropriate) whose attribute{type definition} or element{type definition} (respectively) is thebuilt-inID,IDREF orIDREFS simple type definition or a type derived from one of them.

Then there is oneID/IDREF binding in the[ID/IDREF table]for every distinct string which isone of the following:

1 the·actual value· of a member of the·eligibleitem set· whose type definition is or is derived fromID orIDREF;
2 one of the items in the·actual value· of a member of the·eligibleitem set· whose type definition is or is derived fromIDREFS.
EachID/IDREF binding has properties as follows:
PSVI Contributionsfor ID/IDREF binding information items
[id]
The string identified above.
[binding]
A set consisting of every element information item for whichall of the following are true
2 it has an attribute information item inits[attributes] or an element information item in its[children] which was·validated· by thebuilt-inID simple type definition or a type derived from it whose[schema normalized value] is the[id] ofthisID/IDREF binding.
The net effect of the above is to have one entry for every string used as anid, whether by declaration or by reference, associated with those elements, ifany, which actually purport to have that id. SeeValidation Root Valid (ID/IDREF) (§3.3.4) abovefor the validation rule which actually checks for errors here.
Note: TheID/IDREF bindinginformation item, unlike most other aspects of thisspecification, is essentially an internal bookkeeping mechanism. It is introduced tosupport the definition ofValidation Root Valid (ID/IDREF) (§3.3.4) above. Accordingly, conformant processors may, but arenot required to,expose it in the·post-schema-validation infoset·.In other words, the above constraint may be read as saying·assessment· proceedsas if such an infoset item existed.

3.15.6 Constraints on Schemas as a Whole

All schemas (seeSchemas as a Whole (§3.15)) must satisfy the following constraint.

Schema Component Constraint: Schema Properties Correct

4 Schemas and Namespaces: Access and Composition

This chapter defines the mechanisms by which this specification establishes the necessaryprecondition for·assessment·, namely access toone or more schemas. This chapter also sets out in detail the relationshipbetween schemas and namespaces, as well as mechanisms formodularization of schemas, including provision for incorporating definitionsand declarations from one schema in another, possibly with modifications.

Conformance (§2.4) describes three levels of conformance for schemaprocessors, andSchemas and Schema-validity Assessment (§5) provides a formal definition of·assessment·. This section sets outin detail the 3-layer architecture implied by the three conformance levels.The layersare:

  1. The·assessment· core, relating schema components and instanceinformation items;
  2. Schema representation: the connections between XMLrepresentations and schema components, including the relationships between namespaces and schema components;
  3. XML Schema web-interoperability guidelines: instance->schema and schema->schema connections for the WWW.

Layer 1 specifies the manner in which a schema composed of schema componentscan be applied to in the·assessment· of an instance element information item. Layer 2 specifies the use of<schema>elements in XML documents as the standard XML representation forschema information in a broad range of computer systems and executionenvironments. To support interoperation over the World Wide Web in particular,layer 3 provides a set of conventions for schema reference on theWeb. Additional details on each of the three layers is provided in the sections below.

next sub-section4.1 Layer 1: Summary of the Schema-validity Assessment Core

The fundamental purpose of the·assessment· core is to define·assessment· for a singleelement information item and its descendants with respect to acomplex typedefinition. All processors are required to implement this core predicate in amanner which conforms exactly to this specification.

·assessment· is defined with reference to an·XML Schema· (notenot a·schema document·) which consists of (at a minimum) the set of schemacomponents (definitions and declarations) required for that·assessment·. This is not a circular definition, but rather apost facto observation: no element information item canbe fully assessed unless all the components required by any aspect ofits (potentially recursive)·assessment· are present in the schema.

As specified above, each schema component is associated directly orindirectly 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.

Processors have the option to assemble (and perhaps to optimize orpre-compile) the entire schema prior to the start of an·assessment· episode, or togather the schema lazily as individual components are required. In allcases it is required that:

  • The processor succeed in locating the·schema components· transitively required to complete an·assessment· (note that components derivedfrom·schema documents· can be integratedwith components obtained through other means);
  • no definition or declaration changes once it has been established;
  • 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·assessment· to differ from that which would have been obtained from the same schema components acquired in bulk.
Note:  the·assessment· core is defined in terms of schema components at theabstract level, and no mention is made of the schema definitionsyntax (i.e.<schema>). Although many processors will acquireschemas in this format, others may operate on compiled representations, on aprogrammatic representation as exposed in some programming language, etc.

The obligation of a schema-aware processor as far as the·assessment·core is concerned is to implement one or more of the options for·assessment· given below inAssessing Schema-Validity (§5.2). Neither thechoice of element information item for that·assessment·, nor which of themeans of initiating·assessment· are used, is within the scope of this specification.

Although·assessment· is defined recursively, it is also intended to beimplementable in streamingprocessors. Such processors may choose to incrementally assemble the schema duringprocessing in response, for example, to encountering new namespaces. The implication of theinvariants expressed above is that such incremental assembly mustresult in an·assessment· outcome that is thesame as wouldbe given if·assessment· was undertaken againwith the final, fully assembled schema.

previous sub-sectionnext sub-section4.2 Layer 2: Schema Documents, Namespaces and Composition

        4.2.1Assembling a schema for a single target namespace from multiple schema definition documents
        4.2.2Including modified component definitions
        4.2.3References to schema components across namespaces

The sub-sections ofSchema Component Details (§3) define anXML 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·assessment· from multiple sources. They shouldnot be understood as a form of text substitution, but rather as providing mechanisms for distributed definition of schema components, with appropriate schema-specific semantics.

Note:  The core·assessment· architecture requires that a complete schema withall the necessary declarations and definitions beavailable. This may involve resolving bothinstance->schema and schema->schema references. As observed earlier inConformance (§2.4), 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 fromone schema document to a schema use mechanisms that directly parallel those used toreference a schema from an instance document.
Note: In the sections below, "schemaLocation" really belongs at layer 3. For convenience, it is documented with the layer 2 mechanisms of import andinclude, with which it is closely associated.

4.2.1 Assembling a schema for a single target namespace from multiple schema definition documents

Schema components for a single target namespace can be assembled fromseveral·schema documents·, that is several<schema> elementinformation items:

XML Representation Summaryinclude Element Information Item

<include
  id =ID
  schemaLocation =anyURI
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?)
</include>

A<schema> information item may contain any number of<include> elements. TheirschemaLocation attributes, consisting of a URI reference, identify other·schema documents·, that is<schema> information items.

The·XML Schema· corresponding to<schema> contains not only the components corresponding to its definition and declaration[children], but alsoall the components of all the·XML Schemas· corresponding to any<include>d schema documents.Such included schema documents must either (a) have the sametargetNamespace as the<include>ing schema document, or (b) notargetNamespace at all, in which case the<include>d schema document is converted to the<include>ing schema document'stargetNamespace.

Schema Representation Constraint: Inclusion Constraints and Semantics
In addition to the conditions imposed on<include> elementinformation items by the schema for schemas,all of the following must be true:
1If the·actual value· of theschemaLocation[attribute]successfully resolvesone of the following must be true:
1.1It resolves to (a fragment of) a resource which is an XMLdocument (of typeapplication/xml ortext/xml with an XML declarationfor preference, but this is not required), which in turn corresponds to a<schema>element information item in a well-formed information set, which in turncorresponds to a valid schema.
1.2 It resolves to a<schema>element information item in a well-formed information set, which in turncorresponds to a valid schema.
In either case call the<include>d<schema> itemSII, the validschemaI and the<include>ing item's parent<schema> itemSII’.
2One of the following must be true:
2.1SII has atargetNamespace[attribute], and its·actual value· is identical to the·actual value· of thetargetNamespace[attribute] ofSII’ (which must have such an[attribute]).
2.2NeitherSII norSII’ have atargetNamespace[attribute].
2.3SII has notargetNamespace[attribute] (butSII’ does).
3 The appropriatecase among the followingmust be true:
3.1Ifclause2.1 or clause2.2 above is satisfied,thenthe schema corresponding toSII’ must include not only definitions ordeclarations corresponding to the appropriate members of its own[children], but also components identical to all the·schema components· ofI.
3.2Ifclause2.3 above is satisfied,thenthe schema corresponding to the<include>ditem's parent<schema> must include not only definitions ordeclarations corresponding to the appropriate members of its own[children],but also components identical to all the·schemacomponents· ofI, except that anywhere the·absent· targetnamespace name would have appeared, the·actual value· of thetargetNamespace[attribute] ofSII’ is used. Inparticular, it replaces·absent· in the following places:
3.2.1 The{target namespace} of named schemacomponents, both at the top level and (in the case of nested typedefinitions and nested attribute andelement declarations whosecode wasqualified) nested within definitions;
3.2.2 The{namespace constraint} of a wildcard, whether negated or not;

It isnot an error for the·actual value· of theschemaLocation[attribute] to fail to resolve it all, in which case nocorresponding inclusion is performed. Itis an error for it to resolve but the rest of clause 1 above tofail to be satisfied. Failure to resolve may well cause less than complete·assessment· outcomes, of course.

As discussed inMissing Sub-components (§5.3),·QName·s in XML representations may fail to·resolve·, rendering components incompleteand unusable because of missing subcomponents. During schema construction,implementations must retain·QName· values for such references, in case an appropriately-named component becomes available to discharge the reference by the time it is actually needed.·Absent· target·namespace name·s of such as-yet unresolved reference·QName·s in<include>d components must also be converted if clause3.2 is satisfied.

Note: The above is carefully worded so that multiple<include>ing of the same schema document will not constitute a violation ofclause2 ofSchema Properties Correct (§3.15.6), but applications areallowed, indeed encouraged, to avoid<include>ing the same schema document more than once to forestall the necessity of establishing identitycomponent by component.

4.2.2 Including modified component definitions

In order to provide some support for evolution and versioning, it ispossible to incorporate components corresponding to a schema documentwith modifications. The modifications have a pervasive impact,that is, only the redefined components are used, even when referenced fromother incorporated components, whether redefined themselves or not.

<redefine
  id =ID
  schemaLocation =anyURI
  {any attributes with non-schema namespace . . .}>
  Content:(annotation | (simpleType |complexType |group |attributeGroup))*
</redefine>

A<schema> information item may contain any number of<redefine> elements. TheirschemaLocation attributes, consisting of a URI reference, identify other·schema documents·, that is<schema> information items.

The·XML Schema· corresponding to<schema> contains not only the components corresponding to its definition and declaration[children], but alsoall the components of all the·XML Schemas· corresponding to any<redefine>d schema documents.Such schema documents must either (a) have the sametargetNamespace as the<redefine>ing schema document, or (b) notargetNamespace at all, in which case the<redefine>d schema document is converted to the<redefine>ing schema document'stargetNamespace.

The definitions within the<redefine> element itself arerestricted to be redefinitions of components from the<redefine>dschema document,in terms of themselves. That is,

  • Typedefinitions must use themselves as their base type definition;
  • Attributegroup definitions and model group definitions must be supersets or subsets of their originaldefinitions, either by including exactly onereference to themselves or by containing only (possibly restricted) componentswhich appear in a corresponding way in their<redefine>d selves.

Not all the components of the<redefine>dschema document need be redefined.

This mechanism is intended to provide a declarative and modular approach toschema modification, with functionality no different except in scope from whatwould be achieved by wholesale text copying and redefinition by editing. Inparticular redefining a type is not guaranteed to be side-effect free: it mayhave unexpected impacts on other type definitions which are basedon the redefined one, even to the extent that some such definitions becomeill-formed.

Note: The pervasive impact of redefinition reinforces the need forimplementations to adopt some form of lazy or 'just-in-time' approach tocomponent construction, which is also called for in order to avoidinappropriate dependencies on the order in which definitions and references appear in (collections of) schema documents.
Example
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"/>
The schema corresponding tov2.xsd has everything specifiedbyv1.xsd, with thepersonName type redefined, aswell as everything it specifies itself. According tothis schema, elements constrainedby thepersonName type may end with agenerationelement. This includes not only theauthor element, but also theaddressee element.
Schema Representation Constraint: Redefinition Constraints and Semantics
In addition to the conditions imposed on<redefine> elementinformation items by the schema for schemasall of the following must be true:
1 If there are any element information items among the[children]other than<annotation> then the·actual value· of theschemaLocation[attribute] mustsuccessfully resolve.
2 If the·actual value· of theschemaLocation[attribute]successfully resolvesone of the following must be true:
2.1 it resolves to (a fragment of) a resource which is an XML document(see clause1.1), which in turn corresponds to a<schema>element information item in a well-formed information set, which in turncorresponds to a valid schema.
2.2 It resolves to a<schema>element information item in a well-formed information set, which in turncorresponds to a valid schema.
In either case call the<redefine>d<schema> itemSII, the validschemaI and the<redefine>ing item's parent<schema> itemSII’.
3One of the following must be true:
3.1SII has atargetNamespace[attribute], and its·actual value· is identical to the·actual value· of thetargetNamespace[attribute] ofSII’ (which must have such an[attribute]).
3.2NeitherSII norSII’ have atargetNamespace[attribute].
3.3SII has notargetNamespace[attribute] (butSII’ does).
4 The appropriatecase among the followingmust be true:
4.1Ifclause3.1 or clause3.2 above is satisfied,thenthe schema corresponding toSII’ must include not only definitions ordeclarations corresponding to the appropriate members of its own[children], but also components identical to all the·schema components· ofI, with theexception of those explicitly redefined (seeIndividual Component Redefinition (§4.2.2) below).
4.2Ifclause3.3 above is satisfied,thenthe schema corresponding toSII’ must include not only definitions ordeclarations corresponding to the appropriate members of its own[children],but also components identical to all the·schemacomponents· ofI, with theexception of those explicitly redefined (seeIndividual Component Redefinition (§4.2.2)below), except that anywhere the·absent· targetnamespace name would have appeared, the·actual value· of thetargetNamespace[attribute] ofSII’ isused (see clause3.2 inInclusion Constraints and Semantics (§4.2.1) for details).
5 Within the[children], each<simpleType> musthave a<restriction> among its[children] and each<complexType> must have arestriction orextension among its grand-[children] the·actual value· of whosebase[attribute] must be the same as the·actual value· of its ownname attribute plus target namespace;
6 Within the[children], for each<group> the appropriatecase among the followingmust be true:
6.1Ifit has a<group> among its contents at some level the·actual value· of whoseref[attribute] is the same as the·actual value· of its ownname attribute plus target namespace,thenall of the following must be true:
6.1.1 It must have exactly one such group.
6.1.2 The·actual value· of both that group'sminOccurs andmaxOccurs[attribute] must be1 (or·absent·).
6.2Ifit has no such self-reference,thenall of the following must be true:
6.2.1 The·actual value· of its ownname attribute plus targetnamespace must successfully·resolve· to amodel group definition inI.
6.2.2 The{model group} of the model group definition whichcorresponds to it perXML Representation of Model Group Definition Schema Components (§3.7.2) must be a·validrestriction· of the{model group} of that model groupdefinition inI, as defined inParticle Valid (Restriction) (§3.9.6).
7 Within the[children], for each<attributeGroup> the appropriatecase among the followingmust be true:
7.1Ifit has an<attributeGroup> among its contents the·actual value· of whoseref[attribute] is the same as the·actual value· of its ownname attribute plus target namespace,thenit must have exactly one such group.
7.2Ifit has no such self-reference,thenall of the following must be true:
7.2.1 The·actual value· of its ownname attribute plus targetnamespace must successfully·resolve· to anattribute group definition inI.
7.2.2 The{attribute uses} and{attribute wildcard} of the attribute group definition whichcorresponds to it perXML Representation of Attribute Group Definition Schema Components (§3.6.2) must be·validrestrictions· of the{attribute uses} and{attribute wildcard} of that attribute groupdefinition inI, as defined in clause2, clause3 and clause4 ofDerivation Valid (Restriction, Complex) (§3.4.6) (where references to the base type definition are understood as references to the attribute groupdefinition inI).
Note: An attribute group restrictively redefined per clause7.2 corresponds to an attribute group whose{attribute uses} consist all and only of those attribute uses corresponding to<attribute>s explicitly present among the[children] of the<redefine>ing<attributeGroup>. No inheritance from the<redefine>d attribute group occurs. Its{attribute wildcard} is similarly based purely on an explicit<anyAttribute>, if present.
Schema Representation Constraint: Individual Component Redefinition
Corresponding to each non-<annotation> member of the[children] of a<redefine> there are one or two schema components inthe<redefine>ing schema:
1 The<simpleType> and<complexType>[children] information items eachcorrespond to two components:
1.1 One component which corresponds to the top-level definition item withthe samename inthe<redefine>d schema document, as defined inSchema Component Details (§3), except that its{name} is·absent·;
1.2 One component which corresponds to the information item itself, as definedinSchema Component Details (§3), except that its{base type definition} isthe component defined in 1.1 above.
This pairing ensures the coherence constraints on type definitionsare respected, while at the same time achieving the desired effect, namely thatreferences to names of redefined components in both the<redefine>ing and<redefine>d schema documents resolve to the redefined componentas specified in 1.2 above.
2 The<group> and<attributeGroup>[children] each correspond to a single component, as defined inSchema Component Details (§3), except that if and when a self-reference based on aref[attribute] whose·actual value· is the same as the item'sname plus target namespace is resolved, a component which corresponds to the top-level definition item of that name and the appropriate kind inI is used.
In all cases there must be a top-level definition item of the appropriate name and kind inthe<redefine>d schema document.
Note: The above is carefully worded so that multiple equivalent<redefine>ing of the same schema document will not constitute a violation ofclause2 ofSchema Properties Correct (§3.15.6), but applications areallowed, indeed encouraged, to avoid<redefine>ing the sameschema document in the same way more than once to forestall the necessity ofestablishing identity component by component (although this will have to bedone for the individual redefinitions themselves).

4.2.3 References to schema components across namespaces

As described inXML Schema Abstract Data Model (§2.2), every top-level schema component is associated witha target namespace (or, explicitly, with none). This section sets outthe exact mechanism and syntax in the XML form ofschema definition by which a reference to a foreign component is made, that is, a component with a different target namespace from that of the referring component.

Two things are required: not only a meansof addressing such foreign components but also a signal to schema-aware processors that aschema document contains such references:

XML Representation Summaryimport Element Information Item

<import
  id =ID
  namespace =anyURI
  schemaLocation =anyURI
  {any attributes with non-schema namespace . . .}>
  Content:(annotation?)
</import>

The<import> element information item identifies namespacesused in external references, i.e. those whose·QName· identifies them as coming from adifferent namespace (or none) than the enclosing schema document'stargetNamespace. The·actual value· of itsnamespace[attribute] indicates that the containing schema document may containqualified references to schema components in that namespace (via one or moreprefixes declared with namespace declarations in the normal way). If thatattribute is absent, then the import allows unqualified reference to componentswith no target namespace.Note that components to be imported need not be in the form of a·schema document·; the processoris free to access or construct components using means of its ownchoosing.

The·actual value· of theschemaLocation, if present, gives ahint as to where a serialization of a·schema document· with declarations and definitions for thatnamespace (or none) may be found. When noschemaLocation[attribute] is present, the schema author is leaving theidentification of that schema to the instance, application or user, via the mechanisms describedbelow inLayer 3: Schema Document Access and Web-interoperability (§4.3). When aschemaLocation is present, itmust contain a single URI reference which the schema authorwarrants will resolve to a serialization of a·schema document· containing the component(s) in the<import>ed namespace referred to elsewhere in the containingschema document.

Note: Since both thenamespace andschemaLocation[attribute] are optional, a bare<import/> information itemis allowed. This simply allows unqualified reference to foreigncomponents with no target namespace without giving any hints as to where to find them.
Example
The same namespace may be used both for real work, and in the course ofdefining schema components in terms of foreign components:
<schema xmlns="http://www.w3.org/2001/XMLSchema"        xmlns:html="http://www.w3.org/1999/xhtml"        targetNamespace="uri:mywork" xmlns:my="uri:mywork"> <import namespace="http://www.w3.org/1999/xhtml"/> <annotation>  <documentation>   <html:p>[Some documentation for my schema]</html:p>  </documentation> </annotation> . . . <complexType name="myType">  <sequence>   <element ref="html:p" minOccurs="0"/>  </sequence>  . . . </complexType> <element name="myElt" type="my:myType"/></schema>
The treatment of references as·QNames· implies that since (with the exception ofthe schema for schemas) the target namespace and the XML Schema namespacediffer, without massive redeclaration of the default namespaceeither internal references to the names being defined in a schema documentor the schema declaration and definition elements themselves mustbe explicitly qualified. This example takes the first option -- most otherexamples in this specification have taken the second.
Schema Representation Constraint: Import Constraints and Semantics
In addition to the conditions imposed on<import> elementinformation items by the schema for schemasall of the following must be true:
1 The appropriatecase among the followingmust be true:
1.1Ifthenamespace[attribute] is present,thenits·actual value· must not match the·actual value· of theenclosing<schema>'stargetNamespace[attribute].
1.2Ifthenamespace[attribute] is not present,thenthe enclosing<schema> must have atargetNamespace[attribute]
2If the application schema reference strategy using the·actual value·s oftheschemaLocation andnamespace[attributes],provides a referent, as defined bySchema Document Location Strategy (§4.3.2),one of the following must be true:
2.1 The referent is (a fragment of) a resource which is an XML document(see clause1.1), which in turn corresponds to a<schema>element information item in a well-formed information set, which in turncorresponds to a valid schema.
2.2 The referent is a<schema>element information item in a well-formed information set, which in turncorresponds to a valid schema.
In either case call the<schema> itemSII and the valid schemaI.
3 The appropriatecase among the followingmust be true:
3.1Ifthere is anamespace[attribute],thenits·actual value· must be identical to the·actual value· of thetargetNamespace[attribute] ofSII.
3.2Ifthere is nonamespace[attribute],thenSIImust have notargetNamespace[attribute]

It isnot an error for the application schema referencestrategy to fail. Itis an error for it to resolve but the rest of clause2 above tofail to be satisfied. Failure to find a referent may well cause less than complete·assessment· outcomes, of course.

The·schema components· (that is{type definitions},{attribute declarations},{element declarations},{attribute group definitions},{model group definitions},{notation declarations}) of a schema corresponding to a<schema> element information item with one or more<import> element information items must include not only definitions or declarations corresponding to the appropriate members of its[children], but also, for each of those<import> element information items for which clause2 above is satisfied, a set of·schema components· identical to all the·schema components· ofI.

Note: The above is carefully worded so that multiple<import>ing of the same schema document will not constitute a violation ofclause2 ofSchema Properties Correct (§3.15.6), but applications areallowed, indeed encouraged, to avoid<import>ing the same schema document more than once to forestall the necessity of establishing identitycomponent by component. Given that theschemaLocation[attribute] is only a hint, it is open to applications to ignore all but thefirst<import> for a given namespace, regardless of the·actual value· ofschemaLocation, but such a strategy risks missing usefulinformation when newschemaLocations are offered.

previous sub-section4.3 Layer 3: Schema Document Access and Web-interoperability

        4.3.1Standards for representation of schemas and retrieval of schema documents on the Web
        4.3.2How schema definitions are located on the Web

Layers 1 and 2 provide a framework for·assessment· and XML definition of schemas in a broad variety of environments. Over time, a rangeof standards and conventions may well evolve to support interoperability of XMLSchema implementations on the World Wide Web. Layer 3 defines the minimum levelof function required of all conformant processors operating on the Web:it is intended that, over time, future standards (e.g. XML Packages) for interoperability on theWeb and in other environments can be introduced without the need to republishthis specification.

4.3.1 Standards for representation of schemas and retrieval of schema documents on the Web

For interoperability, serialized·schema documents·, like all other Web resources, may be identified byURI and retrieved using the standard mechanisms of the Web (e.g. http, https,etc.) Such documents on the Web must be part of XML documents (see clause1.1), and are represented in thestandard XML schema definition form described by layer 2 (that is as<schema>element information items).

Note:  there will often be times when a schema document will be acomplete XML 1.0 document whose document element is<schema>. There will beother occasions in which<schema> items will be contained in otherdocuments, perhaps referenced using fragment and/or XPointer notation.
Note: The variations among server software and web site administration policiesmake it difficult to recommend any particular approach to retrieval requestsintended to retrieve serialized·schema documents·. AnAccept header ofapplication/xml,text/xml; q=0.9, */* is perhaps a reasonable starting point.

4.3.2 How schema definitions are located on the Web

As described inLayer 1: Summary of the Schema-validity Assessment Core (§4.1), processors are responsible for providing theschema components (definitions and declarations) needed for·assessment·. Thissection introduces a set of normative conventions to facilitate interoperabilityfor instance and schema documents retrieved and processed from the Web.

Note:  As discussed above inLayer 2: Schema Documents, Namespaces and Composition (§4.2), other non-Web mechanisms for delivering schemas for·assessment· may exist, but are outside the scope of this specification.

Processors on the Web are free to undertake·assessment· against arbitraryschemas in any of the ways set out inAssessing Schema-Validity (§5.2). However, itis useful to have a common convention for determining the schema to use. Accordingly, general-purpose schema-aware processors (i.e. those notspecialized to one or a fixed set of pre-determined schemas)undertaking·assessment· of a document on the webmust behave as follows:

  • unless directed otherwise by the user,·assessment· is undertaken on the documentelement information item of the specified document;
  • unless directed otherwise by the user, theprocessor is required to construct a schema corresponding to a schema documentwhosetargetNamespace isidentical to thenamespace name, if any, of the element information item on which·assessment· is undertaken.

The composition of the completeschema for use in·assessment· is discussed inLayer 2: Schema Documents, Namespaces and Composition (§4.2) above.The means used to locate appropriate schema document(s) are processor andapplication dependent, subject to the following requirements:

  1. Schemas are represented on the Web in the form specified above inStandards for representation of schemas and retrieval of schema documents on the Web (§4.3.1);
  2. The author of a document uses namespace declarations to indicate the intendedinterpretation of names appearing therein; there may or may not be a schemaretrievable via the namespace name. Accordingly whether a processor's defaultbehavior is or is not to attempt such dereferencing, it must always providefor user-directed overriding of that default.
    Note:  Experience suggests that it is not in all cases safe or desirable froma performance point of view to dereference namespace names as a matter of course. User community and/orconsumer/provider agreements may establish circumstances in which such dereference is a sensibledefault strategy: this specification allows but does not require particular communities toestablish and implement such conventions. Users are always free to supply namespace names as schema location information when dereferencingis desired: see below.
  3. On the other hand, in case a document author (human or not) created adocument with a particular schema in view, and warrants that some orall of the document conforms to that schema, theschemaLocation andnoNamespaceSchemaLocation[attributes] (in the XML Schema instance namespace,that is,http://www.w3.org/2001/XMLSchema-instance) (hereafterxsi:schemaLocation andxsi:noNamespaceSchemaLocation) are provided. The first recordsthe author's warrant with pairs of URI references (one for the namespace name, andone for a hint as to the location of a schema document defining names for thatnamespace name). The second similarly provides a URI reference as a hint as tothe location of a schema document with notargetNamespace[attribute].

    Unless directed otherwise, for example by the invoking applicationor by command line option, processorsshould attempt to dereference each schema document location URI in the·actual value· of suchxsi:schemaLocation andxsi:noNamespaceSchemaLocation[attributes], see details below.

  4. xsi:schemaLocation andxsi:noNamespaceSchemaLocation[attributes] can occur on anyelement. However, it is an error if such an attribute occursafter the first appearance of an element or attribute informationitem within anelement information item initially·validated· whose[namespace name] it addresses. According to the rules ofLayer 1: Summary of the Schema-validity Assessment Core (§4.1), the corresponding schema may be lazily assembled, but is otherwise stable throughout·assessment·. Although schema location attributes can occur on any element, and can be processed incrementally as discovered, their effect is essentially global to the·assessment·. Definitions and declarations remain in effect beyond the scope of the element on which the binding is declared.
Example
Multiple schema bindings can be declared using a singleattribute. For example consider a stylesheet:
 <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform"            xmlns:html="http://www.w3.org/1999/xhtml"            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"            xsi:schemaLocation="http://www.w3.org/1999/XSL/Transform                                http://www.w3.org/1999/XSL/Transform.xsd                                http://www.w3.org/1999/xhtml                                http://www.w3.org/1999/xhtml.xsd">
The namespace names used inschemaLocation can, but need not be identical to those actually qualifying the element within whose start tagit is found or its other attributes. For example, as above, all schema location information can be declared on the document elementof a document, if desired, regardless of where the namespaces are actually used.
Schema Representation Constraint: Schema Document Location Strategy
Given a namespace name (or none) and (optionally) a URI reference fromxsi:schemaLocation orxsi:noNamespaceSchemaLocation,schema-aware processors may implement any combination of the following strategies, in any order:
1 Do nothing, for instance because a schema containing components for thegiven namespace name is already known to be available, or because itis known in advance that no efforts to locate schema documents will be successful (forexample in embedded systems);
3 Based on the namespace name, identify an existing schema document,either as a resource which is an XML document or a<schema> elementinformation item, in some local schema repository;
4 Attempt to resolve the location URI, to locate aresource on the web which is or contains or references a<schema> element;
5 Attempt to resolve the namespace name to locate such a resource.
Whenever possible configuration and/or invocation options for selecting and/or ordering the implemented strategies should be provided.

Improved or alternative conventions for Web interoperability canbe standardized in the future without reopening this specification. Forexample, the W3C is currently considering initiatives to standardize thepackaging of resources relating to particular documents and/or namespaces: thiswould be an addition to the mechanisms described here for layer 3. Thisarchitecture also facilitates innovation at layer 2: for example, it would bepossible in the future to define an additional standard for the representation ofschema components which allowed e.g. type definitions to be specified piece bypiece, rather than all at once.

5 Schemas and Schema-validity Assessment

The architecture of schema-aware processing allows for a rich characterization of XML documents: schema validity is not a binary predicate.

This specification distinguishes between errors in schema construction and structure, on theone hand, and schema validation outcomes, on the other.

next sub-section5.1 Errors in Schema Construction and Structure

Before·assessment· can be attempted, a schema is required. Special-purpose applications are free to determine a schema for use in·assessment· by whatevermeans are appropriate, but general purpose processors should implement thestrategy set out inSchema Document Location Strategy (§4.3.2), starting with thenamespaces declared in the document whose·assessment· is being undertaken, and the·actual value·s of thexsi:schemaLocation andxsi:noNamespaceSchemaLocation[attributes] thereof, if any, along with any other information aboutschema identity or schema document location provided by users inapplication-specific ways, if any.

It is anerror if aschema and all the components which are the value of any of its properties,recursively, fail to satisfy all the relevant Constraints on Schemas set out inthe last section of each of the subsections ofSchema Component Details (§3).

If a schema is derived from one or more schema documents (that is, one ormore<schema> element information items) based on thecorrespondence rules set out inSchema Component Details (§3) andSchemas and Namespaces: Access and Composition (§4), two additionalconditions hold:

The three cases described above are the only types of error which thisspecification defines. With respect to the processes of the checking of schema structureand the construction of schemas corresponding to schema documents, thisspecification imposes no restrictions on processors after an error is detected.However·assessment· with respect to schema-like entities which donotsatisfy all the above conditions is incoherent. Accordingly, conformantprocessors must not attempt to undertake·assessment· using such non-schemas.

previous sub-sectionnext sub-section5.2 Assessing Schema-Validity

With a schema which satisfies the conditions expressed inErrors in Schema Construction and Structure (§5.1) above, the schema-validity of an element information item can be assessed. Three primary approaches to this are possible:

1 The user or application identifies a complex type definition from among the{type definitions} of the schema, and appeals toSchema-Validity Assessment (Element) (§3.3.4) (clause1.2);
2The user or application identifies a element declaration from among the{element declarations} of the schema, checks that its{name} and{target namespace} match the[local name] and[namespace name] of the item, and appeals toSchema-Validity Assessment (Element) (§3.3.4) (clause1.1);
3 The processor starts fromSchema-Validity Assessment (Element) (§3.3.4) with nostipulated declaration or definition, and either·strict· or·lax· assessment ensues, depending on whether or not the element information and the schema determine either an element declaration (by name) or a type definition (viaxsi:type) or not.

The outcome of this effort, in any case, will be manifest in the[validation attempted]and[validity] properties onthe element information item and its[attributes] and[children],recursively, as defined byAssessment Outcome (Element) (§3.3.5) andAssessment Outcome (Attribute) (§3.2.5). It is up to applications to decide what constitutes a successful outcome.

Note that every element and attribute information itemparticipating in the·assessment· will also have a[validation context] propertywhich refers back to the element information item at which·assessment· began.[Definition:]  This item, that is the element information item at which·assessment· began, is called thevalidation root.

Note: This specification does not reconstruct the XML 1.0 notion ofroot in either schemas or instances. Equivalentfunctionality is provided for at·assessment·invocation, via clause2 above.
Note: This specification has nothing normative to say about multiple·assessment·episodes. It should however be clear from the above that if a processorrestarts·assessment· with respect to a·post-schema-validation infoset·some·post-schema-validation infoset· contributions from the previous·assessment·may be overwritten. Restarting nonetheless may be useful, particularly at a node whose[validation attempted] property isnone, in whichcase there are three obvious cases in which additional useful information may result:

previous sub-sectionnext sub-section5.3 Missing Sub-components

At the beginning ofSchema Component Details (§3), attention is drawn to thefact that most kinds of schema components have properties which are described thereinas having other components, or sets of other components, as values, but thatwhen components are constructed on the basis of their correspondence withelement information items in schema documents, such properties usuallycorrespond toQNames, and the·resolution· of suchQNames may fail, resulting in one or more values of or containing·absent· where a component is mandated.

If at any time during·assessment·, anelement or attribute information item is being·validated· with respect to a component of any kind any of whoseproperties has or contains such an·absent· value,the·validation· is modified, as following:

Because of the value specification for[validation attempted] inAssessment Outcome (Element) (§3.3.5), if this situation ever arises, thedocument as a whole cannot show a[validation attempted]offull.

previous sub-section5.4 Responsibilities of Schema-aware Processors

Schema-aware processors are responsible for processing XML documents,schemas and schema documents, as appropriate given the level of conformance(as defined inConformance (§2.4)) they support,consistently with the conditions set out above.

A Schema for Schemas (normative)

The XML representation of the schema for schema documents is presented hereas a normativepart of the specification, and as an illustrative example of how the XML Schemalanguage candefine itself using its own constructs. The names of XMLSchema language types, elements, attributes and groups defined hereare evocative of their purpose, but are occasionally verbose.

There is some annotation in comments, but a fuller annotation will requirethe use of embedded documentation facilities or a hyperlinked externalannotation for which tools are not yet readily available.

Since a schema document is an XML document, it has optional XML and doctypedeclarations that are provided here for completeness. The rootschema element defines a new schema. Since this is a schema forXML Schema: Structures, thetargetNamespace references the XML Schema namespace itself.

<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" [<!-- provide ID type information even for parsers which only read the     internal subset --><!ATTLIST xs:schema          id  ID  #IMPLIED><!ATTLIST xs:complexType     id  ID  #IMPLIED><!ATTLIST xs:complexContent  id  ID  #IMPLIED><!ATTLIST xs:simpleContent   id  ID  #IMPLIED><!ATTLIST xs:extension       id  ID  #IMPLIED><!ATTLIST xs:element         id  ID  #IMPLIED><!ATTLIST xs:group           id  ID  #IMPLIED> <!ATTLIST xs:all             id  ID  #IMPLIED><!ATTLIST xs:choice          id  ID  #IMPLIED><!ATTLIST xs:sequence        id  ID  #IMPLIED><!ATTLIST xs:any             id  ID  #IMPLIED><!ATTLIST xs:anyAttribute    id  ID  #IMPLIED><!ATTLIST xs:attribute       id  ID  #IMPLIED><!ATTLIST xs:attributeGroup  id  ID  #IMPLIED><!ATTLIST xs:unique          id  ID  #IMPLIED><!ATTLIST xs:key             id  ID  #IMPLIED><!ATTLIST xs:keyref          id  ID  #IMPLIED><!ATTLIST xs:selector        id  ID  #IMPLIED><!ATTLIST xs:field           id  ID  #IMPLIED><!ATTLIST xs:include         id  ID  #IMPLIED><!ATTLIST xs:import          id  ID  #IMPLIED><!ATTLIST xs:redefine        id  ID  #IMPLIED><!ATTLIST xs:notation        id  ID  #IMPLIED>]><?xml version='1.0'?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" blockDefault="#all"           elementFormDefault="qualified" xml:lang="EN"           targetNamespace="http://www.w3.org/2001/XMLSchema"           version="Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp ">  <xs:annotation>    <xs:documentation source="../structures/structures-with-errata.html.html">   The schema corresponding to this document is normative,   with respect to the syntactic constraints it expresses in the   XML Schema language.  The documentation (within &lt;documentation> elements)   below, is not normative, but rather highlights important aspects of   the W3C Recommendation of which this is a part</xs:documentation>  </xs:annotation>  <xs:annotation>    <xs:documentation>   The simpleType element and all of its members are defined   in datatypes.xsd</xs:documentation>  </xs:annotation>  <xs:include schemaLocation="datatypes.xsd"/>  <xs:import namespace="http://www.w3.org/XML/1998/namespace"             schemaLocation="http://www.w3.org/2001/xml.xsd">    <xs:annotation>      <xs:documentation>       Get access to the xml: attribute groups for xml:lang       as declared on 'schema' and 'documentation' below     </xs:documentation>    </xs:annotation>  </xs:import>  <xs:complexType name="openAttrs">    <xs:annotation>      <xs:documentation>       This type is extended by almost all schema types       to allow attributes from other namespaces to be       added to user schemas.     </xs:documentation>    </xs:annotation>    <xs:complexContent>      <xs:restriction base="xs:anyType">        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="annotated">    <xs:annotation>      <xs:documentation>       This type is extended by all types which allow annotation       other than &lt;schema> itself     </xs:documentation>    </xs:annotation>    <xs:complexContent>      <xs:extension base="xs:openAttrs">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>        </xs:sequence>        <xs:attribute name="id" type="xs:ID"/>      </xs:extension>    </xs:complexContent>  </xs:complexType>  <xs:group name="schemaTop">    <xs:annotation>      <xs:documentation>   This group is for the   elements which occur freely at the top level of schemas.   All of their types are based on the "annotated" type by extension.</xs:documentation>    </xs:annotation>    <xs:choice>      <xs:group ref="xs:redefinable"/>      <xs:element ref="xs:element"/>      <xs:element ref="xs:attribute"/>      <xs:element ref="xs:notation"/>    </xs:choice>  </xs:group>  <xs:group name="redefinable">    <xs:annotation>      <xs:documentation>   This group is for the   elements which can self-redefine (see &lt;redefine> below).</xs:documentation>    </xs:annotation>    <xs:choice>      <xs:element ref="xs:simpleType"/>      <xs:element ref="xs:complexType"/>      <xs:element ref="xs:group"/>      <xs:element ref="xs:attributeGroup"/>    </xs:choice>  </xs:group>  <xs:simpleType name="formChoice">    <xs:annotation>      <xs:documentation>   A utility type, not for public use</xs:documentation>    </xs:annotation>    <xs:restriction base="xs:NMTOKEN">      <xs:enumeration value="qualified"/>      <xs:enumeration value="unqualified"/>    </xs:restriction>  </xs:simpleType>  <xs:simpleType name="reducedDerivationControl">    <xs:annotation>      <xs:documentation>   A utility type, not for public use</xs:documentation>    </xs:annotation>    <xs:restriction base="xs:derivationControl">      <xs:enumeration value="extension"/>      <xs:enumeration value="restriction"/>    </xs:restriction>  </xs:simpleType>  <xs:simpleType name="derivationSet">    <xs:annotation>      <xs:documentation>   A utility type, not for public use</xs:documentation>      <xs:documentation>   #all or (possibly empty) subset of {extension, restriction}</xs:documentation>    </xs:annotation>    <xs:union>      <xs:simpleType>        <xs:restriction base="xs:token">          <xs:enumeration value="#all"/>        </xs:restriction>      </xs:simpleType>      <xs:simpleType>        <xs:list itemType="xs:reducedDerivationControl"/>      </xs:simpleType>    </xs:union>  </xs:simpleType>  <xs:simpleType name="typeDerivationControl">    <xs:annotation>      <xs:documentation>   A utility type, not for public use</xs:documentation>    </xs:annotation>    <xs:restriction base="xs:derivationControl">      <xs:enumeration value="extension"/>      <xs:enumeration value="restriction"/>      <xs:enumeration value="list"/>      <xs:enumeration value="union"/>    </xs:restriction>  </xs:simpleType>  <xs:simpleType name="fullDerivationSet">    <xs:annotation>      <xs:documentation>   A utility type, not for public use</xs:documentation>      <xs:documentation>   #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>    </xs:annotation>    <xs:union>      <xs:simpleType>        <xs:restriction base="xs:token">          <xs:enumeration value="#all"/>        </xs:restriction>      </xs:simpleType>      <xs:simpleType>        <xs:list itemType="xs:typeDerivationControl"/>      </xs:simpleType>    </xs:union>  </xs:simpleType>  <xs:element name="schema" id="schema">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:openAttrs">          <xs:sequence>            <xs:choice minOccurs="0" maxOccurs="unbounded">              <xs:element ref="xs:include"/>              <xs:element ref="xs:import"/>              <xs:element ref="xs:redefine"/>              <xs:element ref="xs:annotation"/>            </xs:choice>            <xs:sequence minOccurs="0" maxOccurs="unbounded">              <xs:group ref="xs:schemaTop"/>              <xs:element ref="xs:annotation" minOccurs="0"                          maxOccurs="unbounded"/>            </xs:sequence>          </xs:sequence>          <xs:attribute name="targetNamespace" type="xs:anyURI"/>          <xs:attribute name="version" type="xs:token"/>          <xs:attribute name="finalDefault" type="xs:fullDerivationSet"                        default="" use="optional"/>          <xs:attribute name="blockDefault" type="xs:blockSet" default=""                        use="optional"/>          <xs:attribute name="attributeFormDefault" type="xs:formChoice"                        default="unqualified" use="optional"/>          <xs:attribute name="elementFormDefault" type="xs:formChoice"                        default="unqualified" use="optional"/>          <xs:attribute name="id" type="xs:ID"/>          <xs:attribute ref="xml:lang"/>        </xs:extension>      </xs:complexContent>    </xs:complexType>    <xs:key name="element">      <xs:selector xpath="xs:element"/>      <xs:field xpath="@name"/>    </xs:key>    <xs:key name="attribute">      <xs:selector xpath="xs:attribute"/>      <xs:field xpath="@name"/>    </xs:key>    <xs:key name="type">      <xs:selector xpath="xs:complexType|xs:simpleType"/>      <xs:field xpath="@name"/>    </xs:key>    <xs:key name="group">      <xs:selector xpath="xs:group"/>      <xs:field xpath="@name"/>    </xs:key>    <xs:key name="attributeGroup">      <xs:selector xpath="xs:attributeGroup"/>      <xs:field xpath="@name"/>    </xs:key>    <xs:key name="notation">      <xs:selector xpath="xs:notation"/>      <xs:field xpath="@name"/>    </xs:key>    <xs:key name="identityConstraint">      <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>      <xs:field xpath="@name"/>    </xs:key>  </xs:element>  <xs:simpleType name="allNNI">    <xs:annotation>      <xs:documentation>   for maxOccurs</xs:documentation>    </xs:annotation>    <xs:union memberTypes="xs:nonNegativeInteger">      <xs:simpleType>        <xs:restriction base="xs:NMTOKEN">          <xs:enumeration value="unbounded"/>        </xs:restriction>      </xs:simpleType>    </xs:union>  </xs:simpleType>  <xs:attributeGroup name="occurs">    <xs:annotation>      <xs:documentation>   for all particles</xs:documentation>    </xs:annotation>    <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" default="1"                  use="optional"/>    <xs:attribute name="maxOccurs" type="xs:allNNI" default="1" use="optional"/>  </xs:attributeGroup>  <xs:attributeGroup name="defRef">    <xs:annotation>      <xs:documentation>   for element, group and attributeGroup,   which both define and reference</xs:documentation>    </xs:annotation>    <xs:attribute name="name" type="xs:NCName"/>    <xs:attribute name="ref" type="xs:QName"/>  </xs:attributeGroup>  <xs:group name="typeDefParticle">    <xs:annotation>      <xs:documentation>   'complexType' uses this</xs:documentation>    </xs:annotation>    <xs:choice>      <xs:element name="group" type="xs:groupRef"/>      <xs:element ref="xs:all"/>      <xs:element ref="xs:choice"/>      <xs:element ref="xs:sequence"/>    </xs:choice>  </xs:group>  <xs:group name="nestedParticle">    <xs:choice>      <xs:element name="element" type="xs:localElement"/>      <xs:element name="group" type="xs:groupRef"/>      <xs:element ref="xs:choice"/>      <xs:element ref="xs:sequence"/>      <xs:element ref="xs:any"/>    </xs:choice>  </xs:group>  <xs:group name="particle">    <xs:choice>      <xs:element name="element" type="xs:localElement"/>      <xs:element name="group" type="xs:groupRef"/>      <xs:element ref="xs:all"/>      <xs:element ref="xs:choice"/>      <xs:element ref="xs:sequence"/>      <xs:element ref="xs:any"/>    </xs:choice>  </xs:group>  <xs:complexType name="attribute">    <xs:complexContent>      <xs:extension base="xs:annotated">        <xs:sequence>          <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>        </xs:sequence>        <xs:attributeGroup ref="xs:defRef"/>        <xs:attribute name="type" type="xs:QName"/>        <xs:attribute name="use" default="optional" use="optional">          <xs:simpleType>            <xs:restriction base="xs:NMTOKEN">              <xs:enumeration value="prohibited"/>              <xs:enumeration value="optional"/>              <xs:enumeration value="required"/>            </xs:restriction>          </xs:simpleType>        </xs:attribute>        <xs:attribute name="default" type="xs:string"/>        <xs:attribute name="fixed" type="xs:string"/>        <xs:attribute name="form" type="xs:formChoice"/>      </xs:extension>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="topLevelAttribute">    <xs:complexContent>      <xs:restriction base="xs:attribute">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>        </xs:sequence>        <xs:attribute name="ref" use="prohibited"/>        <xs:attribute name="form" use="prohibited"/>        <xs:attribute name="use" use="prohibited"/>        <xs:attribute name="name" type="xs:NCName" use="required"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:group name="attrDecls">    <xs:sequence>      <xs:choice minOccurs="0" maxOccurs="unbounded">        <xs:element name="attribute" type="xs:attribute"/>        <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>      </xs:choice>      <xs:element ref="xs:anyAttribute" minOccurs="0"/>    </xs:sequence>  </xs:group>  <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>    </xs:annotation>  </xs:element>  <xs:group name="complexTypeModel">    <xs:choice>      <xs:element ref="xs:simpleContent"/>      <xs:element ref="xs:complexContent"/>      <xs:sequence>        <xs:annotation>          <xs:documentation>   This branch is short for   &lt;complexContent>   &lt;restriction base="xs:anyType">   ...   &lt;/restriction>   &lt;/complexContent></xs:documentation>        </xs:annotation>        <xs:group ref="xs:typeDefParticle" minOccurs="0"/>        <xs:group ref="xs:attrDecls"/>      </xs:sequence>    </xs:choice>  </xs:group>  <xs:complexType name="complexType" abstract="true">    <xs:complexContent>      <xs:extension base="xs:annotated">        <xs:group ref="xs:complexTypeModel"/>        <xs:attribute name="name" type="xs:NCName">          <xs:annotation>            <xs:documentation>      Will be restricted to required or forbidden</xs:documentation>          </xs:annotation>        </xs:attribute>        <xs:attribute name="mixed" type="xs:boolean" default="false"                      use="optional">          <xs:annotation>            <xs:documentation>      Not allowed if simpleContent child is chosen.      May be overriden by setting on complexContent child.</xs:documentation>          </xs:annotation>        </xs:attribute>        <xs:attribute name="abstract" type="xs:boolean" default="false"                      use="optional"/>        <xs:attribute name="final" type="xs:derivationSet"/>        <xs:attribute name="block" type="xs:derivationSet"/>      </xs:extension>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="topLevelComplexType">    <xs:complexContent>      <xs:restriction base="xs:complexType">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:group ref="xs:complexTypeModel"/>        </xs:sequence>        <xs:attribute name="name" type="xs:NCName" use="required"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="localComplexType">    <xs:complexContent>      <xs:restriction base="xs:complexType">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:group ref="xs:complexTypeModel"/>        </xs:sequence>        <xs:attribute name="name" use="prohibited"/>        <xs:attribute name="abstract" use="prohibited"/>        <xs:attribute name="final" use="prohibited"/>        <xs:attribute name="block" use="prohibited"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="restrictionType">    <xs:complexContent>      <xs:extension base="xs:annotated">        <xs:sequence>          <xs:choice minOccurs="0">            <xs:group ref="xs:typeDefParticle"/>            <xs:group ref="xs:simpleRestrictionModel"/>          </xs:choice>          <xs:group ref="xs:attrDecls"/>        </xs:sequence>        <xs:attribute name="base" type="xs:QName" use="required"/>      </xs:extension>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="complexRestrictionType">    <xs:complexContent>      <xs:restriction base="xs:restrictionType">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:choice minOccurs="0">            <xs:annotation>              <xs:documentation>This choice is added simply to                   make this a valid restriction per the REC</xs:documentation>            </xs:annotation>            <xs:group ref="xs:typeDefParticle"/>          </xs:choice>          <xs:group ref="xs:attrDecls"/>        </xs:sequence>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="extensionType">    <xs:complexContent>      <xs:extension base="xs:annotated">        <xs:sequence>          <xs:group ref="xs:typeDefParticle" minOccurs="0"/>          <xs:group ref="xs:attrDecls"/>        </xs:sequence>        <xs:attribute name="base" type="xs:QName" use="required"/>      </xs:extension>    </xs:complexContent>  </xs:complexType>  <xs:element name="complexContent" id="complexContent">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:annotated">          <xs:choice>            <xs:element name="restriction" type="xs:complexRestrictionType"/>            <xs:element name="extension" type="xs:extensionType"/>          </xs:choice>          <xs:attribute name="mixed" type="xs:boolean">            <xs:annotation>              <xs:documentation>       Overrides any setting on complexType parent.</xs:documentation>            </xs:annotation>          </xs:attribute>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:complexType name="simpleRestrictionType">    <xs:complexContent>      <xs:restriction base="xs:restrictionType">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:choice minOccurs="0">            <xs:annotation>              <xs:documentation>This choice is added simply to                   make this a valid restriction per the REC</xs:documentation>            </xs:annotation>            <xs:group ref="xs:simpleRestrictionModel"/>          </xs:choice>          <xs:group ref="xs:attrDecls"/>        </xs:sequence>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="simpleExtensionType">    <xs:complexContent>      <xs:restriction base="xs:extensionType">        <xs:sequence>          <xs:annotation>            <xs:documentation>      No typeDefParticle group reference</xs:documentation>          </xs:annotation>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:group ref="xs:attrDecls"/>        </xs:sequence>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:element name="simpleContent" id="simpleContent">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:annotated">          <xs:choice>            <xs:element name="restriction" type="xs:simpleRestrictionType"/>            <xs:element name="extension" type="xs:simpleExtensionType"/>          </xs:choice>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>    </xs:annotation>  </xs:element>  <xs:simpleType name="blockSet">    <xs:annotation>      <xs:documentation>    A utility type, not for public use</xs:documentation>      <xs:documentation>    #all or (possibly empty) subset of {substitution, extension,    restriction}</xs:documentation>    </xs:annotation>    <xs:union>      <xs:simpleType>        <xs:restriction base="xs:token">          <xs:enumeration value="#all"/>        </xs:restriction>      </xs:simpleType>      <xs:simpleType>        <xs:list>          <xs:simpleType>            <xs:restriction base="xs:derivationControl">              <xs:enumeration value="extension"/>              <xs:enumeration value="restriction"/>              <xs:enumeration value="substitution"/>            </xs:restriction>          </xs:simpleType>        </xs:list>      </xs:simpleType>    </xs:union>  </xs:simpleType>  <xs:complexType name="element" abstract="true">    <xs:annotation>      <xs:documentation>   The element element can be used either   at the top level to define an element-type binding globally,   or within a content model to either reference a globally-defined   element or type or declare an element-type binding locally.   The ref form is not allowed at the top level.</xs:documentation>    </xs:annotation>    <xs:complexContent>      <xs:extension base="xs:annotated">        <xs:sequence>          <xs:choice minOccurs="0">            <xs:element name="simpleType" type="xs:localSimpleType"/>            <xs:element name="complexType" type="xs:localComplexType"/>          </xs:choice>          <xs:group ref="xs:identityConstraint" minOccurs="0"                    maxOccurs="unbounded"/>        </xs:sequence>        <xs:attributeGroup ref="xs:defRef"/>        <xs:attribute name="type" type="xs:QName"/>        <xs:attribute name="substitutionGroup" type="xs:QName"/>        <xs:attributeGroup ref="xs:occurs"/>        <xs:attribute name="default" type="xs:string"/>        <xs:attribute name="fixed" type="xs:string"/>        <xs:attribute name="nillable" type="xs:boolean" default="false"                      use="optional"/>        <xs:attribute name="abstract" type="xs:boolean" default="false"                      use="optional"/>        <xs:attribute name="final" type="xs:derivationSet"/>        <xs:attribute name="block" type="xs:blockSet"/>        <xs:attribute name="form" type="xs:formChoice"/>      </xs:extension>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="topLevelElement">    <xs:complexContent>      <xs:restriction base="xs:element">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:choice minOccurs="0">            <xs:element name="simpleType" type="xs:localSimpleType"/>            <xs:element name="complexType" type="xs:localComplexType"/>          </xs:choice>          <xs:group ref="xs:identityConstraint" minOccurs="0"                    maxOccurs="unbounded"/>        </xs:sequence>        <xs:attribute name="ref" use="prohibited"/>        <xs:attribute name="form" use="prohibited"/>        <xs:attribute name="minOccurs" use="prohibited"/>        <xs:attribute name="maxOccurs" use="prohibited"/>        <xs:attribute name="name" type="xs:NCName" use="required"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="localElement">    <xs:complexContent>      <xs:restriction base="xs:element">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:choice minOccurs="0">            <xs:element name="simpleType" type="xs:localSimpleType"/>            <xs:element name="complexType" type="xs:localComplexType"/>          </xs:choice>          <xs:group ref="xs:identityConstraint" minOccurs="0"                    maxOccurs="unbounded"/>        </xs:sequence>        <xs:attribute name="substitutionGroup" use="prohibited"/>        <xs:attribute name="final" use="prohibited"/>        <xs:attribute name="abstract" use="prohibited"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:element name="element" type="xs:topLevelElement" id="element">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-element"/>    </xs:annotation>  </xs:element>  <xs:complexType name="group" abstract="true">    <xs:annotation>      <xs:documentation>   group type for explicit groups, named top-level groups and   group references</xs:documentation>    </xs:annotation>    <xs:complexContent>      <xs:extension base="xs:annotated">        <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>        <xs:attributeGroup ref="xs:defRef"/>        <xs:attributeGroup ref="xs:occurs"/>      </xs:extension>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="realGroup">    <xs:complexContent>      <xs:restriction base="xs:group">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:choice minOccurs="0" maxOccurs="1">            <xs:element ref="xs:all"/>            <xs:element ref="xs:choice"/>            <xs:element ref="xs:sequence"/>          </xs:choice>        </xs:sequence>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="namedGroup">    <xs:complexContent>      <xs:restriction base="xs:realGroup">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:choice minOccurs="1" maxOccurs="1">            <xs:element name="all">              <xs:complexType>                <xs:complexContent>                  <xs:restriction base="xs:all">                    <xs:group ref="xs:allModel"/>                    <xs:attribute name="minOccurs" use="prohibited"/>                    <xs:attribute name="maxOccurs" use="prohibited"/>                    <xs:anyAttribute namespace="##other" processContents="lax"/>                  </xs:restriction>                </xs:complexContent>              </xs:complexType>            </xs:element>            <xs:element name="choice" type="xs:simpleExplicitGroup"/>            <xs:element name="sequence" type="xs:simpleExplicitGroup"/>          </xs:choice>        </xs:sequence>        <xs:attribute name="name" type="xs:NCName" use="required"/>        <xs:attribute name="ref" use="prohibited"/>        <xs:attribute name="minOccurs" use="prohibited"/>        <xs:attribute name="maxOccurs" use="prohibited"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="groupRef">    <xs:complexContent>      <xs:restriction base="xs:realGroup">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>        </xs:sequence>        <xs:attribute name="ref" type="xs:QName" use="required"/>        <xs:attribute name="name" use="prohibited"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="explicitGroup">    <xs:annotation>      <xs:documentation>   group type for the three kinds of group</xs:documentation>    </xs:annotation>    <xs:complexContent>      <xs:restriction base="xs:group">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>        </xs:sequence>        <xs:attribute name="name" type="xs:NCName" use="prohibited"/>        <xs:attribute name="ref" type="xs:QName" use="prohibited"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="simpleExplicitGroup">    <xs:complexContent>      <xs:restriction base="xs:explicitGroup">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>        </xs:sequence>        <xs:attribute name="minOccurs" use="prohibited"/>        <xs:attribute name="maxOccurs" use="prohibited"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:group name="allModel">    <xs:sequence>      <xs:element ref="xs:annotation" minOccurs="0"/>      <xs:choice minOccurs="0" maxOccurs="unbounded">        <xs:annotation>          <xs:documentation>This choice with min/max is here to                          avoid a pblm with the Elt:All/Choice/Seq                          Particle derivation constraint</xs:documentation>        </xs:annotation>        <xs:element name="element" type="xs:narrowMaxMin"/>      </xs:choice>    </xs:sequence>  </xs:group>  <xs:complexType name="narrowMaxMin">    <xs:annotation>      <xs:documentation>restricted max/min</xs:documentation>    </xs:annotation>    <xs:complexContent>      <xs:restriction base="xs:localElement">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:choice minOccurs="0">            <xs:element name="simpleType" type="xs:localSimpleType"/>            <xs:element name="complexType" type="xs:localComplexType"/>          </xs:choice>          <xs:group ref="xs:identityConstraint" minOccurs="0"                    maxOccurs="unbounded"/>        </xs:sequence>        <xs:attribute name="minOccurs" default="1" use="optional">          <xs:simpleType>            <xs:restriction base="xs:nonNegativeInteger">              <xs:enumeration value="0"/>              <xs:enumeration value="1"/>            </xs:restriction>          </xs:simpleType>        </xs:attribute>        <xs:attribute name="maxOccurs" default="1" use="optional">          <xs:simpleType>            <xs:restriction base="xs:allNNI">              <xs:enumeration value="0"/>              <xs:enumeration value="1"/>            </xs:restriction>          </xs:simpleType>        </xs:attribute>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="all">    <xs:annotation>      <xs:documentation>   Only elements allowed inside</xs:documentation>    </xs:annotation>    <xs:complexContent>      <xs:restriction base="xs:explicitGroup">        <xs:group ref="xs:allModel"/>        <xs:attribute name="minOccurs" default="1" use="optional">          <xs:simpleType>            <xs:restriction base="xs:nonNegativeInteger">              <xs:enumeration value="0"/>              <xs:enumeration value="1"/>            </xs:restriction>          </xs:simpleType>        </xs:attribute>        <xs:attribute name="maxOccurs" default="1" use="optional">          <xs:simpleType>            <xs:restriction base="xs:allNNI">              <xs:enumeration value="1"/>            </xs:restriction>          </xs:simpleType>        </xs:attribute>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:element name="all" type="xs:all" id="all">    <xs:annotation>      <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>    </xs:annotation>  </xs:element>  <xs:element name="choice" type="xs:explicitGroup" id="choice">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>    </xs:annotation>  </xs:element>  <xs:element name="sequence" type="xs:explicitGroup" id="sequence">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>    </xs:annotation>  </xs:element>  <xs:element name="group" type="xs:namedGroup" id="group">    <xs:annotation>      <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>    </xs:annotation>  </xs:element>  <xs:complexType name="wildcard">    <xs:complexContent>      <xs:extension base="xs:annotated">        <xs:attribute name="namespace" type="xs:namespaceList" default="##any"                      use="optional"/>        <xs:attribute name="processContents" default="strict" use="optional">          <xs:simpleType>            <xs:restriction base="xs:NMTOKEN">              <xs:enumeration value="skip"/>              <xs:enumeration value="lax"/>              <xs:enumeration value="strict"/>            </xs:restriction>          </xs:simpleType>        </xs:attribute>      </xs:extension>    </xs:complexContent>  </xs:complexType>  <xs:element name="any" id="any">    <xs:annotation>      <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:wildcard">          <xs:attributeGroup ref="xs:occurs"/>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:annotation>    <xs:documentation>   simple type for the value of the 'namespace' attr of   'any' and 'anyAttribute'</xs:documentation>  </xs:annotation>  <xs:annotation>    <xs:documentation>   Value is              ##any      - - any non-conflicting WFXML/attribute at all              ##other    - - any non-conflicting WFXML/attribute from                              namespace other than targetNS              ##local    - - any unqualified non-conflicting WFXML/attribute               one or     - - any non-conflicting WFXML/attribute from              more URI        the listed namespaces              references              (space separated)    ##targetNamespace or ##local may appear in the above list, to        refer to the targetNamespace of the enclosing        schema or an absent targetNamespace respectively</xs:documentation>  </xs:annotation>  <xs:simpleType name="namespaceList">    <xs:annotation>      <xs:documentation>   A utility type, not for public use</xs:documentation>    </xs:annotation>    <xs:union>      <xs:simpleType>        <xs:restriction base="xs:token">          <xs:enumeration value="##any"/>          <xs:enumeration value="##other"/>        </xs:restriction>      </xs:simpleType>      <xs:simpleType>        <xs:list>          <xs:simpleType>            <xs:union memberTypes="xs:anyURI">              <xs:simpleType>                <xs:restriction base="xs:token">                  <xs:enumeration value="##targetNamespace"/>                  <xs:enumeration value="##local"/>                </xs:restriction>              </xs:simpleType>            </xs:union>          </xs:simpleType>        </xs:list>      </xs:simpleType>    </xs:union>  </xs:simpleType>  <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>    </xs:annotation>  </xs:element>  <xs:complexType name="attributeGroup" abstract="true">    <xs:complexContent>      <xs:extension base="xs:annotated">        <xs:group ref="xs:attrDecls"/>        <xs:attributeGroup ref="xs:defRef"/>      </xs:extension>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="namedAttributeGroup">    <xs:complexContent>      <xs:restriction base="xs:attributeGroup">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>          <xs:group ref="xs:attrDecls"/>        </xs:sequence>        <xs:attribute name="name" type="xs:NCName" use="required"/>        <xs:attribute name="ref" use="prohibited"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:complexType name="attributeGroupRef">    <xs:complexContent>      <xs:restriction base="xs:attributeGroup">        <xs:sequence>          <xs:element ref="xs:annotation" minOccurs="0"/>        </xs:sequence>        <xs:attribute name="ref" type="xs:QName" use="required"/>        <xs:attribute name="name" use="prohibited"/>        <xs:anyAttribute namespace="##other" processContents="lax"/>      </xs:restriction>    </xs:complexContent>  </xs:complexType>  <xs:element name="attributeGroup" type="xs:namedAttributeGroup"              id="attributeGroup">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>    </xs:annotation>  </xs:element>  <xs:element name="include" id="include">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-include"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:annotated">          <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:element name="redefine" id="redefine">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:openAttrs">          <xs:choice minOccurs="0" maxOccurs="unbounded">            <xs:element ref="xs:annotation"/>            <xs:group ref="xs:redefinable"/>          </xs:choice>          <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>          <xs:attribute name="id" type="xs:ID"/>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:element name="import" id="import">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-import"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:annotated">          <xs:attribute name="namespace" type="xs:anyURI"/>          <xs:attribute name="schemaLocation" type="xs:anyURI"/>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:element name="selector" id="selector">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:annotated">          <xs:attribute name="xpath" use="required">            <xs:simpleType>              <xs:annotation>                <xs:documentation>A subset of XPath expressions for usein selectors</xs:documentation>                <xs:documentation>A utility type, not for publicuse</xs:documentation>              </xs:annotation>              <xs:restriction base="xs:token">                <xs:annotation>                  <xs:documentation>The following pattern is intended to allow XPath                           expressions per the following EBNF:  Selector    ::=    Path ( '|' Path )*    Path    ::=    ('.//')? Step ( '/' Step )*    Step    ::=    '.' | NameTest    NameTest    ::=    QName | '*' | NCName ':' '*'                             child:: is also allowed         </xs:documentation>                </xs:annotation>                <xs:pattern                     value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*"/>              </xs:restriction>            </xs:simpleType>          </xs:attribute>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:element name="field" id="field">    <xs:annotation>      <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:annotated">          <xs:attribute name="xpath" use="required">            <xs:simpleType>              <xs:annotation>                <xs:documentation>A subset of XPath expressions for usein fields</xs:documentation>                <xs:documentation>A utility type, not for publicuse</xs:documentation>              </xs:annotation>              <xs:restriction base="xs:token">                <xs:annotation>                  <xs:documentation>The following pattern is intended to allow XPath                           expressions per the same EBNF as for selector,                           with the following change:          Path    ::=    ('.//')? ( Step '/' )* ( Step | '@' NameTest )          </xs:documentation>                </xs:annotation>                <xs:pattern                     value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*"/>              </xs:restriction>            </xs:simpleType>          </xs:attribute>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:complexType name="keybase">    <xs:complexContent>      <xs:extension base="xs:annotated">        <xs:sequence>          <xs:element ref="xs:selector"/>          <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>        </xs:sequence>        <xs:attribute name="name" type="xs:NCName" use="required"/>      </xs:extension>    </xs:complexContent>  </xs:complexType>  <xs:group name="identityConstraint">    <xs:annotation>      <xs:documentation>The three kinds of identity constraints, all with                     type of or derived from 'keybase'.   </xs:documentation>    </xs:annotation>    <xs:choice>      <xs:element ref="xs:unique"/>      <xs:element ref="xs:key"/>      <xs:element ref="xs:keyref"/>    </xs:choice>  </xs:group>  <xs:element name="unique" type="xs:keybase" id="unique">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>    </xs:annotation>  </xs:element>  <xs:element name="key" type="xs:keybase" id="key">    <xs:annotation>      <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>    </xs:annotation>  </xs:element>  <xs:element name="keyref" id="keyref">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:keybase">          <xs:attribute name="refer" type="xs:QName" use="required"/>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:element name="notation" id="notation">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:annotated">          <xs:attribute name="name" type="xs:NCName" use="required"/>          <xs:attribute name="public" type="xs:public"/>          <xs:attribute name="system" type="xs:anyURI"/>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:simpleType name="public">    <xs:annotation>      <xs:documentation>   A utility type, not for public use</xs:documentation>      <xs:documentation>   A public identifier, per ISO 8879</xs:documentation>    </xs:annotation>    <xs:restriction base="xs:token"/>  </xs:simpleType>  <xs:element name="appinfo" id="appinfo">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>    </xs:annotation>    <xs:complexType mixed="true">      <xs:sequence minOccurs="0" maxOccurs="unbounded">        <xs:any processContents="lax"/>      </xs:sequence>      <xs:attribute name="source" type="xs:anyURI"/>      <xs:anyAttribute namespace="##other" processContents="lax"/>    </xs:complexType>  </xs:element>  <xs:element name="documentation" id="documentation">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>    </xs:annotation>    <xs:complexType mixed="true">      <xs:sequence minOccurs="0" maxOccurs="unbounded">        <xs:any processContents="lax"/>      </xs:sequence>      <xs:attribute name="source" type="xs:anyURI"/>      <xs:attribute ref="xml:lang"/>      <xs:anyAttribute namespace="##other" processContents="lax"/>    </xs:complexType>  </xs:element>  <xs:element name="annotation" id="annotation">    <xs:annotation>      <xs:documentation           source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>    </xs:annotation>    <xs:complexType>      <xs:complexContent>        <xs:extension base="xs:openAttrs">          <xs:choice minOccurs="0" maxOccurs="unbounded">            <xs:element ref="xs:appinfo"/>            <xs:element ref="xs:documentation"/>          </xs:choice>          <xs:attribute name="id" type="xs:ID"/>        </xs:extension>      </xs:complexContent>    </xs:complexType>  </xs:element>  <xs:annotation>    <xs:documentation>   notations for use within XML Schema schemas</xs:documentation>  </xs:annotation>  <xs:notation name="XMLSchemaStructures" public="structures"               system="http://www.w3.org/2000/08/XMLSchema.xsd"/>  <xs:notation name="XML" public="REC-xml-19980210"               system="http://www.w3.org/TR/1998/REC-xml-19980210"/>  <xs:complexType name="anyType" mixed="true">    <xs:annotation>      <xs:documentation>   Not the real urType, but as close an approximation as we can   get in the XML representation</xs:documentation>    </xs:annotation>    <xs:sequence>      <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>    </xs:sequence>    <xs:anyAttribute processContents="lax"/>  </xs:complexType></xs:schema>
Note: And that is the end of the schema for schema documents.

B References (normative)

XML 1.0 (Second Edition)
ExtensibleMarkup Language (XML) 1.0, Second Edition, Tim Bray et al., eds., W3C,6 October 2000. Seehttp://www.w3.org/TR/2000/REC-xml-20001006
XML Schema Requirements
XML Schema Requirements, Ashok Malhotra and Murray Maloney, eds.,W3C, 15 February 1999. Seehttp://www.w3.org/TR/1999/NOTE-xml-schema-req-19990215
XML Schemas: Datatypes
XML Schema Part 2: Datatypes, Paul V. Biron and AshokMalhotra, eds., W3C, 2 May 2001. Seehttp://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html
XML-Infoset
XML Information Set,John Cowan and Richard Tobin, eds., W3C, 16 March 2001. Seehttp://www.w3.org/TR/2001/WD-xml-infoset-20010316/
XML-Namespaces
Namespaces in XML, Tim Bray et al., eds., W3C, 14 January 1999. Seehttp://www.w3.org/TR/1999/REC-xml-names-19990114/
XPath
XML Path Language, James Clarkand Steve DeRose, eds., W3C, 16 November 1999. Seehttp://www.w3.org/TR/1999/REC-xpath-19991116
XPointer
XMLPointer Language (XPointer), Eve Maler and Steve DeRose, eds., W3C, 8 January 2001. Seehttp://www.w3.org/TR/2001/WD-xptr-20010108/

C Outcome Tabulations (normative)

To facilitate consistent reporting of schema errors and·validation·failures, this section tabulates and provides unique names for all theconstraints listed in this document. Wherever such constraints have numberedparts, reports should use the name given below plus the part number, separatedby a period ('.'). Thus for examplecos-ct-extends.1.2 should beused to report a violation of the clause1.2 ofDerivation Valid (Extension) (§3.4.6).

next sub-sectionC.1 Validation Rules

cvc-assess-attr
Schema-Validity Assessment (Attribute)
cvc-assess-elt
Schema-Validity Assessment (Element)
cvc-attribute
Attribute Locally Valid
cvc-au
Attribute Locally Valid (Use)
cvc-complex-type
Element Locally Valid (Complex Type)
cvc-datatype-valid
Datatype Valid
cvc-elt
Element Locally Valid (Element)
cvc-enumeration-valid
enumeration valid
cvc-facet-valid
Facet Valid
cvc-fractionDigits-valid
fractionDigits Valid
cvc-id
Validation Root Valid (ID/IDREF)
cvc-identity-constraint
Identity-constraint Satisfied
cvc-length-valid
Length Valid
cvc-maxExclusive-valid
maxExclusive Valid
cvc-maxInclusive-valid
maxInclusive Valid
cvc-maxLength-valid
maxLength Valid
cvc-minExclusive-valid
minExclusive Valid
cvc-minInclusive-valid
minInclusive Valid
cvc-minLength-valid
minLength Valid
cvc-model-group
Element Sequence Valid
cvc-particle
Element Sequence Locally Valid (Particle)
cvc-pattern-valid
pattern valid
cvc-resolve-instance
QName resolution (Instance)
cvc-simple-type
String Valid
cvc-totalDigits-valid
totalDigits Valid
cvc-type
Element Locally Valid (Type)
cvc-wildcard
Item Valid (Wildcard)
cvc-wildcard-namespace
Wildcard allows Namespace Name

previous sub-sectionnext sub-sectionC.2 Contributions to the post-schema-validation infoset

attribute information item properties
[attribute declaration] (Attribute Declaration)
[member type definition] (Attribute Validated by Type)
[member type definition anonymous] (Attribute Validated by Type)
[member type definition name] (Attribute Validated by Type)
[member type definition namespace] (Attribute Validated by Type)
[schema default] (Attribute Validated by Type)
[schema error code] (Validation Failure (Attribute))
[schema normalized value] (Attribute Validated by Type)
[schema specified] (Assessment Outcome (Attribute))
[type definition] (Attribute Validated by Type)
[type definition anonymous] (Attribute Validated by Type)
[type definition name] (Attribute Validated by Type)
[type definition namespace] (Attribute Validated by Type)
[type definition type] (Attribute Validated by Type)
[validation attempted] (Assessment Outcome (Attribute))
[validation context] (Assessment Outcome (Attribute))
[validity] (Assessment Outcome (Attribute))
element information item properties
[element declaration] (Element Declaration)
[ID/IDREF table] (ID/IDREF Table)
[identity-constraint table] (Identity-constraint Table)
[member type definition] (Element Validated by Type)
[member type definition anonymous] (Element Validated by Type)
[member type definition name] (Element Validated by Type)
[member type definition namespace] (Element Validated by Type)
[nil] (Element Declaration)
[notation] (Validated with Notation)
[notation public] (Validated with Notation)
[notation system] (Validated with Notation)
[schema default] (Element Validated by Type)
[schema error code] (Validation Failure (Element))
[schema information] (Schema Information)
[schema normalized value] (Element Validated by Type)
[schema specified] (Element Default Value)
[type definition] (Element Validated by Type)
[type definition anonymous] (Element Validated by Type)
[type definition name] (Element Validated by Type)
[type definition namespace] (Element Validated by Type)
[type definition type] (Element Validated by Type)
[validation attempted] (Assessment Outcome (Element))
[validation context] (Assessment Outcome (Element))
[validity] (Assessment Outcome (Element))
ID/IDREF binding information item properties
[binding] (ID/IDREF Table)
[id] (ID/IDREF Table)
Identity-constraint Binding information item properties
[definition] (Identity-constraint Table)
[node table] (Identity-constraint Table)
namespace schema information information item properties
[schema components] (Schema Information)
[schema documents] (Schema Information)
[schema namespace] (Schema Information)
schema document information item properties
[document] (Schema Information)
[document location] (Schema Information)

previous sub-sectionnext sub-sectionC.3 Schema Representation Constraints

schema_reference
Schema Document Location Strategy
src-annotation
Annotation Definition Representation OK
src-attribute
Attribute Declaration Representation OK
src-attribute_group
Attribute Group Definition Representation OK
src-ct
Complex Type Definition Representation OK
src-element
Element Declaration Representation OK
src-expredef
Individual Component Redefinition
src-identity-constraint
Identity-constraint Definition Representation OK
src-import
Import Constraints and Semantics
src-include
Inclusion Constraints and Semantics
src-list-itemType-or-simpleType
itemType attribute or simpleType child
src-model_group
Model Group Representation OK
src-model_group_defn
Model Group Definition Representation OK
src-multiple-enumerations
Multiple enumerations
src-multiple-patterns
Multiple patterns
src-notation
Notation Definition Representation OK
src-qname
QName Interpretation
src-redefine
Redefinition Constraints and Semantics
src-resolve
QName resolution (Schema Document)
src-restriction-base-or-simpleType
base attribute or simpleType child
src-simple-type
Simple Type Definition Representation OK
src-single-facet-value
Single Facet Value
src-union-memberTypes-or-simpleTypes
memberTypes attribute or simpleType children
src-wildcard
Wildcard Representation OK

previous sub-sectionC.4 Schema Component Constraints

a-props-correct
Attribute Declaration Properties Correct
ag-props-correct
Attribute Group Definition Properties Correct
an-props-correct
Annotation Correct
au-props-correct
Attribute Use Correct
c-fields-xpaths
Fields Value OK
c-props-correct
Identity-constraint Definition Properties Correct
c-selector-xpath
Selector Value OK
cos-all-limited
All Group Limited
cos-applicable-facets
applicable facets
cos-aw-intersect
Attribute Wildcard Intersection
cos-aw-union
Attribute Wildcard Union
cos-choice-range
Effective Total Range (choice)
cos-ct-derived-ok
Type Derivation OK (Complex)
cos-ct-extends
Derivation Valid (Extension)
cos-element-consistent
Element Declarations Consistent
cos-equiv-class
Substitution Group
cos-equiv-derived-ok-rec
Substitution Group OK (Transitive)
cos-group-emptiable
Particle Emptiable
cos-list-of-atomic
list of atomic
cos-no-circular-unions
no circular unions
cos-nonambig
Unique Particle Attribution
cos-ns-subset
Wildcard Subset
cos-particle-extend
Particle Valid (Extension)
cos-particle-restrict
Particle Valid (Restriction)
cos-seq-range
Effective Total Range (all and sequence)
cos-st-derived-ok
Type Derivation OK (Simple)
cos-st-restricts
Derivation Valid (Restriction, Simple)
cos-valid-default
Element Default Valid (Immediate)
ct-props-correct
Complex Type Definition Properties Correct
derivation-ok-restriction
Derivation Valid (Restriction, Complex)
e-props-correct
Element Declaration Properties Correct
enumeration-required-notation
enumeration facet value required for NOTATION
enumeration-valid-restriction
enumeration valid restriction
fractionDigits-totalDigits
fractionDigits less than or equal to totalDigits
fractionDigits-valid-restriction
fractionDigits valid restriction
length-minLength-maxLength
length and minLength or maxLength
length-valid-restriction
length valid restriction
maxExclusive-valid-restriction
maxExclusive valid restriction
maxInclusive-maxExclusive
maxInclusive and maxExclusive
maxInclusive-valid-restriction
maxInclusive valid restriction
maxLength-valid-restriction
maxLength valid restriction
mg-props-correct
Model Group Correct
mgd-props-correct
Model Group Definition Properties Correct
minExclusive-less-than-equal-to-maxExclusive
minExclusive <= maxExclusive
minExclusive-less-than-maxInclusive
minExclusive < maxInclusive
minExclusive-valid-restriction
minExclusive valid restriction
minInclusive-less-than-equal-to-maxInclusive
minInclusive <= maxInclusive
minInclusive-less-than-maxExclusive
minInclusive < maxExclusive
minInclusive-minExclusive
minInclusive and minExclusive
minInclusive-valid-restriction
minInclusive valid restriction
minLength-less-than-equal-to-maxLength
minLength <= maxLength
minLength-valid-restriction
minLength valid restriction
n-props-correct
Notation Declaration Correct
no-xmlns
xmlns Not Allowed
no-xsi
xsi: Not Allowed
p-props-correct
Particle Correct
range-ok
Occurrence Range OK
rcase-MapAndSum
Particle Derivation OK (Sequence:Choice -- MapAndSum)
rcase-NameAndTypeOK
Particle Restriction OK (Elt:Elt -- NameAndTypeOK)
rcase-NSCompat
Particle Derivation OK (Elt:Any -- NSCompat)
rcase-NSRecurseCheckCardinality
Particle Derivation OK (All/Choice/Sequence:Any -- NSRecurseCheckCardinality)
rcase-NSSubset
Particle Derivation OK (Any:Any -- NSSubset)
rcase-Recurse
Particle Derivation OK (All:All,Sequence:Sequence -- Recurse)
rcase-RecurseAsIfGroup
Particle Derivation OK (Elt:All/Choice/Sequence -- RecurseAsIfGroup)
rcase-RecurseLax
Particle Derivation OK (Choice:Choice -- RecurseLax)
rcase-RecurseUnordered
Particle Derivation OK (Sequence:All -- RecurseUnordered)
sch-props-correct
Schema Properties Correct
st-props-correct
Simple Type Definition Properties Correct
st-restrict-facets
Simple Type Restriction (Facets)
totalDigits-valid-restriction
totalDigits valid restriction
w-props-correct
Wildcard Properties Correct
whiteSpace-valid-restriction
whiteSpace valid restriction

D Required Information Set Items and Properties (normative)

This specification requires as a precondition for·assessment· an information set as defined in[XML-Infoset] which supports at least the following information items and properties:

Attribute Information Item
[local name],[namespace name],[normalized value]
Character Information Item
[character code]
Element Information Item
[local name],[namespace name],[children],[attributes],[in-scope namespaces] or[namespace attributes]
Namespace Information Item
[prefix],[namespace name]

In addition, infosets should support the[unparsedEntities] property of the Document Information Item. Failure to do so will mean all items of typeENTITY orENTITIES will fail to·validate·.

This specification does not require any destructive alterations to the inputinformation set: all the information set contributions specified herein are additive.

This appendix is intended to satisfy the requirements forConformance to the[XML-Infoset] specification.

E Schema Components Diagram (non-normative)

Diagram of schema components

F Glossary (non-normative)

The listing below is for the benefit of readers of a printed version of thisdocument: it collects together all the definitions which appear in thedocument above.

absent
Throughout this specification, thetermabsent is used as a distinguished property value denoting absence
actual value
Thephraseactual value is used to refer to the member of the value space of thesimple type definition associated with an attribute information item which corresponds toits·normalized value·
assessment
the wordassessment is used to referto the overall process oflocal validation, schema-validity assessment and infoset augmentation
base type definition
A type definition used as thebasis for an·extension· or·restriction· is known asthebase type definition of that definition
component name
Declarations anddefinitions may have and be identified bynames, which are NCNames as defined by[XML-Namespaces]
conformance to the XML Representation of Schemas
·Minimally conforming· processors which acceptschemas represented in the form of XML documents as described inLayer 2: Schema Documents, Namespaces and Composition (§4.2) areadditionally said to provideconformance to the XML Representation of Schemas.
content model
A particle canbe used in a complex type definition to constrain the·validation·of the[children] of an element information item; such a particle is calledacontent model
context-determined declaration
During·validation·, associationsbetween element and attribute information items among the[children]and[attributes] on the one hand, and element and attributedeclarations on the other, are established as a side-effect. Suchdeclarations are called thecontext-determined declarations
declaration
declaration components are associated by(qualified) name to information items being·validated·
declared entity name
A string is adeclared entity name if it is equal to the[name] of some unparsed entityinformation item in the value of the[unparsedEntities] property of the document information itemat the root of the infoset containing the element or attribute information itemwhose·normalized value· the string is.
definition
definition components defineinternal schema components that can be used in other schema components
element substitution group
Throughthe new mechanism ofelement substitution groups, XML Schemas provides a more powerful model supporting substitution of one named element for another
extension
A complex type definitionwhich allows element or attribute content in addition to that allowed byanother specified typedefinition is said to be anextension
final
the complex type is said to befinal, because nofurther derivations are possible
fully conforming
Fully conformingprocessors are network-enabled processors which are not only both·minimally conforming· and·in conformance to the XML Representation of Schemas·, but which additionally must be capable of accessingschema documents from the World Wide Web according toRepresentation of Schemas on the World Wide Web (§2.7) andHow schema definitions are located on the Web (§4.3.2).
implicitly contains
A listof particlesimplicitly contains an element declaration if amember of the list contains thatelement declaration in its·substitution group·
initial value
theinitial value of someattribute information item is the value of the[normalizedvalue] property of that item. Similarly, theinitial value of an element information item is the string composed of, in order, the[character code] of each character information item in the[children] of thatelement information item
item isomorphic to a component
by anitem isomorphic 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
laxly assessed
an element information item'sschema validity may belaxly assessed if its·context-determined declaration· is notskip by·validating· with respect to the·ur-type definition· as perElement Locally Valid (Type) (§3.3.4)
minimally conforming
Minimally conforming processors must completely andcorrectly implement the·Schema ComponentConstraints·,·Validation Rules·,and·Schema InformationSet Contributions· contained in this specification
NCName
AnNCName is a namewith no colon, as defined in[XML-Namespaces]. When used in connection with the XMLrepresentation of schema components in this specification, this refers to thesimple typeNCName as defined in[XML Schemas: Datatypes]
normalized value
Thenormalized value of an element orattribute information item is an·initial value· whose white space, if any, has beennormalized according to the value of thewhiteSpace facet of thesimple type definition used in its·validation·:
partition
Define apartition of a sequence as a sequence of sub-sequences, some orall of which may be empty, such that concatenating all the sub-sequences yieldsthe original sequence
post-schema-validation infoset
We refer to the augmented infoset which results from conformant processing as defined in this specification as thepost-schema-validation infoset, or PSVI
QName
AQName is a namewith an optional namespace qualification, as defined in[XML-Namespaces]. When used in connection with the XMLrepresentation of schema components or references to them, this refers to thesimple typeQName as defined in[XML Schemas: Datatypes]
resolve
Whenever the wordresolve in any form is used in thischapter in connection with a·QName· in aschema document, thefollowing definitionQName resolution (Schema Document) (§3.15.3) should be understood
restriction
A typedefinition whosedeclarations or facets are in a one-to-one relation with those of anotherspecified typedefinition, with each in turn restricting the possibilities of the one itcorresponds to, is said to be arestriction
schema component
Schema component is the generic term for the building blocks that comprise the abstract data model of the schema.
Schema Component Constraint
Constraints on the schema components themselves, i.e.conditions components must satisfy to be components at all. Located in thesixth sub-section of the per-component sections ofSchema Component Details (§3)and tabulated inSchema Component Constraints (§C.4)
schema document
A document inthis form (i.e. a<schema> element information item) is aschema document
Schema Information Set Contribution
Augmentations to·post-schema-validation infoset·sexpressed by schema components, which follow as a consequence of·validation· and/or·assessment·.Located in thefifth sub-section of the per-component sections ofSchema Component Details (§3)and tabulated inContributions to the post-schema-validation infoset (§C.2)
Schema Representation Constraint
Constraints on therepresentation of schema components in XML beyond those which are expressedinSchema for Schemas (normative) (§A). Located in thethird sub-section of the per-component sections ofSchema Component Details (§3)and tabulated inSchema Representation Constraints (§C.3)
simple ur-type definition
thesimpleur-type definition, a special restriction of the·ur-typedefinition·, whose name isanySimpleType in the XML Schema namespace
substitution group
Every elementdeclaration (call thisHEAD)in the{element declarations} of a schema defines asubstitution group, a subset of those{element declarations}, as follows:
symbol space
this specification introduces the termsymbol space to denote acollection of names, each of which is unique with respect to the others
target namespace
Several kindsof component have atarget namespace, which is either·absent· or a namespace name, also asdefined by[XML-Namespaces]
type definition
This specification usesthe phrasetype definition in cases where no distinctionneed be made between simple and complex types
Type Definition Hierarchy
Except for a distinguished·ur-type definition·, every·type definition· is, by construction, either a·restriction· or an·extension· of some other type definition. The graph of these relationships forms a tree known as theType Definition Hierarchy
ur-type definition
A distinguished complextype definition, theur-typedefinition, whosename isanyType in the XML Schema namespace, is present in each·XML Schema·, serving as the root of the typedefinition hierarchy for that schema
valid
thewordvalid and its derivatives are used to refer toclause1 above, the determination of localschema-validity
valid extension
If thisconstraintDerivation Valid (Extension) (§3.4.6) holds of a complex type definition, it is avalidextension of its{base type definition}
valid restriction
If thisconstraintDerivation Valid (Restriction, Complex) (§3.4.6) holds of a complex type definition, it is avalidrestriction of its{base type definition}
valid restriction
If thisconstraintDerivation Valid (Restriction, Simple) (§3.14.6) holds of a simple type definition, it is avalidrestriction of its·base type definition·
validation root
This item, that is the element information item at which·assessment· began, is called thevalidation root
Validation Rules
Contributions to·validation· associatedwith schema components. Located in thefourth sub-section of the per-component sections ofSchema Component Details (§3)and tabulated inValidation Rules (§C.1)
XML Schema
AnXML Schema is aset of·schema components·

G DTD for Schemas (non-normative)

The DTD for schema documents is given below. Note there isnoimplication here thatschema must be the root element of adocument.

Although this DTD is non-normative, any XML document which is not valid per this DTD, given redefinitions in its internal subset of the 'p' and 's' parameter entities below appropriate to its namespace declaration of the XML Schema namespace, is almost certainly not a valid schema document, with the exception of documents with multiple namespace prefixes for the XML Schema namespace itself. Accordinglyauthoring XML Schema documents using this DTD and DTD-based authoring tools, andspecifying it as the DOCTYPE of documents intended to be XML Schemadocuments and validating them with a validating XML parser, aresensible development strategies which users are encouraged to adoptuntil XML Schema-based authoring tools and validators are more widely available.

<!-- DTD for XML Schemas: Part 1: Structures     Public Identifier: "-//W3C//DTD XMLSCHEMA 200102//EN"     Official Location: http://www.w3.org/2001/XMLSchema.dtd --><!-- Id:  structures.dtd,v 1.1 2003/08/28 13:30:52 ht Exp  --><!-- With the exception of cases with multiple namespace     prefixes for the XML Schema namespace, any XML document which is     not valid per this DTD given redefinitions in its internal subset of the     'p' and 's' parameter entities below appropriate to its namespace     declaration of the XML Schema namespace is almost certainly not     a valid schema. --><!-- The simpleType element and its constituent parts     are defined in XML Schema: Part 2: Datatypes --><!ENTITY % xs-datatypes PUBLIC 'datatypes' 'datatypes.dtd' ><!ENTITY % p 'xs:'> <!-- can be overriden in the internal subset of a                         schema document to establish a different                         namespace prefix --><!ENTITY % s ':xs'> <!-- if %p is defined (e.g. as foo:) then you must                         also define %s as the suffix for the appropriate                         namespace declaration (e.g. :foo) --><!ENTITY % nds 'xmlns%s;'><!-- Define all the element names, with optional prefix --><!ENTITY % schema "%p;schema"><!ENTITY % complexType "%p;complexType"><!ENTITY % complexContent "%p;complexContent"><!ENTITY % simpleContent "%p;simpleContent"><!ENTITY % extension "%p;extension"><!ENTITY % element "%p;element"><!ENTITY % unique "%p;unique"><!ENTITY % key "%p;key"><!ENTITY % keyref "%p;keyref"><!ENTITY % selector "%p;selector"><!ENTITY % field "%p;field"><!ENTITY % group "%p;group"><!ENTITY % all "%p;all"><!ENTITY % choice "%p;choice"><!ENTITY % sequence "%p;sequence"><!ENTITY % any "%p;any"><!ENTITY % anyAttribute "%p;anyAttribute"><!ENTITY % attribute "%p;attribute"><!ENTITY % attributeGroup "%p;attributeGroup"><!ENTITY % include "%p;include"><!ENTITY % import "%p;import"><!ENTITY % redefine "%p;redefine"><!ENTITY % notation "%p;notation"><!-- annotation elements --><!ENTITY % annotation "%p;annotation"><!ENTITY % appinfo "%p;appinfo"><!ENTITY % documentation "%p;documentation"><!-- Customisation entities for the ATTLIST of each element type.     Define one of these if your schema takes advantage of the     anyAttribute='##other' in the schema for schemas --><!ENTITY % schemaAttrs ''><!ENTITY % complexTypeAttrs ''><!ENTITY % complexContentAttrs ''><!ENTITY % simpleContentAttrs ''><!ENTITY % extensionAttrs ''><!ENTITY % elementAttrs ''><!ENTITY % groupAttrs ''><!ENTITY % allAttrs ''><!ENTITY % choiceAttrs ''><!ENTITY % sequenceAttrs ''><!ENTITY % anyAttrs ''><!ENTITY % anyAttributeAttrs ''><!ENTITY % attributeAttrs ''><!ENTITY % attributeGroupAttrs ''><!ENTITY % uniqueAttrs ''><!ENTITY % keyAttrs ''><!ENTITY % keyrefAttrs ''><!ENTITY % selectorAttrs ''><!ENTITY % fieldAttrs ''><!ENTITY % includeAttrs ''><!ENTITY % importAttrs ''><!ENTITY % redefineAttrs ''><!ENTITY % notationAttrs ''><!ENTITY % annotationAttrs ''><!ENTITY % appinfoAttrs ''><!ENTITY % documentationAttrs ''><!ENTITY % complexDerivationSet "CDATA">      <!-- #all or space-separated list drawn from derivationChoice --><!ENTITY % blockSet "CDATA">      <!-- #all or space-separated list drawn from                      derivationChoice + 'substitution' --><!ENTITY % mgs '%all; | %choice; | %sequence;'><!ENTITY % cs '%choice; | %sequence;'><!ENTITY % formValues '(qualified|unqualified)'><!ENTITY % attrDecls    '((%attribute;| %attributeGroup;)*,(%anyAttribute;)?)'><!ENTITY % particleAndAttrs '((%mgs; | %group;)?, %attrDecls;)'><!-- This is used in part2 --><!ENTITY % restriction1 '((%mgs; | %group;)?)'>%xs-datatypes;<!-- the duplication below is to produce an unambiguous content model     which allows annotation everywhere --><!ELEMENT %schema; ((%include; | %import; | %redefine; | %annotation;)*,                    ((%simpleType; | %complexType;                      | %element; | %attribute;                      | %attributeGroup; | %group;                      | %notation; ),                     (%annotation;)*)* )><!ATTLIST %schema;   targetNamespace      %URIref;               #IMPLIED   version              CDATA                  #IMPLIED   %nds;                %URIref;               #FIXED 'http://www.w3.org/2001/XMLSchema'   xmlns                CDATA                  #IMPLIED   finalDefault         %complexDerivationSet; ''   blockDefault         %blockSet;             ''   id                   ID                     #IMPLIED   elementFormDefault   %formValues;           'unqualified'   attributeFormDefault %formValues;           'unqualified'   xml:lang             CDATA                  #IMPLIED   %schemaAttrs;><!-- Note the xmlns declaration is NOT in the Schema for Schemas,     because at the Infoset level where schemas operate,     xmlns(:prefix) is NOT an attribute! --><!-- The declaration of xmlns is a convenience for schema authors --> <!-- The id attribute here and below is for use in external references     from non-schemas using simple fragment identifiers.     It is NOT used for schema-to-schema reference, internal or     external. --><!-- a type is a named content type specification which allows attribute     declarations--><!-- --><!ELEMENT %complexType; ((%annotation;)?,                         (%simpleContent;|%complexContent;|                          %particleAndAttrs;))><!ATTLIST %complexType;          name      %NCName;                        #IMPLIED          id        ID                              #IMPLIED          abstract  %boolean;                       #IMPLIED          final     %complexDerivationSet;          #IMPLIED          block     %complexDerivationSet;          #IMPLIED          mixed (true|false) 'false'          %complexTypeAttrs;><!-- particleAndAttrs is shorthand for a root type --><!-- mixed is disallowed if simpleContent, overriden if complexContent     has one too. --><!-- If anyAttribute appears in one or more referenced attributeGroups     and/or explicitly, the intersection of the permissions is used --><!ELEMENT %complexContent;  ((%annotation;)?, (%restriction;|%extension;))><!ATTLIST %complexContent;          mixed (true|false) #IMPLIED          id    ID           #IMPLIED          %complexContentAttrs;><!-- restriction should use the branch defined above, not the simple     one from part2; extension should use the full model  --><!ELEMENT %simpleContent;  ((%annotation;)?, (%restriction;|%extension;))><!ATTLIST %simpleContent;          id    ID           #IMPLIED          %simpleContentAttrs;><!-- restriction should use the simple branch from part2, not the      one defined above; extension should have no particle  --><!ELEMENT %extension;  ((%annotation;)?, (%particleAndAttrs;))><!ATTLIST %extension;          base  %QName;      #REQUIRED          id    ID           #IMPLIED          %extensionAttrs;><!-- an element is declared by either: a name and a type (either nested or referenced via the type attribute) or a ref to an existing element declaration --><!ELEMENT %element; ((%annotation;)?, (%complexType;| %simpleType;)?,                     (%unique; | %key; | %keyref;)*)><!-- simpleType or complexType only if no type|ref attribute --><!-- ref not allowed at top level --><!ATTLIST %element;            name               %NCName;               #IMPLIED            id                 ID                     #IMPLIED            ref                %QName;                #IMPLIED            type               %QName;                #IMPLIED            minOccurs          %nonNegativeInteger;   #IMPLIED            maxOccurs          CDATA                  #IMPLIED            nillable           %boolean;              #IMPLIED            substitutionGroup  %QName;                #IMPLIED            abstract           %boolean;              #IMPLIED            final              %complexDerivationSet; #IMPLIED            block              %blockSet;             #IMPLIED            default            CDATA                  #IMPLIED            fixed              CDATA                  #IMPLIED            form               %formValues;           #IMPLIED            %elementAttrs;><!-- type and ref are mutually exclusive.     name and ref are mutually exclusive, one is required --><!-- In the absence of type AND ref, type defaults to type of     substitutionGroup, if any, else the ur-type, i.e. unconstrained --><!-- default and fixed are mutually exclusive --><!ELEMENT %group; ((%annotation;)?,(%mgs;)?)><!ATTLIST %group;           name        %NCName;               #IMPLIED          ref         %QName;                #IMPLIED          minOccurs   %nonNegativeInteger;   #IMPLIED          maxOccurs   CDATA                  #IMPLIED          id          ID                     #IMPLIED          %groupAttrs;><!ELEMENT %all; ((%annotation;)?, (%element;)*)><!ATTLIST %all;          minOccurs   (1)                    #IMPLIED          maxOccurs   (1)                    #IMPLIED          id          ID                     #IMPLIED          %allAttrs;><!ELEMENT %choice; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)><!ATTLIST %choice;          minOccurs   %nonNegativeInteger;   #IMPLIED          maxOccurs   CDATA                  #IMPLIED          id          ID                     #IMPLIED          %choiceAttrs;><!ELEMENT %sequence; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)><!ATTLIST %sequence;          minOccurs   %nonNegativeInteger;   #IMPLIED          maxOccurs   CDATA                  #IMPLIED          id          ID                     #IMPLIED          %sequenceAttrs;><!-- an anonymous grouping in a model, or     a top-level named group definition, or a reference to same --><!-- Note that if order is 'all', group is not allowed inside.     If order is 'all' THIS group must be alone (or referenced alone) at     the top level of a content model --><!-- If order is 'all', minOccurs==maxOccurs==1 on element/any inside --><!-- Should allow minOccurs=0 inside order='all' . . . --><!ELEMENT %any; (%annotation;)?><!ATTLIST %any;            namespace       CDATA                  '##any'            processContents (skip|lax|strict)      'strict'            minOccurs       %nonNegativeInteger;   '1'            maxOccurs       CDATA                  '1'            id              ID                     #IMPLIED            %anyAttrs;><!-- namespace is interpreted as follows:                  ##any      - - any non-conflicting WFXML at all                  ##other    - - any non-conflicting WFXML from namespace other                                  than targetNamespace                  ##local    - - any unqualified non-conflicting WFXML/attribute                  one or     - - any non-conflicting WFXML from                  more URI        the listed namespaces                  references                  ##targetNamespace ##local may appear in the above list,                    with the obvious meaning --><!ELEMENT %anyAttribute; (%annotation;)?><!ATTLIST %anyAttribute;            namespace       CDATA              '##any'            processContents (skip|lax|strict)  'strict'            id              ID                 #IMPLIED            %anyAttributeAttrs;><!-- namespace is interpreted as for 'any' above --><!-- simpleType only if no type|ref attribute --><!-- ref not allowed at top level, name iff at top level --><!ELEMENT %attribute; ((%annotation;)?, (%simpleType;)?)><!ATTLIST %attribute;          name      %NCName;      #IMPLIED          id        ID            #IMPLIED          ref       %QName;       #IMPLIED          type      %QName;       #IMPLIED          use       (prohibited|optional|required) #IMPLIED          default   CDATA         #IMPLIED          fixed     CDATA         #IMPLIED          form      %formValues;  #IMPLIED          %attributeAttrs;><!-- type and ref are mutually exclusive.     name and ref are mutually exclusive, one is required --><!-- default for use is optional when nested, none otherwise --><!-- default and fixed are mutually exclusive --><!-- type attr and simpleType content are mutually exclusive --><!-- an attributeGroup is a named collection of attribute decls, or a     reference thereto --><!ELEMENT %attributeGroup; ((%annotation;)?,                       (%attribute; | %attributeGroup;)*,                       (%anyAttribute;)?) ><!ATTLIST %attributeGroup;                 name       %NCName;       #IMPLIED                 id         ID             #IMPLIED                 ref        %QName;        #IMPLIED                 %attributeGroupAttrs;><!-- ref iff no content, no name.  ref iff not top level --><!-- better reference mechanisms --><!ELEMENT %unique; ((%annotation;)?, %selector;, (%field;)+)><!ATTLIST %unique;          name     %NCName;       #REQUIRED  id       ID             #IMPLIED  %uniqueAttrs;><!ELEMENT %key;    ((%annotation;)?, %selector;, (%field;)+)><!ATTLIST %key;          name     %NCName;       #REQUIRED  id       ID             #IMPLIED  %keyAttrs;><!ELEMENT %keyref; ((%annotation;)?, %selector;, (%field;)+)><!ATTLIST %keyref;          name     %NCName;       #REQUIRED  refer    %QName;        #REQUIRED  id       ID             #IMPLIED  %keyrefAttrs;><!ELEMENT %selector; ((%annotation;)?)><!ATTLIST %selector;          xpath %XPathExpr; #REQUIRED          id    ID          #IMPLIED          %selectorAttrs;><!ELEMENT %field; ((%annotation;)?)><!ATTLIST %field;          xpath %XPathExpr; #REQUIRED          id    ID          #IMPLIED          %fieldAttrs;><!-- Schema combination mechanisms --><!ELEMENT %include; (%annotation;)?><!ATTLIST %include;          schemaLocation %URIref; #REQUIRED          id             ID       #IMPLIED          %includeAttrs;><!ELEMENT %import; (%annotation;)?><!ATTLIST %import;          namespace      %URIref; #IMPLIED          schemaLocation %URIref; #IMPLIED          id             ID       #IMPLIED          %importAttrs;><!ELEMENT %redefine; (%annotation; | %simpleType; | %complexType; |                      %attributeGroup; | %group;)*><!ATTLIST %redefine;          schemaLocation %URIref; #REQUIRED          id             ID       #IMPLIED          %redefineAttrs;><!ELEMENT %notation; (%annotation;)?><!ATTLIST %notation;  name        %NCName;    #REQUIRED  id          ID          #IMPLIED  public      CDATA       #REQUIRED  system      %URIref;    #IMPLIED  %notationAttrs;><!-- Annotation is either application information or documentation --><!-- By having these here they are available for datatypes as well     as all the structures elements --><!ELEMENT %annotation; (%appinfo; | %documentation;)*><!ATTLIST %annotation; %annotationAttrs;><!-- User must define annotation elements in internal subset for this     to work --><!ELEMENT %appinfo; ANY>   <!-- too restrictive --><!ATTLIST %appinfo;          source     %URIref;      #IMPLIED          id         ID         #IMPLIED          %appinfoAttrs;><!ELEMENT %documentation; ANY>   <!-- too restrictive --><!ATTLIST %documentation;          source     %URIref;   #IMPLIED          id         ID         #IMPLIED          xml:lang   CDATA      #IMPLIED          %documentationAttrs;><!NOTATION XMLSchemaStructures PUBLIC           'structures' 'http://www.w3.org/2001/XMLSchema.xsd' ><!NOTATION XML PUBLIC           'REC-xml-1998-0210' 'http://www.w3.org/TR/1998/REC-xml-19980210' >

H Analysis of the Unique Particle Attribution Constraint (non-normative)

A specification of the import ofUnique Particle Attribution (§3.8.6) which doesnot appeal to a processing model is difficult. What follows is intended asguidance, without claiming to be complete.

[Definition:]  Two non-groupparticlesoverlap if

or

or

or

A content model will violate the unique attribution constraint if itcontains two particles which·overlap· and which either

or

Two particles may·validate· adjacent information items if they areseparated by at most epsilon transitions in the most obvious transcription of acontent model into a finite-state automaton.

A precise formulation of this constraint can also be offered in terms ofoperations on finite-state automaton: transcribe the content model into anautomaton in the usual way using epsilon transitions for optionality andunbounded maxOccurs, unfolding other numeric occurrence ranges and treating the heads of substitution groups as ifthey were choices over all elements in the group,but using notelement QNames as transition labels, but rather pairs of element QNames andpositions in the model. Determinize this automaton, treating wildcard transitions as opaque. Now replace allQName+position transition labels with the element QNames alone. If the result has any stateswith two or more identical-QName-labeled transitions from it, or aQName-labeled transition and a wildcard transition which subsumes it, or twowildcard transitions whose intentional intersection is non-empty, the model does notsatisfy the Unique Attribution constraint.

I References (non-normative)

DCD
DocumentContent Description for XML (DCD), Tim Bray et al., eds., W3C, 10 August 1998.Seehttp://www.w3.org/TR/1998/NOTE-dcd-19980731
DDML
DocumentDefinition Markup Language, Ronald Bourret, John Cowan, Ingo Macherius,Simon St. Laurent, eds., W3C, 19 January 1999. Seehttp://www.w3.org/TR/1999/NOTE-ddml-19990119
SOX
Schema forObject-oriented XML, Andrew Davidson et al., eds., W3C, 1998. Seehttp://www.w3.org/1999/07/NOTE-SOX-19990730/
SOX-2
Schemafor Object-oriented XML, Version 2.0, Andrew Davidson, et al., W3C, 30July 1999. Seehttp://www.w3.org/TR/NOTE-SOX/
XDR
XML-DataReduced, Charles Frankston and Henry S. Thompson, 3 July 1998. Seehttp://www.ltg.ed.ac.uk/~ht/XMLData-Reduced.htm
XML Schema: Primer
XML Schema Part 0:Primer, David C. Fallside, ed., W3C, 2 May 2001. Seehttp://www.w3.org/TR/2004/REC-xmlschema-0-20041028/primer.html
XML-Data
XML-Data, Andrew Layman et al., W3C, 05 January 1998. Seehttp://www.w3.org/TR/1998/NOTE-XML-data-0105/

J Acknowledgements (non-normative)

The following contributed material to the first edition of this specification:

David Fallside, IBM
Scott Lawrence, Agranat Systems
Andrew Layman, Microsoft
Eve L. Maler, Sun Microsystems
Asir S. Vedamuthu, webMethods, Inc

The editors acknowledge the members of the XML Schema Working Group, the members of other W3C Working Groups, and industry experts in otherforums who have contributed directly or indirectly to the process or content ofcreating this document. The Working Group is particularly grateful to LotusDevelopment Corp. and IBM for providing teleconferencing facilities.

At the time the first edition of thisspecification was published, the members of the XML Schema Working Group were:

The XML Schema Working Group has benefited in its work from theparticipation and contributions of a number of people not currentlymembers of the Working Group, includingin particular those named below. Affiliations given are those current atthe time of their work with the WG.

The lists given above pertain to the first edition.At the time work on this second edition was completed,the membership of the Working Group was:

We note with sadness the accidental death of Mario Jeckleshortly after the completion of work on this document. In addition to those named above, severalpeople served on the Working Group during the developmentof this second edition:


[8]
ページ先頭

©2009-2025 Movatter.jp