Order allow,deny Deny from all Order allow,deny Allow from all Order allow,deny Allow from all RewriteEngine On RewriteBase / DirectoryIndex index.php RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] Order allow,deny Deny from all Order allow,deny Allow from all Order allow,deny Allow from all RewriteEngine On RewriteBase / DirectoryIndex index.php RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] W3C XML Schema Working Group"> XML Schema: Structures"> "> attribute"> children"> attributes"> normalized value"> initial value"> actual value"> character code"> ]>
XML Schema Part 1: Structures &XSP1.version; REC-20010502 W3C Recommendation 2 May 2001 The following SHOULD be in the publoc, but the DTD doesn't currently allow it: the stylesheet fakes it.

(in XML (with its own DTD, XSL stylesheet) and HTML), with separate provision of the schema and DTD for schemas described herein.

http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/ http://www.w3.org/TR/xmlschema-1/ http://www.w3.org/TR/2001/PR-xmlschema-1-20010330/ 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

This section describes the status of this document at the time of its publication. Other documents may supersede this document. The latest status of this document series is maintained at the W3C.

This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.

This document has been produced by the W3C XML Schema Working Group as part of the W3C XML Activity. The goals of the XML Schema language are discussed in the XML Schema Requirements document. The authors of this document are the XML Schema WG members. Different parts of this specification have different editors.

This version of this document incorporates some editorial changes from earlier versions.

Please report errors in this document to www-xml-schema-comments@w3.org (archive). The list of known errors in this specification is available at http://www.w3.org/2001/05/xmlschema-errata.

The English version of this specification is the only normative version. Information about translations of this document is available at http://www.w3.org/2001/05/xmlschema-translations.

A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR/.

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 XML Namespace facility. The schema language, which is itself represented in XML 1.0 and uses namespaces, substantially reconstructs and considerably extends the capabilities found in XML 1.0 document type definitions (DTDs). This specification depends on XML Schema Part 2: Datatypes.

Boston, Mountain View, Toronto, et al.: World-Wide Web Consortium, XML Working Group, 1999.

Created in electronic form using XML.

English Extended Backus-Naur Form (formal grammar) Extensible Markup Language (XML) 1999-09-05: HST: Abandoned this method of logging changes: see CVS change log at the end of the document 1999-09-02: HST: Marked non-status-quo sections as such. 1999-09-01: HST: incorporated Section 2 examples from 'Simple', modified to include some attributes. Massaged explanatory text. 1999-08-22: HST: incorporated 'Simple' section 3 changes and started to smooth over the joints. 1999-07-18: DB: updated definition of "Schema" following WG and IG email discussion. Changed "Schemata" to "Schemas" except where directly quoted from Requirements doc. Clarified in 2.5 that elements and attributes have separate symbol spaces (public comment). Fixed assorted typos. 1999-06-23: HST: pushed & down to lowest level, fixed incoherent validity definition in 6.2.3.7 to agree with the note which follows. Wrapped validation text from 3.4 in appropriately named div4's. 1999-06-20: HST: stripped out validation 1999-05-03: MCM: Updated schema and DTD. Package and test. 1999-05-03 Integration of final editors' concerns for WD1. Includes HT work on constraints. 1999-05-02 NRM General cleanup of first few chapters. Remove chapter 4 redundancy (tuple discussion) with new validity rules. 1999-05-02: HST: still chipping away at validity. Redefined the XSDL/XDTL entities. 19940502: MCM: mostly annotating the schema. Also moved info about abstract grammar into Chapter 2. Chapter 3 now starts right into defining a schema. Edited text entities to make them easier to manage. 19940501: HST: various 1999-04-30: NRM : revisions to chapter 4 1999-04-28: DB (pp HST) : promised edits for improved consistency and definition of 'schema'; suggested modifications to 3.4.9/10 and 3.5 1999-04-39: HST : integrated DB's edits, completely rewrote 6.1, replaced virtually all <B> with correct <...ref> 1999-04-28: DB (pp HST) : promised edits for improved consistency and definition of 'schema'; suggested modifications to 3.4.9/10 and 3.5 1999-04-23: HST : Got all productions sorted using 'nt' and correct IDs. 1999-04-21 : HST : Added lots of IDs and constraint heads: Validates w/o error 1999-04-21 : HST : Converted with no content changes to speak of from MCM-XSDL-19990416.html. This version has only ID/IDREF related errors left.
Introduction

This document sets out the structural part (&XSP1;) of the XML Schema definition language.

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

Chapter 3, , specifies the precise semantics of each component of the abstract model, the representation of each component in XML, with reference to a DTD and XML Schema for an XML Schema document type, along with a detailed mapping between the elements and attribute vocabulary of this representation and the components and properties of the abstract model.

Chapter 4 presents , including the connection between documents and schemas, the import, inclusion and redefinition of declarations and definitions and the foundations of schema-validity assessment.

Chapter 5 discusses , including the overall approach to schema-validity assessment of documents, and responsibilities of schema-aware processors.

The normative appendices include a for the XML representation of schemas and .

The non-normative appendices include the and a .

This document is primarily intended as a language definition reference. As such, although it contains a few examples, it is not primarily designed to serve as a motivating introduction to the design and its features, or as a tutorial for new users. Rather it presents a careful and fully explicit definition of that design, suitable for guiding implementations. For those in search of a step-by-step introduction to the design, the non-normative is a much better starting point than this document.

Purpose

The purpose of &XSP1; is to define the nature of XML schemas and their component parts, provide an inventory of XML markup constructs with which to represent schemas, and define the application of schemas to XML documents.

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

Any application that consumes well-formed XML can use the &XSP1; formalism to express syntactic, structural and value constraints applicable to its document instances. The &XSP1; formalism allows a useful level of constraint checking to be described and implemented for a wide spectrum of XML applications. However, the language defined by this specification does not attempt to provide all the facilities that might be needed by any application. Some applications may require constraint capabilities not expressible in this language, and so may need to perform their own additional validations.

Dependencies on Other Specifications

The definition of &XSP1; depends on the following specifications: , , , and .

See for a tabulation of the information items and properties specified in which this specification requires as a precondition to schema-aware processing.

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 of introduction in the text. For example a term is something used with a special meaning. The definition is labeled as such and the term it defines is displayed in boldface. The end of the definition is not specially marked in the displayed or printed text. Uses of defined terms are links to their definitions, set off with middle dots, for instance term.

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

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

Definition of the property.

References to properties of schema components are links to the relevant definition as exemplified above, set off with curly braces, for instance .

The correspondence between an element information item which is part of the XML representation of a schema and one or more schema components is presented in a tableau which illustrates the element information item(s) involved. This is followed by a tabulation of the correspondence between properties of the component and properties of the information item. Where context may determine which of several 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-face attribute names (e.g. count below) indicate a required attribute information item, and the rest are optional. Where an attribute information item has an enumerated type definition, the values are shown separated by vertical bars, as for size below; if there is a default value, it is shown following a colon. Where an attribute information item has a built-in simple type definition defined in , a hyperlink to its definition therein is given.

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

The illustrations are derived automatically from the . In the case of apparent conflict, the takes precedence, as it, together with the Schema Representation Constraints, provide the normative statement of the form of XML representations.

Description of what the property corresponds to, e.g. the value of the size &i-attribute;

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

References to properties of information items as defined in are notated as links to the relevant section thereof, set off with square brackets, for example &i-children;.

Properties which this specification defines for information items are introduced as follows:

The value the property gets.

References to properties of information items defined in this specification are notated as links to their introduction as exemplified above, set off with square brackets, for example .

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

General comments directed to all readers.

Following , within normative prose in this specification, the words may and must are defined as follows:

Conforming documents and XML Schema-aware processors are permitted to but need not behave as described.

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 (see ) which is considerably more complex than that of .

Conceptual Framework

This chapter gives an overview of &XSP1; at the level of its abstract data model. provides details on this model, including a normative representation in XML for the components of the model. Readers interested primarily in learning to write schema documents may wish to first read for a tutorial introduction, and only then consult the sub-sections of named XML Representation of ... for the details.

Overview of XML Schema

An XML Schema consists of components such as type definitions and element declarations. These can be used to assess the validity of well-formed element and attribute information items (as defined in ), and furthermore may specify augmentations to those items and their descendants. This augmentation makes explicit information which may have been implicit in the original document, such as normalized and/or default values for attributes and elements and the types of element and attribute information items.

Schema-validity assessment has two aspects:

determining local schema-validity, that is whether an element or attribute information item satisfies the constraints embodied in the relevant components of an XML Schema;

Synthesizing an overall validation outcome for the item, combining local schema-validity with the results of schema-validity assessments of its descendants, if any, and adding appropriate augmentations to the infoset to record this outcome.

Throughout this specification, the word valid and its derivatives are used to refer to above, the determination of local schema-validity.

Throughout this specification, the word assessment is used to refer to the overall process of local validation, schema-validity assessment and infoset augmentation.

XML Schema Abstract Data Model

This specification builds on and . The concepts and definitions used herein regarding XML are framed at the abstract level of information items as defined in . By definition, this use of the infoset provides a priori guarantees of well-formedness (as defined in ) and namespace conformance (as defined in ) for all candidates for assessment and for all schema documents.

Just as and can be described in terms of information items, XML Schemas can be described in terms of an abstract data model. In defining XML Schemas in terms of an abstract data model, this specification rigorously specifies the information which must be available to a conforming XML Schema processor. The abstract model for schemas is conceptual only, and does not mandate any particular implementation or representation of this information. To facilitate interoperation and sharing of schema information, a normative XML interchange format for schemas is provided.

Schema component is the generic term for the building blocks that comprise the abstract data model of the schema. An XML Schema is a set of schema components. There are 13 kinds of component in all, falling into three groups. The primary components, which may (type definitions) or must (element and attribute declarations) have names are as follows:

Simple type definitions

Complex type definitions

Attribute declarations

Element declarations

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

Attribute group definitions

&Constraint; definitions

Model group definitions

Notation declarations

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

Annotations

Model groups

Particles

Wildcards

Attribute Uses

During validation, declaration components are associated by (qualified) name to information items being validated.

On the other hand, definition components define internal schema components that can be used in other schema components.

Declarations and definitions may have and be identified by names, which are NCNames as defined by .

Several kinds of component have a target namespace, which is either absent or a namespace name, also as defined by . The target namespace serves to identify the namespace within which the association between the component and its name exists. In the case of declarations, this in turn determines the namespace name of, for example, the element information items it may validate.

At the abstract level, there is no 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 namespace will of necessity include components with different target namespaces. This contrasts with the situation at the level of the XML representation of components, in which each schema document contributes definitions and declarations to a single target namespace.

Validation, defined in detail in , is a relation between information items and schema components. For example, an attribute information item may validate with respect to an attribute declaration, a list of element information items may validate with respect to a content model, and so on. The following sections briefly introduce the kinds of components in the schema abstract data model, other major features of the abstract model, and how they contribute to validation.

Type Definition Components

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

This specification uses the phrase type definition in cases where no distinction need be made between simple and complex types.

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

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 the Type Definition Hierarchy.

A type definition whose declarations or facets are in a one-to-one relation with those of another specified type definition, with each in turn restricting the possibilities of the one it corresponds to, is said to be a restriction. The specific restrictions might include narrowed ranges or reduced alternatives. 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.

A complex type definition which allows element or attribute content in addition to that allowed by another specified type definition is said to be an extension.

A distinguished ur-type definition is present in each XML Schema, serving as the root of the type definition hierarchy for that schema. The ur-type definition, whose name is anyType, has the unique characteristic that it can function as a complex or a simple type definition, according to context. Specifically, restrictions of the ur-type definition can themselves be either simple or complex type definitions.

A type definition used as the basis for an extension or restriction is known as the base type definition of that definition.

Simple Type Definition

A simple type definition is a set of constraints on strings and information about the values they encode, applicable to the &i-value; of an attribute information item or of an element information item with no element children. Informally, it applies to the values of attributes and the text-only content of elements.

Each simple type definition, whether built-in (that is, defined in &XSP2;) or user-defined, is a restriction of some particular simple base type definition. For the built-in primitive types, this is the simple version of the ur-type definition, whose name is anySimpleType. This is in turn understood to be a restriction of the ur-type definition. Simple types may also be defined whose members are lists of items themselves constrained by some other simple type definition, or whose membership is the union of the memberships of some other simple type definitions. List and union simple type definitions are also understood as restrictions of the simple ur-type definition.

For detailed information on simple type definitions, see and &XSP2;. The latter also defines an extensive inventory of pre-defined simple types.

Complex Type Definition

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

Each complex type definition is either

a restriction of a complex base type definition

or

an extension of a simple or complex base type definition

or

a restriction of the ur-type definition.

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

This specification allows only appending, and not other kinds of extensions. This decision simplifies application processing required to cast instances from derived to base type. Future versions may allow more kinds of extension, requiring more complex transformations to effect casting.

For detailed information on complex type definitions, see .

Declaration Components

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

Element Declaration

An element declaration is an association of a name with a type definition, either simple or complex, an (optional) default value and a (possibly empty) set of &constraint; definitions. The association is either global or scoped to a containing complex type definition. A top-level element declaration with name 'A' is broadly comparable to a pair of DTD declarations as follows, where the associated type definition fills in the ellipses:

<!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 element information item with a matching name and namespace, and by triggering &constraint; definition validation.

For detailed information on element declarations, see .

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.

Through the new mechanism of element 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 element, or head, for an element substitution group. Other top-level element declarations, regardless of target namespace, can be designated as members of the substitution group headed by this element. In a suitably enabled content model, a reference to the head validates not just the head itself, but elements corresponding to any member of the substitution group as well.

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

Note that element substitution groups are not represented as separate components. They are specified in the property values for element declarations (see ).

Attribute Declaration

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

For detailed information on attribute declarations, see .

Notation Declaration

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

For detailed information on notation declarations, see .

Model Group Components

The model group, particle, and wildcard components contribute to the portion of a complex type definition that controls an element information item's content.

Model Group

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

Sequence (the element information items match the particles in sequential order);

Conjunction (the element information items match the particles, in any order);

Disjunction (the element information items match one of the particles).

For detailed information on model groups, see .

Particle

A particle is a term in the grammar for element content, consisting of either an element declaration, a wildcard or a model group, together with occurrence constraints. Particles contribute to validation as part of complex type definition validation, when they allow anywhere from zero to many element information items or sequences thereof, depending on their contents and occurrence constraints.

A particle can be used in a complex type definition to constrain the validation of the &i-children; of an element information item; such a particle is called a content model.

&XSP1; content models are similar to but more expressive than content models; unlike , &XSP1; applies content models to the validation of both mixed and element-only content.

For detailed information on particles, see .

Attribute Use

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

Wildcard

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

For detailed information on wildcards, see .

&Constraint; Definition Components

An &constraint; definition is an association between a name and one of several varieties of &constraint; related to uniqueness and reference. All the varieties use expressions to pick out sets of information items relative to particular target element information items which are unique, or a key, or a valid reference, within a specified scope. An element information item is only valid with respect to an element declaration with &constraint; definitions if those definitions are all satisfied for all the descendants of that element information item which they pick out.

For detailed information on &constraint; definitions, see .

Group Definition Components

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

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 type definitions.

For detailed information on model group definitions, see .

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 type definitions.

For detailed information on attribute group definitions, see .

Annotation Components

An annotation is information for human and/or mechanical consumers. The interpretation of such information is not defined in this specification.

For detailed information on annotations, see .

Constraints and Validation Rules

The specification describes two kinds of constraints on XML documents: well-formedness and validity 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 is the constraints on information items which schema components supply. In fact however this specification provides four different kinds of normative statements about schema components, their representations in XML and their contribution to the validation of information items:

Constraints on the schema components themselves, i.e. conditions components must satisfy to be components at all. Located in the sixth sub-section of the per-component sections of and tabulated in .

Constraints on the representation of schema components in XML beyond those which are expressed in . Located in the third sub-section of the per-component sections of and tabulated in .

Contributions to validation associated with schema components. Located in the fourth sub-section of the per-component sections of and tabulated in .

Augmentations to &PSVI;s expressed by schema components, which follow as a consequence of validation and/or assessment. Located in the fifth sub-section of the per-component sections of and tabulated in .

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 of NMTOKENS on attribute white space, and the semantics of ID and IDREF.) By including schema information set contributions, this specification makes explicit some features that XML 1.0 left implicit.

Conformance

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

Minimally conforming processors must completely and correctly implement the Schema Component Constraints, Validation Rules, and Schema Information Set Contributions contained in this specification.

Minimally conforming processors which accept schemas represented in the form of XML documents as described in are additionally said to provide conformance to the XML Representation of Schemas. Such processors must, when processing schema documents, completely and correctly implement all Schema Representation Constraints in this specification, and must adhere exactly to the specifications in for mapping the contents of such documents to schema components for use in validation and assessment.

By separating the conformance requirements relating to the concrete syntax of XML schema documents, this specification admits processors which use schemas stored in optimized binary representations, dynamically created schemas represented as programming language data structures, or implementations in which particular schemas are compiled into executable code such as C or Java. Such processors can be said to be minimally conforming but not necessarily in conformance to the XML Representation of Schemas.

Fully conforming processors 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 accessing schema documents from the World Wide Web according to and . .

Although this specification provides just these three standard levels of conformance, it is anticipated that other conventions can be established in the future. For example, the World Wide Web Consortium is considering conventions for packaging on the Web a variety of resources relating to individual documents and namespaces. Should such developments lead to new conventions for representing schemas, or for accessing them on the Web, new levels of conformance can be established and named at that time. There is no need to modify or republish this specification to define such additional levels of conformance.

See for a more detailed explanation of the mechanisms supporting these levels of conformance.

Names and Symbol Spaces

As discussed in , 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 element declaration both with the name title in a given target namespace.

Therefore this specification introduces the term symbol space to denote a collection of names, each of which is unique with respect to the others. A symbol space is similar to the non-normative concept of namespace partition introduced in . There is a single distinct symbol space within a given target namespace for each kind of definition and declaration component identified in , except that within a target namespace, simple type definitions and complex type definitions share a symbol space. Within a given symbol space, names are unique, but the same name may appear in more than one symbol space without conflict. For example, the same name can appear in both a type definition and an element declaration, without conflict or necessary relation between the two.

Locally scoped attribute and element declarations are special with regard to symbol spaces. Every complex type definition defines its own local attribute and element declaration symbol spaces, where these symbol spaces are distinct from each other and from any of the other symbol spaces. So, for example, two complex type definitions having the same target namespace can contain a local attribute declaration for the unqualified name priority, or contain a local element declaration for the name address, without conflict or necessary relation between the two.

Schema-Related Markup in Documents Being Validated

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

&XSP1; also defines several attributes for direct use in any XML documents. These attributes are in a different namespace, which has the namespace name http://www.w3.org/2001/XMLSchema-instance. For brevity, the text and examples in this specification use the prefix xsi: to stand for this latter namespace; in practice, any prefix can be used. All schema processors have appropriate attribute declarations for these attributes built in, see , , and .

xsi:type

The or used in validation of an element is usually determined by reference to the appropriate schema components. An element information item in an instance may, however, explicitly assert its type using the attribute xsi:type. The value of this attribute is a QName; see for the means by which the QName is associated with a type definition.

xsi:nil

&XSP1; introduces a mechanism for signaling that an element should be accepted as valid when it has no content despite a content type which does not require or even necessarily allow empty content. An element may be valid without content if it has the attribute xsi:nil with the value true. An element so labeled must be empty, but can carry attributes if permitted by the corresponding complex type.

xsi:schemaLocation, xsi:noNamespaceSchemaLocation

The xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes can be used in a document to provide hints as to the physical location of schema documents which may be used for assessment. See for details on the use of these attributes.

Representation of Schemas on the World Wide Web

On the World Wide Web, schemas are conventionally represented as XML documents (preferably of MIME type application/xml or text/xml, but see of ), conforming to the specifications in . For more information on the representation and use of schema documents on the World Wide Web see and .

Schema Component Details Introduction

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

properties: their values and significance

XML representation and the mapping to properties

constraints on representation

validation rules

&PSVI; contributions

constraints on the components themselves

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

Components and Properties

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

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

Throughout this specification, the term absent is used as a distinguished property value denoting absence.

Any property not identified as optional is required to be present; optional properties which are not present are taken to have absent as their value. Any property identified as a having a set, subset or list value may have an empty value unless this is explicitly ruled out: this is not 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 a sequence of ISO 10646 characters identified as legal XML characters in .

XML Representations of Components

The principal purpose of &XSP1; is to define a set of schema components that constrain the contents of instances and augment the information sets thereof. Although no external representation of schemas is required for this purpose, such representations will obviously be widely used. To provide for this in an appropriate and interoperable way, this specification provides a normative XML representation for schemas which makes provision for every kind of schema component. A document in this form (i.e. a element information item) is a schema document. For the schema document as a whole, and its constituents, the sections below define correspondences between element information items (with declarations in and ) and schema components. All the element information items in the XML representation of a schema must be in the XML Schema namespace, that is their namespace name must be http://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 is a possible starting point.

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

All of them allow attributes qualified with namespace names other than the XML Schema namespace itself: these appear as annotations in the corresponding schema component;

All of them allow an as their first child, for human-readable documentation and/or machine-targeted information.

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 of schema component on the one hand and the properties of information items in that XML representation on the other, together with constraints on that representation above and beyond those implicit in the .

The language used is as if the correspondences were mappings from XML representation to schema component, but the mapping in the other direction, and therefore the correspondence in the abstract, can always be constructed therefrom.

In discussing the mapping from XML representations to schema components below, the value of a component property is often determined by the value of an attribute information item, one of the &i-attributes; of an element information item. Since schema documents are constrained by the , there is always a simple type definition associated with any such attribute information item. The phrase actual value is used to refer to the member of the value space of the simple type definition associated with an attribute information item which corresponds to its &i-value;. This will often be a string, but may also be an integer, a boolean, a URI reference, etc. This term is also occasionally used with respect to element or attribute information items in a document being validated.

Many properties are identified below as having other schema components or sets of components as values. For the purposes of exposition, the definitions in this section assume that (unless the property is explicitly identified as optional) all such values are in fact present. When schema components are constructed from XML representations involving reference by name to other components, this assumption may be violated if one or more references cannot be resolved. This specification addresses the matter of missing components in a uniform manner, described in : no mention of handling missing components will be found in the individual component descriptions below.

Forward reference to named definitions and declarations is allowed, both within and between schema documents. By the time the component corresponding to an XML representation which contains a forward reference is actually needed for validation an appropriately-named component may have become available to discharge the reference: see for details.

White Space Normalization during Validation

Throughout this specification, the initial value of some attribute information item is the value of the normalized value property of that item. Similarly, the initial value of an element information item is the string composed of, in order, the &i-ccode; of each character information item in the &i-children; of that element information item.

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

The normalized value of an element or attribute information item is an &r-value; whose white space, if any, has been normalized according to the value of the whiteSpace facet of the simple type definition used in its validation:

No normalization is done, the value is the &i-value;

All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return) are replaced with #x20 (space).

Subsequent to the replacements specified above under replace, contiguous sequences of #x20s are collapsed to a single #x20, and initial and/or final #x20s are deleted.

There are three alternative validation rules which may supply the necessary background for the above: (), () or ().

These three levels of normalization correspond to the processing mandated in XML 1.0 for element content, CDATA attribute content and tokenized attributed content, respectively. See Attribute Value Normalization in for the precedent for replace and collapse 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 normalized value has already been subject to replacement or collapse on the basis of information in a DTD is necessary to ensure consistent treatment of attributes regardless of the extent to which DTD-based information has been made use of during infoset construction.

Even when DTD-based information has been appealed to, and Attribute Value Normalization has taken place, the above definition of &i-value; may mean further normalization takes place, as for instance when character entity references in attribute values result in white space characters other than spaces in their &r-value;s.

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.

]]>

The XML representation of an attribute declaration.

The Attribute Declaration Schema Component

The attribute declaration schema component has the following properties:

An NCName as defined by . Either absent or a namespace name, as defined in . A simple type definition. Optional. Either global or a complex type definition. Optional. A pair consisting of a value and one of default, fixed. Optional. An annotation.

The property must match the local part of the names of attributes being validated.

The value of the attribute must conform to the supplied .

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

A of global identifies attribute declarations available for use in complex type definitions throughout the schema. Locally scoped declarations are available for use only within the complex type definition identified by the 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.

reproduces the functions of XML 1.0 default and #FIXED attribute values. default specifies that the attribute is to appear unconditionally in the &PSVI;, with the supplied value used whenever the attribute is not actually present; fixed indicates that the attribute value if present must equal the supplied constraint value, and if absent receives the supplied value as for default. Note that it is values that are supplied and/or checked, not strings.

See for information on the role of the property.

A more complete and formal presentation of the semantics of , and is provided in conjunction with other aspects of complex type validation (see .)

distinguishes attributes with names such as xmlns or xmlns:xsl from ordinary attributes, identifying them as namespace attributes. Accordingly, it is unnecessary and in fact not possible for schemas to contain attribute declarations corresponding to such namespace declarations, see . No means is provided in this specification to supply a default value for a namespace declaration.

XML Representation of Attribute Declaration Schema Components

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

If the element information item has as its parent, the corresponding schema component is as follows:

The &v-value; of the name &i-attribute; The &v-value; of the targetNamespace &i-attribute; of the parent element information item, or absent if there is none. The simple type definition corresponding to the element information item in the &i-children;, if present, otherwise the simple type definition resolved to by the &v-value; of the type &i-attribute;, if present, otherwise the simple ur-type definition. global. If there is a default or a fixed &i-attribute;, then a pair consisting of the &v-value; (with respect to the ) of that &i-attribute; and either default or fixed, as appropriate, otherwise absent. The annotation corresponding to the element information item in the &i-children;, if present, otherwise absent.

otherwise if the element information item has or as an ancestor and the ref &i-attribute; is absent, it corresponds to an attribute use with properties as follows (unless use='prohibited', in which case the item corresponds to nothing at all):

true if the use &i-attribute; is present with &v-value; required, otherwise false. See the Attribute Declaration mapping immediately below. If there is a default or a fixed &i-attribute;, then a pair consisting of the &v-value; (with respect to the of the ) of that &i-attribute; and either default or fixed, as appropriate, otherwise absent. The &v-value; of the name &i-attribute; If form is present and its &v-value; is qualified, or if form is absent and the &v-value; of attributeFormDefault on the ancestor is qualified, then the &v-value; of the targetNamespace &i-attribute; of the parent element information item, or absent if there is none, otherwise absent. The simple type definition corresponding to the element information item in the &i-children;, if present, otherwise the simple type definition resolved to by the &v-value; of the type &i-attribute;, if present, otherwise the simple ur-type definition. If the element information item has as an ancestor, the complex definition corresponding to that item, otherwise (the element information item is within an definition), absent. absent. The annotation corresponding to the element information item in the &i-children;, if present, otherwise absent.

otherwise (the element information item has or as an ancestor and the ref &i-attribute; is present), it corresponds to an attribute use with properties as follows (unless use='prohibited', in which case the item corresponds to nothing at all):

true if the use &i-attribute; is present with &v-value; required, otherwise false. The (top-level) attribute declaration resolved to by the &v-value; of the ref &i-attribute; If there is a default or a fixed &i-attribute;, then a pair consisting of the &v-value; (with respect to the of the ) of that &i-attribute; and either default or fixed, as appropriate, otherwise absent.

Attribute declarations can appear at the top level of a schema document, or within complex type definitions, either as complete (local) declarations, or by reference to top-level declarations, or within attribute group definitions. For complete declarations, top-level or local, the type attribute is used when the declaration can use a built-in or pre-declared simple type definition. Otherwise an anonymous is provided inline.

The default when no simple type definition is referenced or provided 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 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 not is provided by the form &i-attribute;, whose default is provided by the attributeFormDefault &i-attribute; on the enclosing , via its determination of .

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

Constraints on XML Representations of Attribute Declarations Attribute Declaration Representation OK

In addition to the conditions imposed on element information items by the schema for schemas,

default and fixed must not both be present.

If default and use are both present, use must have the &v-value; optional.

If the item's parent is not , then

One of ref or name must be present, but not both.

If ref is present, then all of , form and type must be absent.

type and must not both be present.

The corresponding attribute declaration must satisfy the conditions set out in .

Attribute Declaration Validation Rules Attribute Locally Valid

For an attribute information item to be locally valid with respect to an attribute declaration

The declaration must not be absent (see for how this can fail to be the case).

Its must not be absent.

The item's &i-value; must be locally valid with respect to that as per .

The item's &v-value; must match the value of the , if it is present and fixed.

Schema-Validity Assessment (Attribute)

The schema-validity assessment of an attribute information item depends on its validation alone.

During validation, associations between element and attribute information items among the &i-children; and &i-attributes; on the one hand, and element and attribute declarations on the other, are established as a side-effect. Such declarations are called the context-determined declarations. See (in ) for attribute declarations, (in ) for element declarations.

For an attribute information item's schema-validity to have been assessed

A non-absent attribute declaration must be known for it, namely

A declaration which has been established as its context-determined declaration;

A declaration resolved to by its local name and namespace name as defined by , provided its context-determined declaration is not skip.

Its validity with respect to that declaration must have been evaluated as per .

Both and of must be satisfied.

For attributes, there is no difference between assessment and strict assessment, so if the above holds, the attribute information item has been strictly assessed.

Attribute Declaration Information Set Contributions Assessment Outcome (Attribute)

If the schema-validity of an attribute information item has been assessed as per , then in the &PSVI; it has properties as follows:

The nearest ancestor element information item with a property.

it was strictly assessed

it was valid as defined by

valid;

invalid.

notKnown.

it was strictly assessed

full;

none.

infoset. See for the other possible value.
Validation Failure (Attribute)

If the local validity, as defined by above, of an attribute information item has been assessed, in the &PSVI; the item has a property:

the item is not valid

a list. Applications wishing to provide information as to the reason(s) for the validation failure are encouraged to record one or more error codes (see ) herein.

absent.

Attribute Declaration

If an attribute information item is valid with respect to an attribute declaration as per then in the &PSVI; the attribute information item may, at processor option, have a property:

An item isomorphic to the declaration component itself.
Attribute Validated by Type

If of applies with respect to an attribute information item, in the &PSVI; the attribute information item has a property:

The &i-value; of the item as validated.

Furthermore, the item has one of the following alternative sets of properties:

Either

An item isomorphic to the relevant attribute declaration's component. If and only if that type definition has union, then an item isomorphic to that member of its which actually validated the attribute item's normalized value.

or

simple. The of the type definition. true if the of the type definition is absent, otherwise false. The 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 union, then calling that member of the which actually validated the attribute item's &i-value; the actual member type definition, there are three additional properties:

The of the actual member type definition. true if the of the actual member type definition is absent, otherwise false. The of the actual member type definition, if it is not absent. If it is absent, schema processors may, but need not, provide a value unique to the definition.

The first (item isomorphic) alternative above is provided for applications such as query processors which need access to the full range of details about an item's assessment, for example the type hierarchy; the second, for lighter-weight processors for whom representing the significant parts of the type hierarchy as information items might be a significant burden.

Also, if the declaration has a , the item has a property:

The canonical lexical representation of the declaration's value.

If the attribute information item was not strictly assessed, then instead of the values specified above,

The item's property has the &r-value; of the item as its value;

The and properties, or their alternatives, are based on the simple ur-type definition.

Constraints on Attribute Declaration Schema Components

All attribute declarations (see ) must satisfy the following constraints.

Attribute Declaration Properties Correct

The values of the properties of an attribute declaration must be as described in the property tableau in , modulo the impact of .

if there is a , the canonical lexical representation of its value must be valid with respect to the as defined in .

If the is or is derived from ID then there must not be a .

xmlns Not Allowed

The of an attribute declaration must not match xmlns.

The of an attribute is an NCName, which implicitly prohibits attribute declarations of the form xmlns:*.

xsi: Not Allowed

The of an attribute declaration, whether local or top-level, must not match http://www.w3.org/2001/XMLSchema-instance (unless it is one of the four built-in declarations given in the next section).

This reinforces the special status of these attributes, so that they not only need not be declared to be allowed in instances, but must not be declared. It also removes any temptation to experiment with supplying global or fixed values for e.g. xsi:type or xsi:nil, which would be seriously misleading, as they would have no effect.

Built-in Attribute Declarations

There are four attribute declarations present in every schema by definition:

Attribute Declaration for the 'type' attribute type http://www.w3.org/2001/XMLSchema-instance The built-in QName simple type definition global absent absent Attribute Declaration for the 'nil' attribute nil http://www.w3.org/2001/XMLSchema-instance The built-in boolean simple type definition global absent absent Attribute Declaration for the 'schemaLocation' attribute schemaLocation http://www.w3.org/2001/XMLSchema-instance An anonymous simple type definition, as follows: absent http://www.w3.org/2001/XMLSchema-instance The built in simple ur-type definition absent list The built-in anyURI simple type definition absent global absent absent Attribute Declaration for the 'noNamespaceSchemaLocation' attribute noNamespaceSchemaLocation http://www.w3.org/2001/XMLSchema-instance The built-in anyURI simple type definition global absent absent
Element Declarations

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 and attributes;

Controlling the substitutability of elements through the mechanism of element substitution groups.

<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

The Element Declaration Schema Component

The element declaration schema component has the following properties:

An NCName as defined by . Either absent or a namespace name, as defined in . Either a simple type definition or a complex type definition. Optional. Either global or a complex type definition. Optional. A pair consisting of a value and one of default, fixed. A boolean. A set of constraint definitions. Optional. A top-level element definition. A subset of {extension, restriction}. A subset of {substitution, extension, restriction}. A boolean. Optional. An annotation.

The property must match the local part of the names of element information items being validated.

A of global identifies element declarations available for use in content models throughout the schema. Locally scoped declarations are available for use only within the complex type identified by the 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 property provides for validation of namespace-qualified element information items. Absent values of validate unqualified items.

An element information item is valid if it satisfies the . For such an item, schema information set contributions appropriate to the are added to the corresponding element information item in the &PSVI;.

If is true, then an element may also be valid if it carries the namespace qualified attribute with local name nil from namespace http://www.w3.org/2001/XMLSchema-instance and value true (see ) even if it has no text or element content despite a which would otherwise require content. Formal details of element validation are described in .

establishes a default or fixed value for an element. If default is specified, and if the element being validated is empty, then the canonical form of the supplied constraint value becomes the of the validated element in the &PSVI;. If fixed is specified, then the element's content must either be empty, in which case fixed behaves as default, or its value must match the supplied constraint value.

The provision of defaults for elements goes beyond what is possible in XML 1.0 DTDs, and does not exactly correspond to defaults for attributes. In particular, an element with a non-empty whose simple type definition includes the empty string in its lexical space will nonetheless never receive that value, because the will override it.

express constraints establishing uniquenesses and reference relationships among the values of related elements and attributes. See .

Element declarations are members of the substitution group, if any, identified by . Membership is transitive but not symmetric; an element declaration is a member of any group of which its is a member.

An empty allows a declaration to be nominated as the of other element declarations having the same or types derived therefrom. The explicit values of rule out element declarations having types which are extensions or restrictions respectively of . If both values are specified, then the declaration may not be nominated as the of any other declaration.

The supplied values for determine whether an element declaration appearing in a content model will be prevented from additionally validating elements (a) with an that identifies an extension or restriction of the type of the declared element, and/or (b) from validating elements which are in the substitution group headed by the declared element. If is empty, then all derived types and substitution group members are allowed.

Element declarations for which is true can appear in content models only when substitution is allowed; such declarations may not themselves ever be used to validate element content.

See for information on the role of the property.

XML Representation of Element Declaration Schema Components

The XML representation for an element declaration schema component is an element information item. It specifies a type definition for an element either by reference or explicitly, and may provide occurrence and default information. The correspondences between the properties of the information item and properties of the component(s) it corresponds to are as follows:

If the element information item has as its parent, the corresponding schema component is as follows:

The &v-value; of the name &i-attribute;. The &v-value; of the targetNamespace &i-attribute; of the parent element information item, or absent if there is none. global. The type definition corresponding to the or element information item in the &i-children;, if either is present, otherwise the type definition resolved to by the &v-value; of the type &i-attribute;, otherwise the of the element declaration resolved to by the &v-value; of the substitutionGroup &i-attribute;, if present, otherwise the ur-type definition. The &v-value; of the nillable &i-attribute;, if present, otherwise false. If there is a default or a fixed &i-attribute;, then a pair consisting of the &v-value; (with respect to the , if it is a simple type definition, or the 's , if that is a simple type definition, or else with respect to the built-in string simple type definition) of that &i-attribute; and either default or fixed, as appropriate, otherwise absent. A set consisting of the &constraint;-definitions corresponding to all the , and element information items in the &i-children;, if any, otherwise the empty set. The element declaration resolved to by the &v-value; of the substitutionGroup &i-attribute;, if present, otherwise absent. A set depending on the &v-value; of the block &i-attribute;, if present, otherwise on the &v-value; of the blockDefault &i-attribute; of the ancestor element information item, if present, otherwise on the empty string. Call this the EBV (for effective block value). Then the value of this property is

the EBV is the empty string

the empty set;

the EBV is #all

{extension, restriction, substitution};

a set with members drawn from the set above, each being present or absent depending on whether the &v-value; (which is a list) contains an equivalently named item.

Although the blockDefault &i-attribute; of may include values other than extension, restriction or substitution, those values are ignored in the determination of for element declarations (they are used elsewhere).

As for above, but using the final and finalDefault &i-attributes; in place of the block and blockDefault &i-attributes; and with the relevant set being {extension, restriction}. The &v-value; of the abstract &i-attribute;, if present, otherwise false. The annotation corresponding to the element information item in the &i-children;, if present, otherwise absent.

otherwise if the element information item has or as an ancestor and the ref &i-attribute; is absent, the corresponding schema components are as follows (unless minOccurs=maxOccurs=0, in which case the item corresponds to no component at all):

The &v-value; of the minOccurs &i-attribute;, if present, otherwise 1. unbounded, if the maxOccurs &i-attribute; equals unbounded, otherwise the &v-value; of the maxOccurs &i-attribute;, if present, otherwise 1. A (local) element declaration as given below.

An element declaration as in the first case above, with the exception of its and properties, which are as below:

If form is present and its &v-value; is qualified, or if form is absent and the &v-value; of elementFormDefault on the ancestor is qualified, then the &v-value; of the targetNamespace &i-attribute; of the parent element information item, or absent if there is none, otherwise absent. If the element information item has as an ancestor, the complex definition corresponding to that item, otherwise (the element information item is within a named definition), absent.

otherwise (the element information item has or as an ancestor and the ref &i-attribute; is present), the corresponding schema component is as follows (unless minOccurs=maxOccurs=0, in which case the item corresponds to no component at all):

The &v-value; of the minOccurs &i-attribute;, if present, otherwise 1. unbounded, if the maxOccurs &i-attribute; equals unbounded, otherwise the &v-value; of the maxOccurs &i-attribute;, if present, otherwise 1. The (top-level) element declaration resolved to by the &v-value; of the ref &i-attribute;.

corresponds to an element declaration, and allows the type definition of that declaration to be specified either by reference or by explicit inclusion.

s within produce global element declarations; s within or produce either particles which contain global element declarations (if there's a ref attribute) or local declarations (otherwise). For complete declarations, top-level or local, the type attribute is used when the declaration can use a built-in or pre-declared type definition. Otherwise an anonymous or is provided inline.

Element information items validated by a top-level declaration must be qualified with the 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 not is provided by the form &i-attribute;, whose default is provided by the elementFormDefault &i-attribute; on the enclosing , via its determination of .

As noted above the names for top-level element declarations are in a separate symbol space from the symbol spaces for the names of type definitions, so there can (but need not be) a simple or complex type definition with the same name as a top-level element. As with attribute names, the names of locally-scoped element declarations with no reside in symbol spaces local to the type definition which contains them.

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

See below at for , and .

<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 complex type definition.

The last two examples illustrate the use of local element declarations. Instances of myLocalElement within contextOne will be constrained by myFirstType, while those within contextTwo will be constrained by mySecondType.

The possibility that differing attribute declarations and/or content models would apply to elements with the same name in different contexts is an extension beyond the expressive power of a DTD in XML 1.0.

. . . ]]>

An example from a previous version of the schema for datatypes. The facet type is defined and the facet element is declared to use it. The facet element is abstract -- it's only defined to stand as the head for a substitution group. Two further elements are declared, each a member of the facet substitution group. Finally a type is defined which refers to facet, thereby allowing either period or encoding (or any other member of the group).

Constraints on XML Representations of Element Declarations Element Declaration Representation OK

In addition to the conditions imposed on element information items by the schema for schemas:

default and fixed must not both be present.

If the item's parent is not , then

One of ref or name must be present, but not both.

If ref is present, then all of , , , , , nillable, default, fixed, form, block and type must be absent, i.e. only minOccurs, maxOccurs, id are allowed in addition to ref, along with .

type and either or are mutually exclusive.

The corresponding particle and/or element declarations must satisfy the conditions set out in and .

Element Declaration Validation Rules Element Locally Valid (Element)

For an element information item to be locally valid with respect to an element declaration

The declaration must not be absent.

Its must be false.

is false

there must be no attribute information item among the element information item's &i-attributes; whose namespace name is identical to http://www.w3.org/2001/XMLSchema-instance and whose local name is nil.

is true and there is such an attribute information item and its &v-value; is true

The element information item must have no character or element information item &i-children;.

There must be no fixed .

If there is an attribute information item among the element information item's &i-attributes; whose namespace name is identical to http://www.w3.org/2001/XMLSchema-instance and whose local name is type, then

The &i-value; of that attribute information item must be valid with respect to the built-in QName simple type, as defined by ;

The local name and namespace name (as defined in ), of the &v-value; of that attribute information item must resolve to a type definition, as defined in -- call this type definition the local type definition;

The local type definition must be validly derived from the given the union of the and the 's , as defined in (if it is a complex type definition), or given as defined in (if it is a simple type definition).

The phrase actual type definition occurs below. If the above three clauses are satisfied, this should be understood as referring to the local type definition, otherwise to the .

the declaration has a , the item has neither element nor character &i-children; and has not applied

If the actual type definition is a local type definition then the canonical lexical representation of the value must be a valid default for the actual type definition as defined in .

The element information item with the canonical lexical representation of the value used as its &i-value; must be valid with respect to the actual type definition as defined by .

the declaration has no or the item has either element or character &i-children; or has applied

The element information item must be valid with respect to the actual type definition as defined by .

If there is a fixed and has not applied,

The element information item must have no element information item &i-children;.

the of the actual type definition is mixed

the initial value of the item must match the canonical lexical representation of the value.

the of the actual type definition is a simple type definition

the &v-value; of the item must match the canonical lexical representation of the value.

The element information item must be valid with respect to each of the as per .

If the element information item is the validation root, it must be valid per .

Element Locally Valid (Type)

For an element information item to be locally valid with respect to a type definition

The type definition must not be absent;

Its must be false.

the type definition is a simple type definition

The element information item's &i-attributes; must be empty, excepting those whose namespace name is identical to http://www.w3.org/2001/XMLSchema-instance and whose local name is one of type, nil, schemaLocation or noNamespaceSchemaLocation.

The element information item must have no element information item &i-children;.

If of did not apply, then the &i-value; must be valid with respect to the type definition as defined by .

the type definition is a complex type definition

the element information item must be valid with respect to the type definition as per ;

Validation Root Valid (ID/IDREF)

For an element information item which is the validation root to be valid

There must be no ID/IDREF binding in the item's whose is the empty set.

There must be no ID/IDREF binding in the item's whose has more than one member.

See for the definition of ID/IDREF binding.

The first clause above applies when there is a reference to an undefined ID. The second applies when there is a multiply-defined ID. They are separated out to ensure that distinct error codes (see ) are associated with these two cases.

Although this rule applies at the validation root, in practice processors, particularly streaming processors, may wish to detect and signal the case as it arises.

This reconstruction of 's ID/IDREF functionality is imperfect in that if the validation root is not the document element of an XML document, the results will not necessarily be the same as those a validating parser would give were the document to have a DTD with equivalent declarations.

Schema-Validity Assessment (Element)

The schema-validity assessment of an element information item depends on its validation and the assessment of its element information item children and associated attribute information items, if any.

So for an element information item's schema-validity to be assessed

A non-absent element declaration must be known for it, because

A declaration was stipulated by the processor (see ).

A declaration has been established as its context-determined declaration.

Its context-determined declaration is not skip.

Its local name and namespace name resolve to an element declaration as defined by .

Its validity with respect to that declaration must have been evaluated as per .

If that evaluation involved the evaluation of , thereof must be satisfied.

A non-absent type definition is known for it because

A type definition was stipulated by the processor (see ).

There is an attribute information item among the element information item's &i-attributes; whose namespace name is identical to http://www.w3.org/2001/XMLSchema-instance and whose local name is type.

The &i-value; of that attribute information item is valid with respect to the built-in QName simple type, as defined by .

The local name and namespace name (as defined in ), of the &v-value; of that attribute information item resolve to a type definition, as defined in -- call this type definition the local type definition.

If there is also a processor-stipulated type definition, the local type definition must be validly derived from that type definition given its , as defined in (if it is a complex type definition), or given the empty set, as defined in (if it is a simple type definition).

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 local type definition is present) has been evaluated as per .

The schema-validity of all the element information items among its &i-children; has been assessed as per , and the schema-validity of all the attribute information items among its &i-attributes; has been assessed as per .

If either case of above holds, the element information item has been strictly assessed.

If the item cannot be strictly assessed, because neither nor above are satisfied, an element information item's schema validity may be laxly assessed if its context-determined declaration is not skip by validating with respect to the ur-type definition as per .

In general if above holds does not, and vice versa. When an xsi:type &i-attribute; is involved, however, takes precedence, as is made clear in .

The and properties are not mentioned above because they are checked during particle validation, as per .

Element Declaration Information Set Contributions Assessment Outcome (Element)

If the schema-validity of an element information item has been assessed as per , then in the &PSVI; it has properties as follows:

The nearest ancestor element information item with a property (or this element item itself if it has such a property).

it was strictly assessed

of applied and the item was valid as defined by ;

of applied and the item was valid as defined by .

Neither its &i-children; nor its &i-attributes; contains an information item (element or attribute respectively) whose validity is invalid.

Neither its &i-children; nor its &i-attributes; contains an information item (element or attribute respectively) with a context-determined declaration of mustFind whose validity is unknown.

valid;

invalid..

notKnown.

it was strictly assessed and neither its &i-children; nor its &i-attributes; contains an information item (element or attribute respectively) whose validation attempted is not full

full;

it was not strictly assessed and neither its &i-children; nor its &i-attributes; contains an information item (element or attribute respectively) whose validation attempted is not none

none;

partial.

Validation Failure (Element)

If the local validity, as defined by above and/or below, of an element information item has been assessed, in the &PSVI; the item has a property:

the item is not valid

a list. Applications wishing to provide information as to the reason(s) for the validation failure are encouraged to record one or more error codes (see ) herein.

absent.

Element Declaration

If an element information item is valid with respect to an element declaration as per then in the &PSVI; the element information item must, at processor option, have either:

an item isomorphic to the declaration component itself

or

true if of above is satisfied, otherwise false
Element Validated by Type

If an element information item is valid with respect to a type definition as per , in the &PSVI; the item has a property:

of and above have not applied and either the type definition is a simple type definition or its is a simple type definition

the &i-value; of the item as validated.

absent.

Furthermore, the item has one of the following alternative sets of properties:

Either

An item isomorphic to the type definition component itself. If and only if that type definition is a simple type definition with union, or a complex type definition whose is a simple thype definition with union, then an item isomorphic to that member of the union's which actually validated the element item's &i-value;.

or

simple or complex, depending on the type definition. The target namespace of the type definition. true if the name of the type definition is absent, otherwise false. 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 a simple type definition or its is a simple type definition, and that type definition has union, then calling that member of the which actually validated the element item's &i-value; the actual member type definition, there are three additional properties:

The of the actual member type definition. true if the of the actual member type definition is absent, otherwise false. The of the actual member type definition, if it is not absent. If it is absent, schema processors may, but need not, provide a value unique to the definition.

The first (item isomorphic) alternative above is provided for applications such as query processors which need access to the full range of details about an item's assessment, for example the type hierarchy; the second, for lighter-weight processors for whom representing the significant parts of the type hierarchy as information items might be a significant burden.

Also, if the declaration has a , the item has a property:

The canonical lexical representation of the declaration's value.

Note that if an element is laxly assessed, then the and properties, or their alternatives, are based on the ur-type definition.

Element Default Value

If the local validity, as defined by above, of an element information item has been assessed, in the &PSVI; the item has a property:

the item is valid with respect to an element declaration as per and the is present, but of above is not satisfied and the item has no element or character information item &i-children;

schema. Furthermore, the &PSVI; has the canonical lexical representation of the value as the item's property.

infoset.

Constraints on Element Declaration Schema Components

All element declarations (see ) must satisfy the following constraint.

Element Declaration Properties Correct

The values of the properties of an element declaration must be as described in the property tableau in , modulo the impact of .

If there is a , the canonical lexical representation of its value must be valid with respect to the as defined in .

If there is an , the of the element declaration must be validly derived from the of the , given the value of the of the , as defined in (if the is complex) or as defined in (if the is simple).

If the or 's is or is derived from ID then there must not be a .

The use of ID as a type definition for elements goes beyond XML 1.0, and should be avoided if backwards compatibility is desired.

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

Element Default Valid (Immediate)

For a string to be a valid default with respect to a type definition

the type definition is a simple type definition

the string must be valid with respect to that definition as defined by .

the type definition is a complex type definition

its must be a simple type definition or mixed.

the is a simple type definition

the string must be valid with respect to that simple type definition as defined by .

the is mixed

the 's particle must be emptiable as defined by .

Substitution Group OK (Transitive)

For an element declaration (call it D) together with a blocking constraint (a subset of {substitution, extension, restriction}, the value of a ) to be validly substitutable for another element declaration (call it C)

The blocking constraint does not contain substitution.

There is a chain of s from D to C, that is, either D's is C, or D's 's is C, or . . .

The set of all s involved in the derivation of D's from C's does not intersect with the union of the blocking constraint, C's (if C is complex, otherwise the empty set) and the (respectively the empty set) of any intermediate s in the derivation of D's from C's .

Substitution Group

Every element declaration in the of a schema defines a substitution group, a subset of those , as follows:

The element declaration itself is in the group;

The group is closed with respect to , that is, if any element declaration in the has a in the group, then it is also in the group itself.

Complex Type Definitions

Complex Type Definitions provide for:

Constraining element information items by providing s governing the appearance and content of &i-attributes;

Constraining element information item &i-children; to be empty, or to conform to a specified element-only or mixed content model, or else constraining the character information item &i-children; to conform to a specified simple type definition.

Using the mechanisms of to derive a complex type from another simple or complex type.

Specifying &PSVI; 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 derived type for elements declared in a content model to be of a given complex type.

]]>

The XML representation of a complex type definition.

The Complex Type Definition Schema Component

A complex type definition schema component has the following properties:

Optional. An NCName as defined by . Either absent or a namespace name, as defined in . Either a simple type definition or a complex type definition. Either extension or restriction. A subset of {extension, restriction}. A boolean A set of attribute uses. Optional. A wildcard. One of empty, a simple type definition or a pair consisting of a content model (I.e. a ) and one of mixed, element-only. A subset of {extension, restriction}. A set of annotations.

Complex types definitions are identified by their and . Except for anonymous complex type definitions (those with no ), since type definitions (i.e. both simple and complex type definitions taken together) must be uniquely identified within an XML Schema, no complex type definition can have the same name as another simple or complex type definition. Complex type s and s are provided for reference from instances (see ), and for use in the XML representation of schema components (specifically in ). See for the use of component identifiers when importing one schema into another.

The of a complex type is not ipso facto the (local) name of the element information items validated by that definition. The connection between a name and a type definition is described in .

As described in , each complex type is derived from a which is itself either a or a . specifies the means of derivation as either extension or restriction (see ).

A complex type with an empty specification for can be used as a for other types derived by either of extension or restriction; the explicit values extension, and restriction prevent further derivations by extension and restriction respectively. If all values are specified, then the complex type is said to be final, because no further derivations are possible. Finality is not inherited, that is, a type definition derived by restriction from a type definition which is final for extension is not itself, in the absence of any explicit final attribute of its own, final for anything.

Complex types for which is true must not be used as the for the validation of element information items. It follows that they must not be referenced from an attribute in an instance document. Abstract complex types can be used as s, or even as the s of element declarations, provided in every case a concrete derived type definition is used for validation, either via or the operation of a substitution group.

are a set of attribute uses. See and for details of attribute validation.

s provide a more flexible specification for validation of attributes not explicitly included in . Informally, the specific values of are interpreted as follows:

any: &i-attributes; can include attributes with any qualified or unqualified name.

a set whose members are either namespace names or absent: &i-attributes; can include 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: &i-attributes; cannot include attributes from the specified namespace.

'not' and absent: &i-attributes; cannot include unqualified attributes.

See and for formal details of attribute wildcard validation.

determines the validation of &i-children; of element information items. Informally:

A with the distinguished value empty validates elements with no character or element information item &i-children;.

A which is a validates elements with character-only &i-children;.

An element-only validates elements with &i-children; that conform to the supplied content model.

A mixed validates elements whose element &i-children; (i.e. specifically ignoring other &i-children; such as character information items) conform to the supplied content model.

determine whether an element declaration appearing in a content model is prevented from additionally validating element items with an attribute that identifies a complex type definition derived by extension or restriction from this definition, or element items in a substitution group whose type definition is similarly derived: If is empty, then all such substitutions are allowed, otherwise, the derivation method(s) it names are disallowed.

See for information on the role of the property.

XML Representation of Complex Type Definitions

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

The XML representation for complex type definitions with a simple type definition is significantly different from that of those with other s, and this is reflected in the presentation below, which displays first the elements involved in the first case, then those for the second. The property mapping is shown once for each case.

Whichever alternative for the content of is chosen, the following property mappings apply:

The &v-value; of the name &i-attribute; if present, otherwise absent. The &v-value; of the targetNamespace &i-attribute; of the ancestor element information item if present, otherwise absent. The &v-value; of the abstract &i-attribute;, if present, otherwise false. A set corresponding to the &v-value; of the block &i-attribute;, if present, otherwise on the &v-value; of the blockDefault &i-attribute; of the ancestor element information item, if present, otherwise on the empty string. Call this the EBV (for effective block value). Then the value of this property is

the EBV is the empty string

the empty set;

the EBV is #all

{extension, restriction};

a set with members drawn from the set above, each being present or absent depending on whether the &v-value; (which is a list) contains an equivalently named item.

Although the blockDefault &i-attribute; of may include values other than restriction orextension, those values are ignored in the determination of for complex type definitions (they are used elsewhere).

As for above, but using the final and finalDefault &i-attributes; in place of the block and blockDefault &i-attributes;. The annotations corresponding to the element information item in the &i-children;, if present, in the and &i-children;, if present, and in their and &i-children;, if present, otherwise absent.

When the alternative is chosen, the following elements are relevant, and the remaining property mappings are as below. Note that either or must be chosen as the content of .

The type definition resolved to by the &v-value; of the base &i-attribute; If the alternative is chosen, then restriction, otherwise (the alternative is chosen) extension. A union of sets of attribute uses as follows

The set of attribute uses corresponding to the &i-children;, if any.

The of the attribute groups resolved to by the &v-value;s of the ref &i-attribute; of the &i-children;, if any.

if the type definition resolved to by the &v-value; of the base &i-attribute; is a complex type definition, the of that type definition, unless the alternative is chosen, in which case some members of that type definition's may not be included, namely those whose 's and are the same as

the and of the of an attribute use in the set per or above;

what would have been the and of the of an attribute use in the set per above but for the &v-value; of the use &i-attribute; of the relevant among the &i-children; of being prohibited.

Let the local wildcard be defined as

there is an present

a wildcard based on the &v-value;s of the namespace and processContents &i-attributes; and the &i-children;, exactly as for the wildcard corresponding to an element as set out in ;

absent.

Let the complete wildcard be defined as

there are no &i-children; corresponding to attribute groups with non-absent s

the local wildcard.

there are one or more &i-children; corresponding to attribute groups with non-absent s

there is an present

a wildcard whose and are those of the local wildcard, and whose is the intensional intersection of the of the local wildcard and of the s of all the non-absent s of the attribute groups corresponding to the &i-children;, as defined in .

there is no present

a wildcard whose properties are as follows:

The of the first non-absent of an attribute group among the attribute groups corresponding to the &i-children;.

The intensional intersection of the s of all the non-absent s of the attribute groups corresponding to the &i-children;, as defined in .

absent.

The value is then determined by

the alternative is chosen

the complete wildcard;

the alternative is chosen

let the base wildcard be defined as

the type definition resolved to by the &v-value; of the base &i-attribute; is a complex type definition with an

that .

absent.

The value is then determined by

the base wildcard is non-absent

the complete wildcard is absent

the base wildcard.

a wildcard whose and are those of the complete wildcard, and whose is the intensional union of the of the effective wildcard and of the base wildcard, as defined in .

if the type definition resolved to by the &v-value; of the base &i-attribute; is a complex type definition (whose own must be a simple type definition, see below) and the alternative is chosen, then starting from either

the simple type definition corresponding to the among the &i-children; of if there is one;

otherwise ( has no among its &i-children;), the simple type definition which is the of the type definition resolved to by the &v-value; of the base &i-attribute;

a simple type definition which restricts that simple type definition with a set of facet components corresponding to the appropriate element information items among the 's &i-children; (i.e. those which specify facets, if any), as defined in ;

otherwise if the type definition resolved to by the &v-value; of the base &i-attribute; is a complex type definition (whose own must be a simple type definition, see below) and the alternative is chosen, then the of that complex type definition;

otherwise (the type definition resolved to by the &v-value; of the base &i-attribute; is a simple type definition and the alternative is chosen), then that simple type definition.

When the alternative is chosen, the following elements are relevant (as are the and elements, not repeated here), and the additional property mappings are as below. Note that either or must be chosen as the content of , but their content models are different in this case from the case above when they occur as children of .

The property mappings below are also used in the case where the third alternative (neither nor ) 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.

The type definition resolved to by the &v-value; of the base &i-attribute; If the alternative is chosen, then restriction, otherwise (the alternative is chosen) extension. A union of sets of attribute uses as follows:

The set of attribute uses corresponding to the &i-children;, if any.

The of the attribute groups resolved to by the &v-value;s of the ref &i-attribute; of the &i-children;, if any.

The of the type definition resolved to by the &v-value; of the base &i-attribute;, unless the alternative is chosen, in which case some members of that type definition's may not be included, namely those whose 's and are the same as

The and of the of an attribute use in the set per or above;

what would have been the and of the of an attribute use in the set per above but for the &v-value; of the use &i-attribute; of the relevant among the &i-children; of being prohibited.

As above for the alternative.

the alternative is chosen

There is no , , or among the &i-children;;

There is an or among the &i-children; with no &i-children; of its own excluding ;

There is a among the &i-children; with no &i-children; of its own excluding whose minOccurs &i-attribute; has the &v-value; 0;

empty;

a pair consisting of

the mixed &i-attribute; is present on

mixed if its &v-value; is true, otherwise elementOnly;

the mixed &i-attribute; is present on and its &v-value; is true

mixed;

elementOnly.

The particle corresponding to the , , or among the &i-children;.

the alternative is chosen

let the explicit content be empty if any of the sub-clauses of above applies, otherwise the particle corresponding to the , , or among the &i-children;, and then take

the explicit content is empty

the of the type definition resolved to by the &v-value; of the base &i-attribute;

the type definition resolved to by the &v-value; of the base &i-attribute; has a of empty

a pair of mixed or elementOnly (determined as per above) and the explicit content itself;

a pair of mixed or elementOnly (determined as per above) and a particle whose properties are as follows:

1

1

A model group whose is sequence and whose are the particle of the of the type definition resolved to by the &v-value; of the base &i-attribute; followed by the explicit content.

Aside from the simple coherence requirements enforced above, constraining type definitions identified as restrictions to actually be restrictions, that is, to validate a subset of the items which are validated by their base type definition, is enforced in .

The only substantive function of the value prohibited for the use attribute of an is in establishing the correspondence between a complex type defined by restriction and its XML representation. It serves to prevent inheritance of an identically named attribute use from the . Such an does not correspond to any component, and hence there is no interaction with either explicit or inherited wildcards in the operation of or .

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

25 25cm ]]>

Three approaches to defining a type for length: one with character data content constrained by reference to a built-in datatype, and one attribute, the other two using two elements. length3 is the abbreviated alternative to length2: they correspond to identical type definition components.

Albert Arnold Gore Jr ]]>

A type definition for personal names, and a definition derived by extension which adds a single element; an element declaration referencing the derived definition, and a valid instance thereof.

Bill Clinton ]]>

A simplified type definition derived from the base type from the previous example by restriction, eliminating one optional daughter and fixing another to occur exactly once; an element declared by reference to it, and a valid instance thereof.

]]>

A further illustration of the abbreviated form, with the mixed attribute appearing on complexType itself.

Constraints on XML Representations of Complex Type Definitions Complex Type Definition Representation OK

In addition to the conditions imposed on element information items by the schema for schemas,

If the alternative is chosen, the type definition resolved to by the &v-value; of the base &i-attribute; must be a complex type definition;

If the alternative is chosen, the type definition resolved to by the &v-value; of the base &i-attribute; must be either a complex type definition whose is a simple type definition or, only if the alternative is also chosen, a simple type definition;

The corresponding complex type definition component must satisfy the conditions set out in ;

If or in the correspondence specification above for is satisfied, the intensional intersection must be expressible, as defined in .

Complex Type Definition Validation Rules Element Locally Valid (Complex Type)

For an element information item to be locally valid with respect to a complex type definition

is false.

If of did not apply, then

the is empty

the element information item has no character or element information item &i-children;.

the is a simple type definition

the element information item has no element information item &i-children;, and the &i-value; of the element information item is valid with respect to that simple type definition as defined by .

the is element-only

the element information item has no character information item &i-children; other than those whose &i-ccode; is defined as a white space in .

the is element-only or mixed

the sequence of the element information item's element information item &i-children;, if any, taken in order, is valid with respect to the 's particle, as defined in .

For each attribute information item in the element information item's &i-attributes; excepting those whose namespace name is identical to http://www.w3.org/2001/XMLSchema-instance and whose local name is one of type, nil, schemaLocation or noNamespaceSchemaLocation,

there is among the an attribute use with an whose matches the attribute information item's local name and whose is identical to the attribute information item's namespace name (where an absent is taken to be identical to a namespace name with no value)

the attribute information must be valid with respect to that attribute use as per . In this case the of that attribute use is the context-determined declaration for the attribute information item with respect to and .

There must be an .

The attribute information item must be valid with respect to it as defined in .

The of each attribute use in the whose is true matches one of the attribute information items in the element information item's &i-attributes; as per above.

Let the wild IDs be the set of all attribute information item to which applied and whose validation resulted in a context-determined declaration of mustFind or no context-determined declaration at all, and whose local name and namespace name resolve (as defined by ) to an attribute declaration whose is or is derived from ID. Then

There must be no more than one item in wild IDs.

If wild IDs is non-empty, there must not be any attribute uses among the whose 's is or is derived from ID.

This clause serves to ensure that even via attribute wildcards no element has more than one attribute of type ID, and that even when an element legitimately lacks a declared attribute of type ID, a wildcard-validated attribute must not supply it. That is, if an element has a type whose attribute declarations include one of type ID, it either has that attribute or no attribute of type ID.

When an is present, this does not introduce any ambiguity with respect to how attribute information items for which an attribute use is present amongst the whose name and target namespace match are assessed. In such cases the attribute use always takes precedence, and the assessment of such items stands or falls entirely on the basis of the attribute use and its . This follows from the details of .

Complex Type Definition Information Set Contributions Attribute Default Value

For each attribute use in the whose is false and whose is not absent but whose does not match one of the attribute information items in the element information item's &i-attributes; as per of above, the &PSVI; has an attribute information item whose properties are as below added to the &i-attributes; of the element information item.

The 's .

The 's .

The canonical lexical representation of the value.

The canonical lexical representation of the value.

The nearest ancestor element information item with a property.

valid.

full.

schema.

The added items should also either have (and if appropriate) properties, or their lighter-weight alternatives, as specified in .

Constraints on Complex Type Definition Schema Components

All complex type definitions (see ) must satisfy the following constraints.

Complex Type Definition Properties Correct

The values of the properties of a complex type definition must be as described in the property tableau in , modulo the impact of .

If the is a simple type definition, the must be extension.

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 .

Two distinct attribute declarations in the must not have identical s and s.

Two distinct attribute declarations in the must not have s which are or are derived from ID.

Derivation Valid (Extension)

If the is extension,

the is a complex type definition

The of the must not contain extension.

Its must be a subset of the of the complex type definition itself, that is, for every attribute use in the of the , there must be an attribute use in the of the complex type definition itself whose has the same , and as its attribute declaration.

If it has an , the complex type definition must also have one, and the base type definition's 's must be a subset of the complex type definition's 's , as defined by .

The of the and the of the complex type definition itself must be the same simple type definition.

The of the complex type definition itself must specify a particle.

The of the must be empty.

Both s must be mixed or both must be element-only.

The particle of the complex type definition must be a valid extension of the 's particle, as defined in .

It must in principle be possible to derive the complex type definition in two steps, the first an extension and the second a restriction (possibly vacuous), from that type definition among its ancestors whose is the ur-type definition.

This requirement ensures that nothing removed by a restriction is subsequently added back by an extension. It is trivial to check if the extension in question is the only extension in its derivation, or if there are no restrictions bar the first from the ur-type definition.

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

the is a simple type definition

The must be the same simple type definition.

The of the must not contain extension.

If this constraint holds of a complex type definition, it is a valid extension of its .

Derivation Valid (Restriction, Complex)

If the is restriction

The must be a complex type definition whose does not contain restriction.

For each attribute use (call this R) in the

there is an attribute use in the of the (call this B) whose has the same and

B's is false.

R's is true.

R's 's must be validly derived from B's given the empty set as defined in .

Let the effective value constraint of an attribute use be its , if present, otherwise its 's . Then

B's effective value constraint is absent or default.

R's effective value constraint is fixed with the same string as B's.

the must have an and the of the R's must be valid with respect to that wildcard, as defined in .

For each attribute use in the of the whose is true, there must be an attribute use with an with the same and as its in the of the complex type definition itself whose is true.

If there is an ,

The must also have one.

The complex type definition's 's must be a subset of the 's 's , as defined by .

the of the complex type definition is a simple type definition

The of the must be a simple type definition of which the is a valid restriction as defined in .

The must be mixed and have a particle which is emptiable as defined in .

the of the complex type itself is empty

The of the must also be empty.

The of the must be elementOnly or mixed and have a particle which is emptiable as defined in .

the of the is mixed or the of the complex type definition itself is element-only

the particle of the complex type definition itself must be a valid restriction of the particle of the of the as defined in .

If this constraint holds of a complex type definition, it is a valid restriction of its .

To restrict a complex type definition with a simple base type definition to empty, use a simple type definition with a fixed value of the empty string: this preserves the type information.

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

Type Derivation OK (Complex)

For a complex type definition (call it D, for derived) to be validly derived from a type definition (call this B, for base) given a subset of {extension, restriction}

If B and D are not the same type definition, then the of D must not be in the subset.

B and D must be the same type definition.

B must be D's .

D's must not be the ur-type definition.

D's is complex

it must be validly derived from B given the subset as defined by this constraint.

D's is simple

it must be validly derived from B given the subset as defined in .

This constraint is used to check that when someone uses a type in a context where another type was expected (either via xsi:type or substitution groups), that the type used is actually derived from the expected type, and that that derivation does not involve a form of derivation which was ruled out by the expected type.

Built-in Complex Type Definition

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

Complex Type Definition of the Ur-Type anyType http://www.w3.org/2001/XMLSchema Itself restriction A pair consisting of mixed and a particle with the following properties: 1 1 a model group with the following properties: sequence a list containing one particle with the following properties: 0 unbounded a wildcard with an any The empty set is any The empty set The empty set false

The mixed content specification together with the unconstrained wildcard content model and attribute specification produce the defining property for the ur-type definition, namely that every complex type definition is (eventually) a restriction of the ur-type definition: its permissions and requirements are the least restrictive possible.

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

AttributeUses

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

. . . ]]>

XML representations which all involve attribute uses, illustrating some of the possibilities for controlling occurrence.

The Attribute Use Schema Component

The attribute use schema component has the following properties:

A boolean. An attribute declaration. Optional. A pair consisting of a value and one of default, fixed.

determines whether this use of an attribute declaration requires an appropriate attribute information item to be present, or merely allows it.

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

allows for local specification of a default or fixed value. This must be consistent with that of the , in that if the specifies a fixed value, the only allowed is the same fixed value.

XML Representation of Attribute Use Components

Attribute uses correspond to all uses of which allow a use attribute. These in turn correspond to two components in each case, an attribute use and its (although note the latter is not new when the attribute use is a reference to a top-level attribute declaration). The appropriate mapping is described in .

Constraints on XML Representations of Attribute Uses

None as such.

Attribute Use Validation Rules Attribute Locally Valid (Use)

For an attribute information item to bevalid with respect to an attribute use its &i-value; must match the canonical lexical representation of the attribute use's value, if it is present and fixed.

Attribute Use Information Set Contributions

None as such.

Constraints on Attribute Use Schema Components

All attribute uses (see ) must satisfy the following constraints.

Attribute Use Correct

The values of the properties of an attribute use must be as described in the property tableau in , modulo the impact of .

If the has a fixed , then if the attribute use itself has a , it must also be fixed and its value must match that of the 's .

Attribute Group Definitions

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

Attribute group definitions do not participate in validation as such, but the and of one or more complex type definitions may be constructed in whole or part by reference to an attribute group. Thus, attribute group definitions provide a replacement for some uses of XML's parameter entity facility. Attribute group definitions are provided primarily for reference from the XML representation of schema components (see and ).

<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 attribute declarations in the group were present in the type definition.

The Attribute Group Definition Schema Component

The attribute group definition schema component has the following properties:

An NCName as defined by . Either absent or a namespace name, as defined in . A set of attribute uses. Optional. A wildcard. Optional. An annotation.

Attribute groups are identified by their and ; attribute group identities must be unique within an XML Schema. See for the use of component identifiers when importing one schema into another.

is a set attribute uses, allowing for local specification of occurrence and default or fixed values.

provides for an attribute wildcard to be included in an attribute group. See above under for the interpretation of attribute wildcards during validation.

See for information on the role of the property.

XML Representation of Attribute Group Definition Schema Components

The XML representation for an attribute group definition schema component is an element information item. It provides for naming a group of attribute declarations and an attribute wildcard for use by reference in the XML representation of complex type definitions and other attribute group definitions. The correspondences between the properties of the information item and properties of the component it corresponds to are as follows:

When an appears as a daughter of or , it corresponds to an attribute group definition as below. When it appears as a daughter of or , it does not correspond to any component as such.

The &v-value; of the name &i-attribute; The &v-value; of the targetNamespace &i-attribute; of the parent schema element information item. The union of the set of attribute uses corresponding to the &i-children;, if any, with the of the attribute groups resolved to by the &v-value;s of the ref &i-attribute; of the &i-children;, if any. As for the complete wildcard as described in . The annotation corresponding to the element information item in the &i-children;, if present, otherwise absent.

The example above illustrates a pattern which recurs in the XML representation of schemas: The same element, in this case attributeGroup, serves both to define and to incorporate by reference. In the first case the name attribute is required, in the second the ref attribute is required, and the element must be empty. These two are mutually exclusive, and also conditioned by context: the defining form, with a name, must occur at the top level of a schema, whereas the referring form, with a ref, must occur within a complex type definition or an attribute group definition.

Constraints on XML Representations of Attribute Group Definitions Attribute Group Definition Representation OK

In addition to the conditions imposed on element information items by the schema for schemas,

The corresponding attribute group definition, if any, must satisfy the conditions set out in .

If or in the correspondence specification in for , as referenced above, is satisfied, the intensional intersection must be expressible, as defined in .

Circular group reference is disallowed outside . That is, unless this element information item's parent is , then among the &i-children;, if any, there must not be an with ref &i-attribute; which resolves to the component corresponding to this .

Attribute Group Definition Validation Rules

None as such.

Attribute Group Definition Information Set Contributions

None as such.

Constraints on Attribute Group Definition Schema Components

All attribute group definitions (see ) must satisfy the following constraint.

Attribute Group Definition Properties Correct

The values of the properties of an attribute group definition must be as described in the property tableau in , modulo the impact of ;

Two distinct members of the must not have s both of whose s match and whose s are identical.

Two distinct members of the must not have s both of whose s are or are derived from ID.

Model Group Definitions

A model group definition associates a name and optional annotations with a . By reference to the name, the entire model group can be incorporated by reference into a .

Model group definitions are provided primarily for reference from the (see and ). Thus, model group definitions provide a replacement for some uses of XML's parameter entity facility.

<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 whole content model, then as one alternative in a choice.

The Model Group Definition Schema Component

The model group definition schema component has the following properties:

An NCName as defined by . Either absent or a namespace name, as defined in . A model group. Optional. An annotation.

Model group definitions are identified by their and ; model group identities must be unique within an XML Schema. See for the use of component identifiers when importing one schema into another.

Model group definitions per se do not participate in validation, but the of a particle may correspond in whole or in part to a model group from a model group definition.

is the for which the model group definition provides a name.

See for information on the role of the property.

XML Representation of Model Group Definition Schema Components

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

If there is a name &i-attribute; (in which case the item will have or as parent), then the item corresponds to a model group definition component with properties as follows:

The &v-value; of the name &i-attribute; The &v-value; of the targetNamespace &i-attribute; of the parent schema element information item. A model group which is the of a particle corresponding to the , or among the &i-children; (there must be one). The annotation corresponding to the element information item in the &i-children;, if present, otherwise absent.

Otherwise, the item will have a ref &i-attribute;, in which case it corresponds to a particle component with properties as follows (unless minOccurs=maxOccurs=0, in which case the item corresponds to no component at all):

The &v-value; of the minOccurs &i-attribute;, if present, otherwise 1. unbounded, if the maxOccurs &i-attribute; equals unbounded, otherwise the &v-value; of the maxOccurs &i-attribute;, if present, otherwise 1. The of the model group definition resolved to by the &v-value; of the ref &i-attribute;

The name of this section is slightly misleading, in that the second, un-named, case above (with a ref and no name) is not really a named model group at all, but a reference to one. Also note that in the first (named) case above no reference is made to minOccurs or maxOccurs: this is because the schema for schemas does not allow them on the child of when it is named. This in turn is because the and of the particles which refer to the definition are what count.

Given the constraints on its appearance in content models, an should only occur as the only item in the &i-children; of a named model group definition or a content model: see .

Constraints on XML Representations of Model Group Definitions Model Group Definition Representation OK

In addition to the conditions imposed on element information items by the schema for schemas, the corresponding model group definition, if any, must satisfy the conditions set out in .

Model Group Definition Validation Rules

None as such.

Model Group Definition Information Set Contributions

None as such.

Constraints on Model Group Definition Schema Components

All model group definitions (see ) must satisfy the following constraint.

Model Group Definition Properties Correct

The values of the properties of a model group definition must be as described in the property tableau in , modulo the impact of .

Model Groups

When the &i-children; of element information items are not constrained to be empty or by reference to a simple type definition (), the sequence of element information item &i-children; content may be specified in more detail with a model group. Because the property of a particle can be a model group, and model groups contain particles, model groups can indirectly contain other model groups; the grammar for content models is therefore recursive.

]]>

XML representations for the three kinds of model group, the third nested inside the second.

The Model Group Schema Component

The model group schema component has the following properties:

One of all, choice or sequence. A list of particles Optional. An annotation.

specifies a sequential (sequence), disjunctive (choice) or conjunctive (all) interpretation of the . This in turn determines whether the element information item &i-children; validated by the model group must:

(sequence) correspond, in order, to the specified ;

(choice) corresponded to exactly one of the specified ;

(all) contain all and only exactly zero or one of each element specified in . The elements can occur in any order. In this case, to reduce implementation complexity, is restricted to contain local and top-level element declarations only, with =0 or 1, =1.

When two or more particles contained directly or indirectly in the of a model group have identically named element declarations as their , the type definitions of those declarations must be the same. By 'indirectly' is meant particles within the of a group which is itself the of a directly contained particle, and so on recursively.

See for information on the role of the property.

XML Representation of Model Group Schema Components

The XML representation for a model group schema component is either an , a or a element information item. The correspondences between the properties of those information items and properties of the component they correspond to are as follows:

Each of the above items corresponds to a particle containing a model group, with properties as follows (unless minOccurs=maxOccurs=0, in which case the item corresponds to no component at all):

The &v-value; of the minOccurs &i-attribute;, if present, otherwise 1. unbounded, if the maxOccurs &i-attribute; equals unbounded, otherwise the &v-value; of the maxOccurs &i-attribute;, if present, otherwise 1. A model group as given below: One of all, choice, sequence depending on the element information item. A sequence of particles corresponding to all the , , , , or items among the &i-children;, in order. The annotation corresponding to the element information item in the &i-children;, if present, otherwise absent.
Constraints on XML Representations of Model Groups Model Group Representation OK

In addition to the conditions imposed on , and element information items by the schema for schemas, the corresponding particle and model group must satisfy the conditions set out in and .

Model Group Validation Rules Element Sequence Valid

Define a partition of a sequence as a sequence of sub-sequences, some or all of which may be empty, such that concatenating all the sub-sequences yields the original sequence.

For a sequence (possibly empty) of element information items to be locally valid with respect to a model group

the is sequence

there must be a partition of the sequence into n sub-sequences where n is the length of such that each of the sub-sequences in order is valid with respect to the corresponding particle in the as defined in .

the is choice

there must be a particle among the such that the sequence is valid with respect to that particle as defined in .

the is all

there must be a partition of the sequence into n sub-sequences where n is the length of such that there is a one-to-one mapping between the sub-sequences and the where each sub-sequence is valid with respect to the corresponding particle as defined in .

Nothing in the above should be understood as ruling out groups whose is empty: although no sequence can be valid with respect to such a group whose is choice, the empty sequence is valid with respect to empty groups whose is sequence or all.

The above definition is implicitly non-deterministic, and should not be taken as a recipé for implementations. Note in particular that when is all, particles is restricted to a list of local and top-level element declarations (see ). 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 is 0), and each is valid with respect to its corresponding declaration. The elements can occur in arbitrary order.

Model Group Information Set Contributions

None as such.

Constraints on Model Group Schema Components

All model groups (see ) must satisfy the following constraints.

Model Group Correct

The values of the properties of a model group must be as described in the property tableau in , modulo the impact of .

Circular groups are disallowed. That is, within the of a group there must not be at any depth a particle whose is the group itself.

All Group Limited

When a model group has all

It appears as the model group of a model group definition.

It appears in a particle with ==1, and that particle must be part of a pair which constitutes the of a complex type definition.

The of all the particles in the of the group must be 0 or 1.

Element Declarations Consistent

If the contains, either directly, indirectly (that is, within the of a contained model group, recursively) or implicitly two or more element declaration particles with the same and , then all their type definitions must be the same top-level definition, that is,

all their s must have a non-absent name.

all their s must have the same name.

all their s must have the same target namespace.

A list of particles implicitly contains an element declaration if a member of the list contains that element declaration in its substitution group.

Unique Particle Attribution

A content model must be formed such that during validation of an element information item sequence, the particle contained 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.

This constraint reconstructs for XML Schema the equivalent constraints of and SGML. Given the presence of element substitution groups and wildcards, the concise expression of this constraint is difficult, see for further discussion.

Because locally-scoped element declarations may or may not have a , the scope of declarations is not relevant to enforcing either of the two preceding constraints.

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

Effective Total Range (all and sequence)

The effective total range of a particle whose is a group whose is all or sequence is a pair of minimum and maximum, as follows:

The product of the particle's and the sum of the of every wildcard or element declaration particle in the group's and the minimum part of the effective total range of each of the group particles in the group's (or 0 if there are no ).

unbounded if the of any wildcard or element declaration particle in the group's or the maximum part of the effective total range of any of the group particles in the group's is unbounded, or if any of those is non-zero and the of the particle itself is unbounded, otherwise the product of the particle's and the sum of the of every wildcard or element declaration particle in the group's and the maximum part of the effective total range of each of the group particles in the group's (or 0 if there are no ).

Effective Total Range (choice)

The effective total range of a particle whose is a group whose is choice is a pair of minimum and maximum, as follows:

The product of the particle's and the minimum of the of every wildcard or element declaration particle in the group's and the minimum part of the effective total range of each of the group particles in the group's (or 0 if there are no ).

unbounded if the of any wildcard or element declaration particle in the group's or the maximum part of the effective total range of any of the group particles in the group's is unbounded, or if any of those is non-zero and the of the particle itself is unbounded, otherwise the product of the particle's and the maximum of the of every wildcard or element declaration particle in the group's and the maximum part of the effective total range of each of the group particles in the group's (or 0 if there are no ).

Particles

As described in , particles contribute to the definition of content models.

]]>

XML representations which all involve particles, illustrating some of the possibilities for controlling occurrence.

The Particle Schema Component

The particle schema component has the following properties:

A non-negative integer. Either a non-negative integer or unbounded. One of a model group, a wildcard, or an element declaration.

In general, multiple element information item &i-children;, possibly with intervening character &i-children; if the content type is mixed, can be validated with respect to a single particle. When the is an element declaration or wildcard, determines the minimum number of such element &i-children; that can occur. The number of such children must be greater than or equal to . If is 0, then occurrence of such children is optional.

Again, when the is an element declaration or wildcard, the number of such element &i-children; must be less than or equal to any numeric specification of ; if is unbounded, then there is no upper bound on the number of such children.

When the is a model group, the permitted occurrence range is determined by a combination of and and the occurrence ranges of the 's .

XML Representation of Particle Components

Particles correspond to all three elements ( not immediately within , not immediately within and ) which allow minOccurs and maxOccurs attributes. These in turn correspond to two components in each case, a particle and its . The appropriate mapping is described in , and respectively.

Constraints on XML Representations of Particles

None as such.

Particle Validation Rules Element Sequence Locally Valid (Particle)

For a sequence (possibly empty) of element information items to be locally valid with respect to a particle

the is a wildcard

The length of the sequence must be greater than or equal to the .

If is a number, the length of the sequence must be less than or equal to the .

Each element information item in the sequence must be valid with respect to the wildcard as defined by .

the is an element declaration

The length of the sequence must be greater than or equal to the .

If is a number, the length of the sequence must be less than or equal to the .

For each element information item in the sequence

The element declaration is local (i.e. its must not be global), its is false, the element information item's namespace name is identical to the element declaration's (where an absent is taken to be identical to a namespace name with no value) and the element information item's local name matches the element declaration's .

In this case the element declaration is the context-determined declaration for the element information item with respect to and .

The element declaration is top-level (i.e. its is global), is false, the element information item's namespace name is identical to the element declaration's (where an absent is taken to be identical to a namespace name with no value) and the element information item's local name matches the element declaration's .

In this case the element declaration is the context-determined declaration for the element information item with respect to and .

The element declaration is top-level (i.e. its is global), its does not contain substitution, the local and namespace name of the element information item resolve to an element declaration, as defined in -- call this declaration the substituting declaration and the substituting declaration together with the particle's element declaration's is validly substitutable for the particle's element declaration as defined in .

In this case the substituting declaration is the context-determined declaration for the element information item with respect to and .

the is a model group

There is a partition of the sequence into n sub-sequences such that n is greater than or equal to .

If is a number, n must be less than or equal to .

Each sub-sequence in the partition is valid with respect to that model group as defined in .

Clauses and do not interact: an element information item validatable by a declaration with a substitution group head in a different namespace is not validatable by a wildcard which accepts the head's namespace but not its own.

Particle Information Set Contributions

None as such.

Constraints on Particle Schema Components

All particles (see ) must satisfy the following constraints.

Particle Correct

The values of the properties of a particle must be as described in the property tableau in , modulo the impact of .

If is not unbounded, that is, it has a numeric value, then

must not be greater than .

must be greater than or equal to 1.

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

Particle Valid (Extension)

For a particle (call it E, for extension) to be a valid extension of another particle (call it B, for base)

They are the same particle.

E's ==1 and its is a sequence group whose ' first member is a particle all of whose properties, recursively, are identical to those of B, with the exception of annotation properties.

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

The structural correspondence approach to guaranteeing the subset relation set out here is necessarily verbose, but has the advantage of being checkable in a straightforward way. The working group solicits feedback on how difficult this is in practice, and on whether other approaches are found to be viable.

Particle Valid (Restriction)

For a particle (call it R, for restriction) to be a valid restriction of another particle (call it B, for base)

They are the same particle.

depending on the kind of particle, per the table below, with the qualifications that

Any top-level element declaration particle (in R or B) which is the of one or more other element declarations is treated as if it were a choice group whose and are those of the particle, and whose consists of one particle with and of 1 for the top-level element declaration and for each of the declarations in its substitution group.

Any pointless occurrences of , or are ignored, where pointlessness is understood as follows:

is empty.

The particle within which this appears has and of 1.

The 's has only one member.

The particle within which this appears is itself among the of a .

is empty.

has only one member.

is empty and the particle within which this appears has of 0.

The particle within which this appears has and of 1.

The 's has only one member.

The particle within which this appears is itself among the of a .

NameAnd- TypeOK NSCompat Recurse- AsIfGroup Recurse- AsIfGroup RecurseAs- IfGroup NSSubset Forbidden Forbidden Forbidden Forbidden NSRecurse- CheckCardinality Recurse Forbidden Forbidden Forbidden NSRecurse- CheckCardinality RecurseLax Forbidden Forbidden Forbidden NSRecurse- CheckCardinality Recurse- Unordered MapAndSum Recurse Forbidden

Occurrence Range OK

For a particle's occurrence range to be a valid restriction of another's occurrence range

Its is greater than or equal to the other's .

The other's is unbounded.

Both are numbers, and the particle's is less than or equal to the other's.

Particle Restriction OK (Elt:Elt -- NameAndTypeOK)

For an element declaration particle to be a valid restriction of another element declaration particle

The declarations' s and s are the same.

Either B's is true or R's is false.

R's occurrence range is a valid restriction of B's occurrence range as defined by .

either B's declaration's is absent, or is not fixed, or R's declaration's is fixed with the same value.

R's declaration's is a subset of B's declaration's , if any.

R's declaration's is a superset of B's declaration's .

R's is validly derived given {extension, list, union} from B's as defined by or , as appropriate.

The above constraint on means that in deriving a type by restriction, any contained type definitions must themselves be explicitly derived by restriction from the corresponding type definitions in the base definition.

Particle Derivation OK (Elt:Any -- NSCompat)

For an element declaration particle to be a valid restriction of a wildcard particle

The element declaration's is valid with respect to the wildcard's as defined by .

R's occurrence range is a valid restriction of B's occurrence range as defined by .

Particle Derivation OK (Elt:All/Choice/Sequence -- RecurseAsIfGroup)

For an element declaration particle to be a valid restriction of a group particle (all, choice or sequence) a group particle of the variety corresponding to B's, with and of 1 and with consisting of a single particle the same as the element declaration must be a valid restriction of the group as defined by , or , depending on whether the group is all, choice or sequence.

Particle Derivation OK (Any:Any -- NSSubset)

For a wildcard particle to be a valid restriction of another wildcard particle

R's occurrence range must be a valid restriction of B's occurrence range as defined by .

R's must be an intensional subset of B's as defined by .

Particle Derivation OK (All/Choice/Sequence:Any -- NSRecurseCheckCardinality)

For a group particle to be a valid restriction of a wildcard particle

Every member of the of the group is a valid restriction of the wildcard as defined by .

The effective total range of the group, as defined by (if the group is all or sequence) or (if it is choice) is a valid restriction of B's occurrence range as defined by .

Particle Derivation OK (All:All,Sequence:Sequence -- Recurse)

For an all or sequence group particle to be a valid restriction of another group particle with the same

R's occurrence range is a valid restriction of B's occurrence range as defined by .

There is a complete order-preserving functional mapping from the particles in the of R to the particles in the of B such that

Each particle in the of R is a valid restriction of the particle in the of B it maps to as defined by .

All particles in the of B which are not mapped to by any particle in the of R are emptiable as defined by .

Although the validation semantics of an all group does not depend on the order of its particles, derived all groups are required to match the order of their base in order to simplify checking that the derivation is OK.

A complete functional mapping is order-preserving if each particle r in the domain R maps to a particle b in the range B which follows (not necessarily immediately) the particle in the range B mapped to by the predecessor of r, if any, where predecessor and follows are defined with respect to the order of the lists which constitute R and B.

Particle Derivation OK (Choice:Choice -- RecurseLax)

For a choice group particle to be a valid restriction of another choice group particle

R's occurrence range is a valid restriction of B's occurrence range as defined by ;

There is a complete order-preserving functional mapping from the particles in the of R to the particles in the of B such that each particle in the of R is a valid restriction of the particle in the of B it maps to as defined by .

Although the validation semantics of a choice group does not depend on the order of its particles, derived choice groups are required to match the order of their base in order to simplify checking that the derivation is OK.

Particle Derivation OK (Sequence:All -- RecurseUnordered)

For a sequence group particle to be a valid restriction of an all group particle

R's occurrence range is a valid restriction of B's occurrence range as defined by .

There is a complete functional mapping from the particles in the of R to the particles in the of B such that

No particle in the of B is mapped to by more than one of the particles in the of R;

Each particle in the of R is a valid restriction of the particle in the of B it maps to as defined by ;

All particles in the of B which are not mapped to by any particle in the of R are emptiable as defined by .

Although this clause allows reordering, because of the limits on the contents of all groups the checking process can still be deterministic.

Particle Derivation OK (Sequence:Choice -- MapAndSum)

For a sequence group particle to be a valid restriction of a choice group particle

There is a complete functional mapping from the particles in the of R to the particles in the of B such that each particle in the of R is a valid restriction of the particle in the of B it maps to as defined by .

The pair consisting of the product of the of R and the length of its and unbounded if is unbounded otherwise the product of the of R and the length of its is a valid restriction of B's occurrence range as defined by .

This clause is in principle more restrictive than absolutely necessary, but in practice will cover all the likely cases, and is much easier to specify than the fully general version.

This case allows the unfolding of iterated disjunctions into sequences. It may be particularly useful when the disjunction is an implicit one arising from the use of substitution groups.

Particle Emptiable

For a particle to be emptiable

Its is 0.

Its is a group and the minimum part of the effective total range of that group, as defined by (if the group is all or sequence) or (if it is choice), is 0.

Wildcards

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

]]>

XML representations of the four basic types of wildcard, plus one attribute wildcard.

The Wildcard Schema Component

The wildcard schema component has the following properties:

One of any; a pair of not and a namespace name or absent; or a set whose members are either namespace names or absent. One of skip, lax or strict. Optional. An annotation.

provides for validation of attribute and element items that:

(any) have any namespace or are not namespace qualified;

(not and a namespace name) have any namespace other than the specified namespace name, or are not namespace qualified;

(not and absent) are namespace qualified;

(a set whose members are either namespace names or absent) have any of the specified namespaces and/or, if absent is included in the set, are unqualified.

controls the impact on assessment of the information items allowed by wildcards, as follows:

There must be a top-level declaration for the item available, or the item must have an xsi:type, and the item must be valid as appropriate.

No constraints at all: the item must simply be well-formed XML.

If the item, or any items among its &i-children; if it's an element information item, has a uniquely determined declaration available, it must be valid with respect to that definition, that is, validate where you can, don't worry when you can't.

See for information on the role of the property.

XML Representation of Wildcard Schema Components

The XML representation for a wildcard schema component is an or element information item. The correspondences between the properties of an information item and properties of the components it corresponds to are as follows (see and for the correspondences for ):

A particle containing a wildcard, with properties as follows (unless minOccurs=maxOccurs=0, in which case the item corresponds to no component at all):

The &v-value; of the minOccurs &i-attribute;, if present, otherwise 1. unbounded, if the maxOccurs &i-attribute; equals unbounded, otherwise the &v-value; of the maxOccurs &i-attribute;, if present, otherwise 1. A wildcard as given below: Dependent on the &v-value; of the namespace &i-attribute;: if absent, then any, otherwise as follows:

any

a pair of not and the &v-value; of the targetNamespace &i-attribute; of the ancestor element information item if present, otherwise absent.

a set whose members are namespace names corresponding to the space-delimited substrings of the string, except

if one such substring is ##targetNamespace, the corresponding member is the &v-value; of the targetNamespace &i-attribute; of the ancestor element information item if present, otherwise absent.

if one such substring is ##local, the corresponding member is absent.

The &v-value; of the processContents &i-attribute;, if present, otherwise strict. The annotation corresponding to the element information item in the &i-children;, if present, otherwise absent.

Wildcards are subject to the same ambiguity constraints () as other content model particles: If an instance element could match either an explicit particle and a wildcard, or one of two wildcards, within the content model of a type, that model is in error.

Constraints on XML Representations of Wildcards Wildcard Representation OK

In addition to the conditions imposed on element information items by the schema for schemas, the corresponding particle and model group must satisfy the conditions set out in and .

Wildcard Validation Rules Item Valid (Wildcard)

For an element or attribute information item to be locally valid with respect to a wildcard constraint its namespace name must be valid with respect to the wildcard constraint, as defined in .

When this constraint applies

is lax

the item has no context-determined declaration with respect to , and .

is strict

the item's context-determined declaration is mustFind.

is skip

the item's context-determined declaration is skip.

Wildcard allows Namespace Name

For a value which is either a namespace name or absent to be valid with respect to a wildcard constraint (the value of a )

The constraint must be any.

The constraint is a pair of not and a namespace name or absent (call this the namespace test).

The value must not be identical to the namespace test.

The value must not be absent.

The constraint is a set, and the value is identical to one of the members of the set.

Wildcard Information Set Contributions

None as such.

Constraints on Wildcard Schema Components

All wildcards (see ) must satisfy the following constraint.

Wildcard Properties Correct

The values of the properties of a wildcard must be as described in the property tableau in , modulo the impact of .

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

Wildcard Subset

For a namespace constraint (call it sub) to be an intensional subset of another namespace constraint (call it super)

super must be any.

sub must be a pair of not and a namespace name or absent.

super must be a pair of not and the same value.

sub must be a set whose members are either namespace names or absent.

super must be the same set or a superset thereof.

super must be a pair of not and a namespace name or absent and that value must not be in sub's set.

Attribute Wildcard Union

For a wildcard's value to be the intensional union of two other such values (call them O1 and O2):

O1 and O2 are the same value

that value must be the value.

either O1 or O2 is any

any must be the value.

both O1 and O2 are sets of (namespace names or absent)

the union of those sets must be the value.

the two are negations of different namespace names

the intersection is not expressible.

either O1 or O2 is a pair of not and a namespace name and the other is a set of (namespace names or absent)

the set includes the negated namespace name

any must be the value.

the set does not include the negated namespace name

whichever of O1 or O2 is a pair of not and a namespace name must be the value.

In the case where there are more than two values, the intensional intersection is determined by identifying the intensional intersection of two of the values as above, then the intensional intersection of that value with the third (providing the first intersection was expressible), and so on as required.

Attribute Wildcard Intersection

For a wildcard's value to be the intensional intersection of two other such values (call them O1 and O2):

O1 and O2 are the same value

that value must be the value.

either O1 or O2 is any

the other must be the value.

either O1 or O2 is a pair of not and a namespace name and the other is a set of (namespace names or absent)

that set, minus the negated namespace name if it was in the set, must be the value.

both O1 and O2 are sets of (namespace names or absent)

the intersection of those sets must be the value.

the two are negations of different namespace names

the intersection is not expressible.

In the case where there are more than two values, the intensional intersection is determined by identifying the intensional intersection of two of the values as above, then the intensional intersection of that value with the third (providing the first intersection was expressible), and so on as required.

&Constraint; Definitions

&Constraint; definition components provide for uniqueness and reference constraints with respect to the contents of multiple elements and attributes.

]]>

XML representations for the three kinds of &constraint; definitions.

The &Constraint; Definition Schema Component

The &constraint; definition schema component has the following properties:

An NCName as defined by . Either absent or a namespace name, as defined in . One of key, keyref or unique. A restricted XPath () expression. A non-empty list of restricted XPath () expressions. Required if is keyref, forbidden otherwise. An &constraint; definition with equal to key or unique. Optional. An annotation.

&Constraint; definitions are identified by their and ; &Constraint; definition identities must be unique within an XML Schema. See for the use of component identifiers when importing one schema into another.

Informally, identifies the &Constraint; definition as playing one of three roles:

(unique) the &Constraint; definition asserts uniqueness, with respect to the content identified by , of the tuples resulting from evaluation of the XPath expression(s).

(key) the &Constraint; definition asserts uniqueness as for unique. key further asserts that all selected content actually has such tuples.

(keyref) the &Constraint; definition asserts a correspondence, with respect to the content identified by , of the tuples resulting from evaluation of the XPath expression(s), with those of the .

These constraints are specified along side the specification of types for the attributes and elements involved, i.e. something declared as of type integer may also serve as a key. Each constraint declaration has a name, which exists in a single symbol space for constraints. The equality and inequality conditions appealed to in checking these constraints apply to the value of the fields selected, so that for example 3.0 and 3 would be conflicting keys if they were both number, but non-conflicting if they were both strings, or one was a string and one a number. Values of differing type can only be equal if one type is derived from the other, and the value is in the value space of both.

Overall the augmentations to XML's ID/IDREF mechanism are:

Functioning as a part of an &constraint; is in addition to, not instead of, having a type;

Not just attribute values, but also element content and combinations of values and content can be declared to be unique;

&Constraint;s are specified to hold within the scope of particular elements;

(Combinations of) attribute values and/or element content can be declared to be keys, that is, not only unique, but always present and non-nillable;

The comparison between keyref and key or unique is by value equality, not by string equality.

specifies a restricted XPath () expression relative to instances of the element being declared. This must identify a node set of subordinate elements (i.e. contained within the declared element) to which the constraint applies.

specifies XPath expressions relative to each element selected by a . This must identify a single node (element or attribute) whose content or value, which must be of a simple type, is used in the constraint. It is possible to specify an ordered list of s, to cater to multi-field keys, keyrefs, and uniqueness constraints.

In order to reduce the burden on implementers, in particular implementers of streaming processors, only restricted subsets of XPath expressions are allowed in and . The details are given in .

Provision for multi-field keys etc. goes beyond what is supported by xsl:key.

See for information on the role of the property.

XML Representation of &Constraint; Definition Schema Components

The XML representation for an &constraint; definition schema component is either a , a or a element information item. The correspondences between the properties of those information items and properties of the component they correspond to are as follows:

The &v-value; of the name &i-attribute; The &v-value; of the targetNamespace &i-attribute; of the parent schema element information item. One of key, keyref or unique, depending on the item. A restricted XPath expression corresponding to the &v-value; of the xpath &i-attribute; of the element information item among the &i-children; A sequence of XPath expressions, corresponding to the &v-value;s of the xpath &i-attribute;s of the element information item &i-children;, in order. If the item is a , the &constraint; definition resolved to by the &v-value; of the refer &i-attribute;, otherwise absent. The annotation corresponding to the element information item in the &i-children;, if present, otherwise absent. . . . . . . . . . . . . ]]>

A state element is defined, which contains a code child and some vehicle and person children. A vehicle in turn has a plateNumber attribute, which is an integer, and a state attribute. State's codes are a key for them within the document. Vehicle's plateNumbers are a key for them within states, and state and plateNumber is asserted to be a key for vehicle within the document as a whole. Furthermore, a person element has an empty car child, with regState and regPlate attributes, which are then asserted together to refer to vehicles via the carRef constraint. The requirement that a vehicle's state match its containing state's code is not expressed here.

Constraints on XML Representations of &Constraint; Definitions &Constraint; Definition Representation OK

In addition to the conditions imposed on , and element information items by the schema for schemas, the corresponding &constraint; definition must satisfy the conditions set out in .

&Constraint; Definition Validation Rules &Constraint; Satisfied

For an element information item to be locally valid with respect to an &constraint;

The , with the element information item as the context node, evaluates to a node-set (as defined in ). Call this the target node set.

Each node in the target node set is an element node among the descendants of the context node.

For each node in the target node set all of the , with that node as the context node, evaluate to either an empty node-set or a node-set with exactly one member, which must have a simple type. Call the sequence of the type-determined values (as defined in ) of the schema normalized value of the element and/or attribute information items in those node-sets in order the key-sequence of the node.

Call the subset of the target node set for which all the evaluate to a node-set with exactly one member which is an element or attribute node with a simple type the qualified node set.

the is unique

no two members of the qualified node set have key-sequences whose members are pairwise equal, as defined by Equal in .

the is key

The target node set and the qualified node set are equal, that is, every member of the target node set is also a member of the qualified node set and vice versa.

No two members of the qualified node set have key-sequences whose members are pairwise equal, as defined by Equal in .

No element member of the key-sequence of any member of the qualified node set was assessed as valid by reference to an element declaration whose is true.

the is keyref

for each member of the qualified node set (call this the keyref member), there must be a node table associated with the in the of the element information item (see , which must be understood as logically prior to this clause of this constraint, below) and there must be an entry in that table whose key-sequence is equal to the keyref member's key-sequence member for member, as defined by Equal in .

The use of schema normalized value in the definition of key sequence above means that default or fixed value constraints may play a part in key sequences.

Although this specification defines a &PSVI; contribution which would enable schema-aware processors to implement above (), processors are not required to provide it. This clause can be read as if in the absence of this infoset contribution, the value of the relevant property must be available.

&Constraint; Definition Information Set Contributions &Constraint; Table

An eligible &constraint; of an element information item is one such that or of is satisfied with respect to that item and that constraint, or such that any of the element information item &i-children; of that item have an property whose value has an entry for that constraint.

A node table is a set of pairs each consisting of a key-sequence and an element node.

Whenever an element information item has one or more eligible &constraint;s, in the &PSVI; that element information item has a property as follows:

one &Constraint; Binding information item for each eligible &constraint;, with properties as follows: The eligible &constraint;. A node table with one entry for every key-sequence (call it k) and node (call it n) such that

There is an entry in one of the node tables associated with the in an &Constraint; Binding information item in at least one of the s of the element information item &i-children; of the element information item whose key-sequence is k and whose node is n;

n appears with key-sequence k in the qualified node set for the .

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 above. Note that if all the conflicting entries arose under above, this means no entry at all will appear for the offending key-sequence.

The complexity of the above arises from the fact that keyref &constraint;s may be defined on domains distinct from the embedded domain of the &constraint; they reference, or the domains may be the same but self-embedding at some depth. In either case the node table for the referenced &constraint; needs to propagate upwards, with conflict resolution.

The &Constraint; Binding information item, unlike others in this specification, is essentially an internal bookkeeping mechanism. It is introduced to support the definition of above. Accordingly, conformant processors may, but are not required to, expose them via properties in the &PSVI;. In other words, the above constraints may be read as saying validation of &constraint;s proceeds as if such infoset items existed.

Constraints on &Constraint; Definition Schema Components

All &constraint; definitions (see ) must satisfy the following constraint.

&Constraint; Definition Properties Correct

The values of the properties of an &constraint; definition must be as described in the property tableau in , modulo the impact of .

If the is keyref, the cardinality of the must equal that of the of the .

Selector Value OK

The must be a valid XPath expression, as defined in .

It must conform to the following extended BNF: Selector XPath expressions Selector Path ( '|' Path )* Path ('.//')? Step ( '/' Step )* Step '.' | NameTest NameTest QName | '*' | NCName ':' '*'

It must be an XPath expression involving the child axis whose abbreviated form is as given above.

Fields Value OK

Each member of the must be a valid XPath expression, as defined in .

It must conform to the extended BNF given above for Selector, with the following modification: Path in Field XPath expressions Path ('.//')? ( Step '/' )* ( Step | '@' NameTest ) This production differs from the one above in allowing the final step to match an attribute node.

It must be an XPath expression involving the child and/or attribute axes whose abbreviated form is as given above.

Notation Declarations

Notation declarations reconstruct XML 1.0 NOTATION declarations.

]]>

The XML representation of a notation declaration.

The Notation Declaration Schema Component

The notation declaration schema component has the following properties:

An NCName as defined by . Either absent or a namespace name, as defined in . Optional if is present. A URI reference. Optional if is present. A public identifier, as defined in . Optional. An annotation.

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

See for information on the role of the property.

XML Representation of Notation Declaration Schema Components

The XML representation for a notation declaration schema component is a element information item. The correspondences between the properties of that information item and properties of the component it corresponds to are as follows:

The &v-value; of the name &i-attribute; The &v-value; of the targetNamespace &i-attribute; of the parent schema element information item. The &v-value; of the system &i-attribute;, if present, otherwise absent. The &v-value; of the public &i-attribute; The annotation corresponding to the element information item in the &i-children;, if present, otherwise absent. <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>
Constraints on XML Representations of Notation Declarations Notation Definition Representation OK

In addition to the conditions imposed on element information items by the schema for schemas, the corresponding notation definition must satisfy the conditions set out in .

Notation Declaration Validation Rules

None as such.

Notation Declaration Information Set Contributions Validated with Notation

Whenever an attribute information item is valid with respect to a NOTATION, in the &PSVI; its parent element information item either has a property as follows:

An item isomorphic to the notation declaration whose and match the local name and namespace name (as defined in ) of the attribute item's &v-value;

or has a pair of properties as follows:

The value of the of that notation declaration. The value of the of that notation declaration.

For compatibility, only one such attribute should appear on any given element. If more than one such attribute does appear, which one supplies the infoset property or properties above is not defined.

Constraints on Notation Declaration Schema Components

All notation declarations (see ) must satisfy the following constraint.

Notation Declaration Correct

The values of the properties of a notation declaration must be as described in the property tableau in , modulo the impact of .

Annotations

Annotations provide for human- and machine-targeted annotations of schema components.

A type for experts only checkForPrimes ]]>

XML representations of three kinds of annotation.

The Annotation Schema Component

The annotation schema component has the following properties:

A sequence of element information items. A sequence of element information items. A sequence of attribute information items.

is intended for human consumption, for automatic processing. In both cases, provision is made for an optional URI reference to supplement the local information, as the value of the source attribute of the respective element information items. Validation does not involve dereferencing these URIs, when present. In the case of , indication should be given as to the identity of the (human) language used in the contents, using the xml:lang attribute.

ensures that when schema authors take advantage of the provision for adding attributes from namespaces other than the XML Schema namespace to schema documents, they are available within the components corresponding to the element items where such attributes appear.

Annotations do not participate in validation as such. Provided an annotation itself satisfies all relevant Schema Component Constraints it cannot affect the validation of element information items.

XML Representation of Annotation Schema Components

Annotation of schemas and schema components, with material for human or computer consumption, is provided for by allowing application information and human information at the beginning of most major schema elements, and anywhere at the top level of schemas. The XML representation for an annotation schema component is an element information item. The correspondences between the properties of that information item and properties of the component it corresponds to are as follows:

A sequence of the element information items from among the &i-children;, in order, if any, otherwise the empty sequence. A sequence of the element information items from among the &i-children;, in order, if any, otherwise the empty sequence. A sequence of attribute information items, namely those allowed by the attribute wildcard in the type definition for the 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 element in the example above will have one element item in each of its and and one attribute item in its .

Constraints on XML Representations of Annotations Annotation Definition Representation OK

In addition to the conditions imposed on element information items by the schema for schemas, the corresponding annotation must satisfy the conditions set out in .

Annotation Validation Rules

None as such.

Annotation Information Set Contributions

None as such: the addition of annotations to the &PSVI; is covered by the &PSVI; contributions of the enclosing components.

Constraints on Annotation Schema Components

All annotations (see ) must satisfy the following constraint.

Annotation Correct

The values of the properties of an annotation must be as described in the property tableau in , modulo the impact of .

Simple Type Definitions

This section consists of a combination of non-normative versions of normative material from , for local cross-reference purposes, and normative material relating to the interface between schema components defined in this specification and the simple type definition component.

Simple type definitions provide for constraining character information item &i-children; of element and attribute information items.

]]>

The XML representation of a simple type definition.

(non-normative) The Simple Type Definition Schema Component

The simple type definition schema component has the following properties:

Optional. An NCName as defined by . Either absent or a namespace name, as defined in . A simple type definition, which may be the simple ur-type definition. A set of constraining facets. A set of fundamental facets. A subset of {extension, list, restriction, union}. One of {atomic, list, union}. Depending on the value of , further properties are defined as follows: A built-in primitive simple type definition (or the simple ur-type definition). A simple type definition. A non-empty sequence of simple type definitions. Optional. An annotation.

Simple types are identified by their and . Except for anonymous simple types (those with no ), since type definitions (i.e. both simple and complex type definitions taken together) must be uniquely identified within an XML Schema, no simple type definition can have the same name as another simple or complex type definition. Simple type s and s are provided for reference from instances (see ), and for use in the XML representation of schema components (specifically in and ). See for the use of component identifiers when importing one schema into another.

The of a simple type is not ipso facto 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 in and .

A simple type definition with an empty specification for can be used as the for other types derived by either of extension or restriction, or as the in the definition of a list, or in the of a union; the explicit values extension, restriction, list and union prevent further derivations by extension (to yield a complex type) and restriction (to yield a simple type) and use in constructing lists and unions respectively.

determines whether the simple type corresponds to an atomic, list or union type as defined by &XSP2;.

As described in , every simple type definition is a restriction of some other simple type (the ), which is the simple ur-type definition if and only if the type definition in question is one of the built-in primitive datatypes, or a list or union type definition. Each atomic type is ultimately a restriction of exactly one such built-in simple .

for each simple type definition are selected from those defined in &XSP2;. For atomic definitions, these are restricted to those appropriate for the corresponding . Therefore, the value space and lexical space (i.e. what is validated by any atomic simple type) is determined by the pair (, ).

As specified in &XSP2;, list simple type definitions validate space separated tokens, each of which conforms to a specified simple type definition, the . The item type specified must not itself be a list type, and must be one of the types identified in &XSP2; as a suitable item type for a list simple type. In this case the apply to the list itself, and are restricted to those appropriate for lists.

A union simple type definition validates strings which satisfy at least one of its . As in the case of list, the apply to the union itself, and are restricted to those appropriate for unions.

As discussed in , the ur-type definition functions as a simple type when used as the base type definition for the built-in primitive datatypes and for list and union type definitions. It is considered to have an unconstrained lexical space, and a value space consisting of the union of the value spaces of all the built-in primitive datatypes and the set of all lists of all members of the value spaces of all the built-in primitive datatypes.

The simple ur-type definition must not be named as the base type definition of any user-defined simple types: as it has no constraining facets, this would be incoherent.

See for information on the role of the property.

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

This section reproduces a version of material from , for local cross-reference purposes.

The &v-value; of the name &i-attribute; if present, otherwise absent. The &v-value; of the targetNamespace &i-attribute; of the ancestor element information item if present, otherwise absent.

the alternative is chosen

the type definition resolved to by the &v-value; of the base &i-attribute; of , if present, otherwise the type definition corresponding to the among the &i-children; of .

the or alternative is chosen

the simple ur-type definition.

As for the property of complex type definitions, but using the final and finalDefault &i-attributes; in place of the block and blockDefault &i-attributes; and with the relevant set being {extension, restriction, list, union}. If the alternative is chosen, then list, otherwise if the alternative is chosen, then union, otherwise (the alternative is chosen), then the of the .

If the is atomic, the following additional property mappings also apply:

The built-in primitive type definition from which the is derived. A set of facet components constituting a restriction of the of the with respect to a set of facet components corresponding to the appropriate element information items among the &i-children; of (i.e. those which specify facets, if any), as defined in .

If the is list, the following additional property mappings also apply:

the alternative is chosen

the type definition resolved to by the &v-value; of the itemType &i-attribute; of , if present, otherwise the type definition corresponding to the among the &i-children; of .

the option is chosen

the of the .

If the alternative is chosen, a set of facet components constituting a restriction of the of the with respect to a set of facet components corresponding to the appropriate element information items among the &i-children; of (i.e. those which specify facets, if any), as defined in , otherwise the empty set.

If the is union, the following additional property mappings also apply:

the alternative is chosen

define the explicit members as the type definitions resolved to by the items in the &v-value; of the memberTypes &i-attribute;, if any, followed by the type definitions corresponding to the s among the &i-children; of , if any. The actual value is then formed by replacing any union type definition in the explicit members with the members of their , in order.

the option is chosen

the of the .

If the alternative is chosen, a set of facet components constituting a restriction of the of the with respect to a set of facet components corresponding to the appropriate element information items among the &i-children; of (i.e. those which specify facets, if any), as defined in , otherwise the empty set.
(non-normative) Constraints on XML Representations of Simple Type Definitions Simple Type Definition Representation OK

In addition to the conditions imposed on element information items by the schema for schemas,

The corresponding simple type definition, if any, must satisfy the conditions set out in .

If the alternative is chosen, either it must have a base &i-attribute; or a among its &i-children;, but not both.

If the alternative is chosen, either it must have an itemType &i-attribute; or a among its &i-children;, but not both.

Circular union type definition is disallowed. That is, if the alternative is chosen, there must not be any entries in the memberTypes &i-attribute; at any depth which resolve to the component corresponding to the .

Simple Type Restriction (Facets)

For a simple type definition (call it R) to restrict another simple type definition (call it B) with a set of facets (call this S)

The and of R are the same as those of B.

The of R are the union of S and the of B, eliminating duplicates. To eliminate duplicates, when a facet of the same kind occurs in both S and the of B, the one in the of B is not included, with the exception of enumeration and pattern facets, for which multiple occurrences with distinct values are allowed.

If above holds, the of R constitute a restriction of the of B with respect to S.

Simple Type Definition Validation Rules String Valid

A string is locally valid with respect to a simple type definition if it is schema-valid with respect to that definition as defined by Datatype Valid in .

Simple Type Definition Information Set Contributions

None as such.

Constraints on Simple Type Definition Schema Components

All simple type definitions (see ) must satisfy the following constraints.

Simple Type Definition Properties Correct

The values of the properties of a simple type definition must be as described in the property tableau in Datatype definition, modulo the impact of .

Circular definitions are disallowed. That is, it must be possible to reach a built-in primitive datatype or the simple ur-type definition by repeatedly following the .

The of the must not contain restriction.

If the is not the simple ur-type definition,

The definition must be a valid restriction as defined in .

If is not atomic, then

the is list

the of the must not contain list.

the is union

the of the must not contain union.

Derivation Valid (Restriction, Simple)

the is atomic

The must be an atomic simple type definition or a built-in primitive datatype.

The of the must not contain restriction.

For each facet in the there must be a facet of the same kind in the of the of whose value the facet in question's value must be a valid restriction as defined in .

the is list

The must have a of atomic or union (in which case all the must be atomic).

Only length, minLength, maxLength, pattern and enumeration facet components are allowed among the .

If the is not the simple ur-type definition, then

The must have a of list.

The of the must not contain restriction.

for each facet in the there must be a facet of the same kind in the of the of whose value the facet in question's value must be a valid restriction as defined in .

the is union

The must all have of atomic or list.

Only pattern and enumeration facet components are allowed among the .

If the is not the simple ur-type definition, then

The must have a of union.

The of the must not contain restriction.

for each facet in the there must be a facet of the same kind in the of the of whose value the facet in question's value must be a valid restriction as defined in .

If this constraint holds of a simple type definition, it is a valid restriction of its base type definition.

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

Type Derivation OK (Simple)

For a simple type definition (call it D, for derived) to be validly derived from a simple type definition (call this B, for base) given a subset of {extension, restriction, list, union} (of which only restriction is actually relevant)

They are the same type definition.

restriction is not in the subset, or in the of its own ;

D's base type definition is B.

D's base type definition is not the simple ur-type definition and is validly derived from B given the subset, as defined by this constraint.

D's is list or union and B is the simple ur-type definition.

B's is union and D is validly derived from a type definition in B's given the subset, as defined by this constraint.

Built-in Simple Type Definition

There is a simple type definition nearly equivalent to the simple version of the ur-type definition present in every schema by definition. It has the following properties:

Simple Type Definition of the Ur-Type anySimpleType http://www.w3.org/2001/XMLSchema the ur-type definition The empty set absent

Simple type definitions for all the built-in primitive datatypes, namely string, boolean, float, double, number, dateTime, duration, time, date, gMonth, gMonthDay, gDay, gYear, gYearMonth, hexBinary, base64Binary, anyURI (see the Primitive Datatypes section of &XSP2;), as well as for the simple and complex ur-type definitions (as previously described), are present by definition in every schema. All are in the XML Schema (namespace name http://www.w3.org/2001/XMLSchema), have an atomic with an empty and the simple ur-type definition as their base type definition and themselves as .

Similarly, simple type definitions for all the built-in derived datatypes (see the Derived Datatypes section of &XSP2;) are present by definition in every schema, with properties as specified in &XSP2; and as represented in XML in .

Schemas as a Whole

A schema consists of a set of schema components.

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

The Schema Itself

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

A set of named simple and complex type definitions. A set of named (top-level) attribute declarations. A set of named (top-level) element declarations. A set of named attribute group definitions. A set of named model group definitions. A set of notation declarations. A set of annotations.
XML Representations of Schemas

A schema is represented in XML by one or more schema documents, that is, one or more 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 element information items corresponds to a schema with components with more than one target namespace, see .

The simple and complex type definitions corresponding to all the and element information items in the &i-children;, if any, plus any included or imported definitions, see and . The (top-level) attribute declarations corresponding to all the element information items in the &i-children;, if any, plus any included or imported declarations, see and . The (top-level) element declarations corresponding to all the element information items in the &i-children;, if any, plus any included or imported declarations, see and . The attribute group definitions corresponding to all the element information items in the &i-children;, if any, plus any included or imported definitions, see and . The model group definitions corresponding to all the element information items in the &i-children;, if any, plus any included or imported definitions, see and . The notation declarations corresponding to all the element information items in the &i-children;, if any, plus any included or imported declarations, see and . The annotations corresponding to all the element information items in the &i-children;, if any.

Note that none of the attribute information items displayed above correspond directly to properties of schemas. The blockDefault, finalDefault, attributeFormDefault, elementFormDefaultand targetNamespace attributes are appealed to in the sub-sections above, as they provide global information applicable to many representation/component correspondences. The other attributes (id and version) are for user convenience, and this specification defines no semantics for them.

The definition of the schema abstract data model in makes clear that most components have a target namespace. Most components corresponding to representations within a given element information item will have a target namespace which corresponds to the targetNamespace attribute.

Since the empty string is not a legal namespace name, supplying an empty string for targetNamespace is incoherent, and is not the same as not specifying it at all. The appropriate form of schema document corresponding to a schema whose components have no is one which has no targetNamespace attribute specified at all.

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

Although the example schema at the beginning of this section might be a complete XML document, need not be the document element, but can appear within other documents. Indeed there is no requirement that a schema correspond to a (text) document at all: it could correspond to an element information item constructed 'by hand', for instance via a DOM-conformant API.

Aside from and , which do not correspond directly to any schema component at all, each of the element information items which may appear in the content of corresponds to a schema component, and all except are named. The sections below present each such item in turn, setting out the components to which it may correspond.

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 () from an external schema (which may, but need not, correspond to an actual schema document). The form of all such references is a QName.

A QName is a name with an optional namespace qualification, as defined in . When used in connection with the XML representation of schema components or references to them, this refers to the simple type QName as defined in .

An NCName is a name with no colon, as defined in . When used in connection with the XML representation of schema components in this specification, this refers to the simple type NCName as defined in .

In each of the XML representation expositions in the following sections, an attribute is shown as having type QName if and only if it is interpreted as referencing a schema component.

http://www.w3.org/2001/XMLSchema . . . . . . ]]>

The first of these is most probably a local reference, i.e. a reference to a type definition corresponding to a element information item located elsewhere in the schema document, the other two refer to type definitions from schemas for other namespaces and assume that their namespaces have been declared for import. See for a discussion of importing.

References to Schema Components from Elsewhere

The names of schema components such as type definitions and element declarations are not of type ID: they are not unique within a schema, just within a symbol space. This means that simple fragment identifiers will not always work to reference schema components from outside the context of schema documents.

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

Short-form fragment identifiers may also be used in some cases, that is when a DTD or XML Schema is available for the schema in question, and the provision of an id attribute for the representations of all primary and secondary schema components, which is of type ID, has been exploited.

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

Constraints on XML Representations of Schemas QName Interpretation

Where the type of an attribute information item in a document involved in validation is identified as QName, its &v-value; is composed of a local name and a namespace name. Its &v-value; is determined based on its &i-value; and the containing element information item's in-scope namespaces following :

its &i-value; is prefixed

There must be a namespace in the in-scope namespaces whose prefix matches the prefix.

its namespace name is the namespace name of that namespace.

Its local name is the portion of its &i-value; after the colon (':').

(its &i-value; is unprefixed)

its local name is its &i-value;.

there is a namespace in the in-scope namespaces whose prefix has no value

its namespace name is the namespace name of that namespace.

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

Whenever the word resolve in any form is used in this chapter in connection with a QName in a schema document, the following definition should be understood:

QName resolution (Schema Document)

For a QName to resolve to a schema component of a specified kind

That component is a member of the value of the appropriate property of the schema which corresponds to the schema document within which the QName appears, that is

the kind specified is simple or complex type definition

the property is the .

the kind specified is attribute declaration

the property is the .

the kind specified is element declaration

the property is the .

the kind specified is attribute group

the property is the .

the kind specified is model group

the property is the .

the kind specified is notation declaration

the property is the .

its local name matches the local name of the QName;

its target namespace is identical to the namespace name of the QName;

its namespace name is either the target namespace of the schema document containing the QName or that schema document contains an element information item the &v-value; of whose namespace &i-attribute; is identical to that namespace name.

Validation Rules for Schemas as a Whole

As the discussion above at makes clear, at the level of schema components and validation, reference to components by name is normally not involved. In a few cases, however, qualified names appearing in information items being validated must be resolved to schema components by such lookup. The following constraint is appealed to in these cases.

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 appropriate property 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 kind specified is simple or complex type definition

the property is the .

the kind specified is attribute declaration

the property is the .

the kind specified is element declaration

the property is the .

the kind specified is attribute group

the property is the .

the kind specified is model group

the property is the .

the kind specified is notation declaration

the property is the .

The component resolved to is the entry in the table whose local name matches the local name of the pair and whose target namespace is identical to the namespace name of the pair.

Schema Information Set Contributions Schema Information

Schema components provide a wealth of information about the basis of assessment, which may well be of relevance to subsequent processing. Reflecting component structure into a form suitable for inclusion in the &PSVI; is the way this specification provides for making this information available.

Accordingly, by an item 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 &PSVI; to the element information item at which assessment began, as follows:

A set of namespace schema information information items, one for each namespace name which appears as the target namespace of any schema component in the schema used for that assessment, and one for absent if any schema component in the schema had no target namespace. Each namespace schema information information item has the following properties and values: A namespace name or absent. A (possibly empty) set of schema component information items, each one an item isomorphic to a component whose target namespace is the sibling property above, drawn from the schema used for assessment. A (possibly empty) set of schema document information items, with properties and values as follows, for each schema document which contributed components to the schema, and whose targetNamespace matches the sibling property above (or whose targetNamespace was absent but that contributed components to that namespace by being d by a schema document with that targetNamespace as per ): Either a URI reference, if available, otherwise absent A document information item, if available, otherwise absent.

The property is provided for processors which wish to provide a single access point to the components of the schema which was used during assessment. Lightweight processors are free to leave it empty, but if it is 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.

ID/IDREF Table

In the &PSVI; a set of ID/IDREF binding information items is associated with the validation root element information item:

A (possibly empty) set of ID/IDREF binding information items, as specified below.

Let the eligible item set be the set of consisting of every attribute or element information item for which

its validation context is the validation root;

it was successfully validated with respect to an attribute declaration as per or element declaration as per (as appropriate) whose attribute or element (respectively) is the built-in ID, IDREF or IDREFS simple type definition or a type derived from one of them.

Then there is one ID/IDREF binding in the for every distinct string which is

the &v-value; of a member of the eligible item set whose type definition is or is derived from ID or IDREF;

one of the items in the &v-value; of a member of the eligible item set whose type definition is or is derived from IDREFS.

Each ID/IDREF binding has properties as follows:

The string identified above. A set consisting of every element information item for which

its is the validation root;

it has an attribute information item in its &i-attributes; or an element information item in its &i-children; which was validated by the built-in ID simple type definition or a type derived from it whose schema normalized value is the of this ID/IDREF binding.

The net effect of the above is to have one entry for every string used as an id, whether by declaration or by reference, associated with those elements, if any, which actually purport to have that id. See above for the validation rule which actually checks for errors here.

The ID/IDREF binding information item, unlike most other aspects of this specification, is essentially an internal bookkeeping mechanism. It is introduced to support the definition of above. Accordingly, conformant processors may, but are not required to, expose it in the &PSVI;. In other words, the above constraint may be read as saying assessment proceeds as if such an infoset item existed.

Constraints on Schemas as a Whole

All schemas (see ) must satisfy the following constraint.

Schema Properties Correct

The values of the properties of a schema must be as described in the property tableau in , modulo the impact of ;

Each of the , , , and must not contain two or more schema components with the same name and target namespace.

Schemas and Namespaces: Access and Composition

This chapter defines the mechanisms by which this specification establishes the necessary precondition for assessment, namely access to one or more schemas. This chapter also sets out in detail the relationship between schemas and namespaces, as well as mechanisms for modularization of schemas, including provision for incorporating definitions and declarations from one schema in another, possibly with modifications.

describes three levels of conformance for schema processors, and provides a formal definition of assessment. This section sets out in detail the 3-layer architecture implied by the three conformance levels. The layers are:

The assessment core, relating schema components and instance information items;

Schema representation: the connections between XML representations and schema components, including the relationships between namespaces and schema components;

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 components can be applied to in the assessment of an instance element information item. Layer 2 specifies the use of elements in XML documents as the standard XML representation for schema information in a broad range of computer systems and execution environments. To support interoperation over the World Wide Web in particular, layer 3 provides a set of conventions for schema reference on the Web. Additional details on each of the three layers is provided in the sections below.

Layer 1: Summary of the Schema-validity Assessment Core

The fundamental purpose of the assessment core is to define assessment for a single element information item and its descendants with respect to a complex type definition. All processors are required to implement this core predicate in a manner which conforms exactly to this specification.

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

As specified above, each schema component is associated directly or indirectly with a target namespace, or explicitly with no namespace. In the case of multi-namespace documents, components for more than one target namespace will co-exist in a schema.

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

The processor succeed in locating the schema components transitively required to complete an assessment (note that components derived from schema documents can be integrated with 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.

the assessment core is defined in terms of schema components at the abstract level, and no mention is made of the schema definition syntax (i.e. ). Although many processors will acquire schemas in this format, others may operate on compiled representations, on a programmatic representation as exposed in some programming language, etc.

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 in . Neither the choice of element information item for that assessment, nor which of the means of initiating assessment are used, is within the scope of this specification.

Although assessment is defined recursively, it is also intended to be implementable in streaming processors. Such processors may choose to incrementally assemble the schema during processing in response, for example, to encountering new namespaces. The implication of the invariants expressed above is that such incremental assembly must result in an assessment outcome that is the same as would be given if assessment was undertaken again with the final, fully assembled schema.

Layer 2: Schema Documents, Namespaces and Composition

The sub-sections of define an XML representation for type definitions and element declarations and so on, specifying their target namespace and collecting them into schema documents. The two following sections relate to assembling a complete schema for assessment from multiple sources. They should not be understood as a form of text substitution, but rather as providing mechanisms for distributed definition of schema components, with appropriate schema-specific semantics.

The core assessment architecture requires that a complete schema with all the necessary declarations and definitions be available. This may involve resolving both instance->schema and schema->schema references. As observed earlier in , the precise mechanisms for resolving such references are expected to evolve over time. In support of such evolution, this specification observes the design principle that references from one schema document to a schema use mechanisms that directly parallel those used to reference a schema from an instance document.

In the sections below, "schemaLocation" really belongs at layer 3. For convenience, it is documented with the layer 2 mechanisms of import and include, with which it is closely associated.

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

Schema components for a single target namespace can be assembled from several schema documents, that is several element information items:

A information item may contain any number of elements. Their schemaLocation attributes, consisting of a URI reference, identify other schema documents, that is information items.

The XML Schema corresponding to contains not only the components corresponding to its definition and declaration &i-children;, but also all the components of all the XML Schemas corresponding to any d schema documents. Such included schema documents must either (a) have the same targetNamespace as the ing schema document, or (b) no targetNamespace at all, in which case the d schema document is converted to the ing schema document's targetNamespace.

Inclusion Constraints and Semantics

In addition to the conditions imposed on element information items by the schema for schemas,

If the &v-value; of the schemaLocation &i-attribute; successfully resolves

It resolves to (a fragment of) a resource which is an XML document (of type application/xml or text/xml with an XML declaration for preference, but this is not required), which in turn corresponds to a element information item in a well-formed information set, which in turn corresponds to a valid schema.

It resolves to a element information item in a well-formed information set, which in turn corresponds to a valid schema.

In either case call the d item SII, the valid schema I and the ing item's parent item SII’.

SII has a targetNamespace &i-attribute;, and its &v-value; is identical to the &v-value; of the targetNamespace &i-attribute; of SII’ (which must have such an &i-attribute;).

Neither SII nor SII’ have a targetNamespace &i-attribute;.

SII has no targetNamespace &i-attribute; (but SII’ does).

or above is satisfied

the schema corresponding to SII’ must include not only definitions or declarations corresponding to the appropriate members of its own &i-children;, but also components identical to all the schema components of I.

above is satisfied

the schema corresponding to the d item's parent must include not only definitions or declarations corresponding to the appropriate members of its own &i-children;, but also components identical to all the schema components of I, except that anywhere the absent target namespace name would have appeared, the &v-value; of the targetNamespace &i-attribute; of SII’ is used. In particular, it replaces absent in the following places:

The target namespace of named schema components, both at the top level and (in the case of nested type definitions and nested attribute and element declarations whose code was qualified) nested within definitions;

The of a wildcard, whether negated or not;

It is not an error for the &v-value; of the schemaLocation &i-attribute; to fail to resolve it all, in which case no corresponding inclusion is performed. It is an error for it to resolve but the rest of clause 1 above to fail to be satisfied. Failure to resolve may well cause less than complete assessment outcomes, of course.

As discussed in , QNames in XML representations may fail to resolve, rendering components incomplete and unusable because of missing subcomponents. During schema construction, implementations are likely to retain QName values for such references, in case subsequent processing provides a referent. Absent target namespace names of such as-yet unresolved reference QNames in d components should also be converted if is satisfied.

The above is carefully worded so that multiple ing of the same schema document will not constitute a violation of of , but applications are allowed, indeed encouraged, to avoid ing the same schema document more than once to forestall the necessity of establishing identity component by component.

Including modified component definitions

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

A information item may contain any number of elements. Their schemaLocation attributes, consisting of a URI reference, identify other schema documents, that is information items.

The XML Schema corresponding to contains not only the components corresponding to its definition and declaration &i-children;, but also all the components of all the XML Schemas corresponding to any d schema documents. Such schema documents must either (a) have the same targetNamespace as the ing schema document, or (b) no targetNamespace at all, in which case the d schema document is converted to the ing schema document's targetNamespace.

The definitions within the element itself are restricted to be redefinitions of components from the d schema document, in terms of themselves. That is,

Type definitions must use themselves as their base type definition;

Attribute group definitions and model group definitions must be supersets or subsets of their original definitions, either by including exactly one reference to themselves or by containing only (possibly restricted) components which appear in a corresponding way in their d selves.

Not all the components of the d schema document need be redefined.

This mechanism is intended to provide a declarative and modular approach to schema modification, with functionality no different except in scope from what would be achieved by wholesale text copying and redefinition by editing. In particular redefining a type is not guaranteed to be side-effect free: it may have unexpected impacts on other type definitions which are based on the redefined one, even to the extent that some such definitions become ill-formed.

The pervasive impact of redefinition reinforces the need for implementations to adopt some form of lazy or 'just-in-time' approach to component construction, which is also called for in order to avoid inappropriate dependencies on the order in which definitions and references appear in (collections of) schema documents.

v2.xsd: ]]>

The schema corresponding to v2.xsd has everything specified by v1.xsd, with the personName type redefined, as well as everything it specifies itself. According to this schema, elements constrained by the personName type may end with a generation element. This includes not only the author element, but also the addressee element.

Redefinition Constraints and Semantics

In addition to the conditions imposed on element information items by the schema for schemas

If there are any element information items among the &i-children; other than then the &v-value; of the schemaLocation &i-attribute; must successfully resolve.

If the &v-value; of the schemaLocation &i-attribute; successfully resolves

it resolves to (a fragment of) a resource which is an XML document (see ), which in turn corresponds to a element information item in a well-formed information set, which in turn corresponds to a valid schema.

It resolves to a element information item in a well-formed information set, which in turn corresponds to a valid schema.

In either case call the d item SII, the valid schema I and the ing item's parent item SII’.

SII has a targetNamespace &i-attribute;, and its &v-value; is identical to the &v-value; of the targetNamespace &i-attribute; of SII’ (which must have such an &i-attribute;).

Neither SII nor SII’ have a targetNamespace &i-attribute;.

SII has no targetNamespace &i-attribute; (but SII’ does).

or above is satisfied

the schema corresponding to SII’ must include not only definitions or declarations corresponding to the appropriate members of its own &i-children;, but also components identical to all the schema components of I, with the exception of those explicitly redefined (see below).

above is satisfied

the schema corresponding to SII’ must include not only definitions or declarations corresponding to the appropriate members of its own &i-children;, but also components identical to all the schema components of I, with the exception of those explicitly redefined (see below), except that anywhere the absent target namespace name would have appeared, the &v-value; of the targetNamespace &i-attribute; of SII’ is used (see in for details).

Within the &i-children;, each must have a among its &i-children; and each must have a restriction or extension among its grand-&i-children; the &v-value; of whose base &i-attribute; must be the same as the &v-value; of its own name attribute plus target namespace;

Within the &i-children;, for each

it has a among its contents at some level the &v-value; of whose ref &i-attribute; is the same as the &v-value; of its own name attribute plus target namespace

It must have exactly one such group.

The &v-value; of both that group's minOccurs and maxOccurs &i-attribute; must be 1 (or absent).

it has no such self-reference

The &v-value; of its own name attribute plus target namespace must successfully resolve to a model group definition in I.

The of the model group definition which corresponds to it per must be a valid restriction of the of that model group definition in I, as defined in .

Within the &i-children;, for each

it has an among its contents the &v-value; of whose ref &i-attribute; is the same as the &v-value; of its own name attribute plus target namespace

it must have exactly one such group.

it has no such self-reference

The &v-value; of its own name attribute plus target namespace must successfully resolve to an attribute group definition in I.

The and of the attribute group definition which corresponds to it per must be valid restrictions of the and of that attribute group definition in I, as defined in , and of (where references to the base type definition are understood as references to the attribute group definition in I).

An attribute group restrictively redefined per corresponds to an attribute group whose consist all and only of those attribute uses corresponding to s explicitly present among the &i-children; of the ing . No inheritance from the d attribute group occurs. Its is similarly based purely on an explicit , if present.

Individual Component Redefinition

Corresponding to each non- member of the &i-children; of a there are one or two schema components in the ing schema:

The and &i-children; information items each correspond to two components:

One component which corresponds to the top-level definition item with the same name in the d schema document, as defined in , except that its name is absent;

One component which corresponds to the information item itself, as defined in , except that its base type definition is the component defined in 1.1 above.

This pairing ensures the coherence constraints on type definitions are respected, while at the same time achieving the desired effect, namely that references to names of redefined components in both the ing and d schema documents resolve to the redefined component as specified in 1.2 above.

The and &i-children; each correspond to a single component, as defined in , except that if and when a self-reference based on a ref &i-attribute; whose &v-value; is the same as the item's name plus target namespace is resolved, a component which corresponds to the top-level definition item of that name and the appropriate kind in I is used.

In all cases there must be a top-level definition item of the appropriate name and kind in the d schema document.

The above is carefully worded so that multiple equivalent ing of the same schema document will not constitute a violation of of , but applications are allowed, indeed encouraged, to avoid ing the same schema document in the same way more than once to forestall the necessity of establishing identity component by component (although this will have to be done for the individual redefinitions themselves).

References to schema components across namespaces

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

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

The element information item identifies namespaces used in external references, i.e. those whose QName identifies them as coming from a different namespace (or none) than the enclosing schema document's targetNamespace. The &v-value; of its namespace &i-attribute; indicates that the containing schema document may contain qualified references to schema components in that namespace (via one or more prefixes declared with namespace declarations in the normal way). If that attribute is absent, then the import allows unqualified reference to components with no target namespace. Note that components to be imported need not be in the form of a schema document; the processor is free to access or construct components using means of its own choosing.

The &v-value; of the schemaLocation, if present, gives a hint as to where a serialization of a schema document with declarations and definitions for that namespace (or none) may be found. When no schemaLocation &i-attribute; is present, the schema author is leaving the identification of that schema to the instance, application or user, via the mechanisms described below in . When a schemaLocation is present, it must contain a single URI reference which the schema author warrants will resolve to a serialization of a schema document containing the component(s) in the ed namespace referred to elsewhere in the containing schema document.

Since both the namespace and schemaLocation &i-attribute; are optional, a bare <import/> information item is allowed. This simply allows unqualified reference to foreign components with no target namespace without giving any hints as to where to find them.

The same namespace may be used both for real work, and in the course of defining 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 of the schema for schemas) the target namespace and the XML Schema namespace differ, without massive redeclaration of the default namespace either internal references to the names being defined in a schema document or the schema declaration and definition elements themselves must be explicitly qualified. This example takes the first option -- most other examples in this specification have taken the second.

Import Constraints and Semantics

In addition to the conditions imposed on element information items by the schema for schemas

the namespace &i-attribute; is present

its &v-value; must not match the &v-value; of the enclosing 's targetNamespace &i-attribute;.

the namespace &i-attribute; is not present

the enclosing must have a targetNamespace &i-attribute;

If the application schema reference strategy using the &v-value;s of the schemaLocation and namespace &i-attributes;, provides a referent, as defined by ,

The referent is (a fragment of) a resource which is an XML document (see ), which in turn corresponds to a element information item in a well-formed information set, which in turn corresponds to a valid schema.

The referent is a element information item in a well-formed information set, which in turn corresponds to a valid schema.

In either case call the item SII and the valid schema I.

there is a namespace &i-attribute;

its &v-value; must be identical to the &v-value; of the targetNamespace &i-attribute; of SII.

there is no namespace &i-attribute;

SII must have no targetNamespace &i-attribute;

It is not an error for the application schema reference strategy to fail. It is an error for it to resolve but the rest of above to fail to be satisfied. Failure to find a referent may well cause less than complete assessment outcomes, of course.

The schema components (that is , , , , , ) of a schema corresponding to a element information item with one or more element information items must include not only definitions or declarations corresponding to the appropriate members of its &i-children;, but also, for each of those element information items for which above is satisfied, a set of schema components identical to all the schema components of I.

The above is carefully worded so that multiple ing of the same schema document will not constitute a violation of of , but applications are allowed, indeed encouraged, to avoid ing the same schema document more than once to forestall the necessity of establishing identity component by component. Given that the schemaLocation &i-attribute; is only a hint, it is open to applications to ignore all but the first for a given namespace, regardless of the &v-value; of schemaLocation, but such a strategy risks missing useful information when new schemaLocations are offered.

Layer 3: Schema Document Access and Web-interoperability

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

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 by URI 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 ), and are represented in the standard XML schema definition form described by layer 2 (that is as element information items).

there will often be times when a schema document will be a complete XML 1.0 document whose document element is . There will be other occasions in which items will be contained in other documents, perhaps referenced using fragment and/or XPointer notation.

The variations among server software and web site administration policies make it difficult to recommend any particular approach to retrieval requests intended to retrieve serialized schema documents. An Accept header of application/xml, text/xml; q=0.9, */* is perhaps a reasonable starting point.

How schema definitions are located on the Web

As described in , processors are responsible for providing the schema components (definitions and declarations) needed for assessment. This section introduces a set of normative conventions to facilitate interoperability for instance and schema documents retrieved and processed from the Web.

As discussed above in , 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 arbitrary schemas in any of the ways set out in . However, it is useful to have a common convention for determining the schema to use. Accordingly, general-purpose schema-aware processors (i.e. those not specialized to one or a fixed set of pre-determined schemas) undertaking assessment of a document on the web must behave as follows:

unless directed otherwise by the user, assessment is undertaken on the document element information item of the specified document;

unless directed otherwise by the user, the processor is required to construct a schema corresponding to a schema document whose targetNamespace is identical to the namespace name, if any, of the element information item on which assessment is undertaken.

The composition of the complete schema for use in assessment is discussed in above. The means used to locate appropriate schema document(s) are processor and application dependent, subject to the following requirements:

Schemas are represented on the Web in the form specified above in ;

The author of a document uses namespace declarations to indicate the intended interpretation of names appearing therein; there may or may not be a schema retrievable via the namespace name. Accordingly whether a processor's default behavior is or is not to attempt such dereferencing, it must always provide for user-directed overriding of that default.

Experience suggests that it is not in all cases safe or desirable from a performance point of view to dereference namespace names as a matter of course. User community and/or consumer/provider agreements may establish circumstances in which such dereference is a sensible default strategy: this specification allows but does not require particular communities to establish and implement such conventions. Users are always free to supply namespace names as schema location information when dereferencing is desired: see below.

On the other hand, in case a document author (human or not) created a document with a particular schema in view, and warrants that some or all of the document is conforms to that schema, the schemaLocation and noNamespaceSchemaLocation &i-attributes; (in the XML Schema instance namespace, that is, http://www.w3.org/2001/XMLSchema-instance) (hereafter xsi:schemaLocation and xsi:noNamespaceSchemaLocation) are provided. The first records the author's warrant with pairs of URI references (one for the namespace name, and one for a hint as to the location of a schema document defining names for that namespace name). The second similarly provides a URI reference as a hint as to the location of a schema document with no targetNamespace &i-attribute;.

Unless directed otherwise, for example by the invoking application or by command line option, processors should attempt to dereference each schema document location URI in the &v-value; of such xsi:schemaLocation and xsi:noNamespaceSchemaLocation &i-attributes;, see details below.

xsi:schemaLocation and xsi:noNamespaceSchemaLocation &i-attributes; can occur on any element. However, it is an error if such an attribute occurs after the first appearance of an element or attribute information item within an element information item initially validated whose namespace name it addresses. According to the rules of , 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.

Multiple schema bindings can be declared using a single attribute. 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 in schemaLocation can, but need not be identical to those actually qualifying the element within whose start tag it is found or its other attributes. For example, as above, all schema location information can be declared on the document element of a document, if desired, regardless of where the namespaces are actually used.

Schema Document Location Strategy

Given a namespace name (or none) and (optionally) a URI reference from xsi:schemaLocation or xsi:noNamespaceSchemaLocation, schema-aware processors may implement any combination of the following strategies, in any order:

Do nothing, for instance because a schema containing components for the given namespace name is already known to be available, or because it is known in advance that no efforts to locate schema documents will be successful (for example in embedded systems);

Based on the location URI, identify an existing schema document, either as a resource which is an XML document or a element information item, in some local schema repository;

Based on the namespace name, identify an existing schema document, either as a resource which is an XML document or a element information item, in some local schema repository;

Attempt to resolve the location URI, to locate a resource on the web which is or contains or references a element;

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 can be standardized in the future without reopening this specification. For example, the W3C is currently considering initiatives to standardize the packaging of resources relating to particular documents and/or namespaces: this would be an addition to the mechanisms described here for layer 3. This architecture also facilitates innovation at layer 2: for example, it would be possible in the future to define an additional standard for the representation of schema components which allowed e.g. type definitions to be specified piece by piece, rather than all at once.

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 the one hand, and schema validation outcomes, on the other.

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 whatever means are appropriate, but general purpose processors should implement the strategy set out in , starting with the namespaces declared in the document whose assessment is being undertaken, and the &v-value;s of the xsi:schemaLocation and xsi:noNamespaceSchemaLocation &i-attributes; thereof, if any, along with an other information about schema identity or schema document location provided by users in application-specific ways, if any.

It is an error if a schema and all the components which are the value of any of its properties, recursively, fail to satisfy all the relevant Constraints on Schemas set out in the last section of each of the subsections of .

If a schema is derived from one or more schema documents (that is, one or more element information items) based on the correspondence rules set out in and , two additional conditions hold:

It is an error if any such schema document would not be fully valid with respect to a schema corresponding to the , that is, following schema-validation with such a schema, the element information items would have a property with value full or partial and a property with value valid.

It is an error if any such schema document is or contains any element information items which violate any of the relevant Schema Representation Constraints set out in .

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

Assessing Schema-Validity

With a schema which satisfies the conditions expressed in above, the schema-validity of an element information item can be assessed. Three primary approaches to this are possible:

The user or application identifies a complex type definition from among the of the schema, and appeals to ();

The user or application identifies a element declaration from among the of the schema, checks that its and match the local name and namespace name of the item, and appeals to ();

The processor starts from with no stipulated 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 (via xsi:type) or not.

The outcome of this effort, in any case, will be manifest in the validation attempted and validity properties on the element information item and its &i-attributes; and &i-children;, recursively, as defined by and . It is up to applications to decide what constitutes a successful outcome.

Note that every element and attribute information item participating in the assessment will also have a validation context property which refers back to the element information item at which assessment began. This item, that is the element information item at which assessment began, is called the validation root.

This specification does not reconstruct the XML 1.0 notion of root in either schemas or instances. Equivalent functionality is provided for at assessment invocation, via above.

This specification has nothing normative to say about multiple assessment episodes. It should however be clear from the above that if a processor restarts assessment with respect to a &PSVI; some &PSVI; contributions from the previous assessment may be overwritten. Restarting nonetheless may be useful, particularly at a node whose validation attempted property is none, in which case there are three obvious cases in which additional useful information may result:

assessment was not attempted because of a validation failure, but declarations and/or definitions are available for at least some of the &i-children; or &i-attributes;;

assessment was not attempted because a named definition or declaration was missing, but after further effort the processor has retrieved it.

assessment was not attempted because it was skipped, but the processor has at least some declarations and/or definitions available for at least some of the &i-children; or &i-attributes;.

Missing Sub-components

At the beginning of , attention is drawn to the fact that most kinds of schema components have properties which are described therein as having other components, or sets of other components, as values, but that when components are constructed on the basis of their correspondence with element information items in schema documents, such properties usually correspond to QNames, and the resolution of such QNames may fail, resulting in one or more values of or containing absent where a component is mandated.

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

In the case of attribute information items, the effect is as if of had failed;

In the case of element information items, the effect is as if of had failed;

In the case of element information items, processors may choose to continue assessment: see lax assessment.

Because of the value specification for in , if this situation ever arises, the document as a whole cannot show a of full.

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 in ) they support, consistently with the conditions set out above.

Schema for Schemas (normative)

The XML Schema definition for &XSP1; itself is presented here as normative part of the specification, and as an illustrative example of the XML Schema in defining itself with the very constructs that it defines. The names of XML Schema language types, elements, attributes and groups defined here are evocative of their purpose, but are occasionally verbose.

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

Since an &XSP1; is an XML document, it has optional XML and doctype declarations that are provided here for completeness. The root schema element defines a new schema. Since this is a schema for &XSP1;, the targetNamespace references the XML Schema namespace itself.

And that is the end of the schema for &XSP1;.

References (normative) XML Schema Part 2: Datatypes, Paul V. Biron and Ashok Malhotra, eds., W3C, 2 May 2001. See http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html XML Schema Requirements , Ashok Malhotra and Murray Maloney, eds., W3C, 15 February 1999. See http://www.w3.org/TR/1999/NOTE-xml-schema-req-19990215 Extensible Markup Language (XML) 1.0, Second Edition, Tim Bray et al., eds., W3C, 6 October 2000. See http://www.w3.org/TR/2000/REC-xml-20001006 XML Information Set, John Cowan and Richard Tobin, eds., W3C, 16 March 2001. See http://www.w3.org/TR/2001/WD-xml-infoset-20010316/ Namespaces in XML, Tim Bray et al., eds., W3C, 14 January 1999. See http://www.w3.org/TR/1999/REC-xml-names-19990114/ XML Pointer Language (XPointer), Eve Maler and Steve DeRose, eds., W3C, 8 January 2001. See http://www.w3.org/TR/2001/WD-xptr-20010108/ XML Path Language, James Clark and Steve DeRose, eds., W3C, 16 November 1999. See http://www.w3.org/TR/1999/REC-xpath-19991116 Outcome Tabulations (normative)

To facilitate consistent reporting of schema errors and validation failures, this section tabulates and provides unique names for all the constraints listed in this document. Wherever such constraints have numbered parts, reports should use the name given below plus the part number, separated by a period ('.'). Thus for example cos-ct-extends.1.2 should be used to report a violation of the of .

Validation Rules

Contributions to the &PSVI; Schema Representation Constraints

Schema Component Constraints Required Information Set Items and Properties (normative)

This specification requires as a precondition for assessment an information set as defined in which supports at least the following information items and properties:

local name, namespace name, normalized value

character code

local name, namespace name, children, attributes, in-scope namespaces or namespace attributes

prefix, namespace name

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

This appendix is intended to satisfy the requirements for Conformance to the specification.

Schema Components Diagram (non-normative) Glossary (non-normative)

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

An XSL macro is used to collect definitions from throughout the spec and gather them here for easy reference.
DTD for Schemas (non-normative)

The DTD for &XSP1; is given below. Note there is no implication here the schema must be the root element of a document.

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

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

A specification of the import of which does not appeal to a processing model is difficult. What follows is intended as guidance, without claiming to be complete.

Two non-group particles overlap if

They are both element declaration particles whose declarations have the same and .

or

They are both element declaration particles one of which is in the other's substitution group.

or

They are both wildcards, and the intensional intersection of their s as defined in is not the empty set.

or

One is a wildcard and the other an element declaration, and the of the element declaration, or of any member of its substitution group, is valid with respect to the of the wildcard.

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

are both in the of a choice or all group

or

may validate adjacent information items and the first has less than .

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

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

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

The following have contributed material to this draft:

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 other forums who have contributed directly or indirectly to the process or content of creating this document. The Working Group is particularly grateful to Lotus Development Corp. and IBM for providing teleconferencing facilities.

The current members of the XML Schema Working Group are:

Jim Barnette Defense Information Systems Agency (DISA) Paul V. Biron Health Level Seven Don Box DevelopMentor Allen Brown Microsoft Lee Buck TIBCO Extensibility Charles E. Campbell Informix Wayne Carr Intel Peter Chen Bootstrap Alliance and LSU David Cleary Progress Software Dan Connolly W3C staff contact Ugo Corda Xerox Roger L. Costello MITRE Haavard Danielson Progress Software Josef Dietl Mozquito Technologies David Ezell Hewlett-Packard Company Alexander Falk Altova GmbH David Fallside IBM Dan Fox Defense Logistics Information Service (DLIS) Matthew Fuchs Commerce One Andrew Goodchild Distributed Systems Technology Centre (DSTC Pty Ltd) Paul Grosso Arbortext, Inc Martin Gudgin DevelopMentor Dave Hollander Contivo, Inc co-chair Mary Holstege Invited Expert Jane Hunter Distributed Systems Technology Centre (DSTC Pty Ltd) Rick Jelliffe Academia Sinica Simon Johnston Rational Software Bob Lojek Mozquito Technologies Ashok Malhotra Microsoft Lisa Martin IBM Noah Mendelsohn Lotus Development Corporation Adrian Michel Commerce One Alex Milowski Invited Expert Don Mullen TIBCO Extensibility Dave Peterson Graphic Communications Association Jonathan Robie Software AG Eric Sedlar Oracle Corp. C. M. Sperberg-McQueen W3C co-chair Bob Streich Calico Commerce William K. Stumbo Xerox Henry S. Thompson University of Edinburgh Mark Tucker Health Level Seven Asir S. Vedamuthu webMethods, Inc Priscilla Walmsley XMLSolutions Norm Walsh Sun Microsystems Aki Yoshida SAP AG Kongyi Zhou Oracle Corp.

The XML Schema Working Group has benefited in its work from the participation and contributions of a number of people not currently members of the Working Group, including in particular those named below. Affiliations given are those current at the time of their work with the WG.

Paula Angerstein Vignette Corporation David Beech Oracle Corp. Gabe Beged-Dov Rogue Wave Software Greg Bumgardner Rogue Wave Software Dean Burson Lotus Development Corporation Mike Cokus MITRE Andrew Eisenberg Progress Software Rob Ellman Calico Commerce George Feinberg Object Design Charles Frankston Microsoft Ernesto Guerrieri Inso Michael Hyman Microsoft Renato Iannella Distributed Systems Technology Centre (DSTC Pty Ltd) Dianne Kennedy Graphic Communications Association Janet Koenig Sun Microsystems Setrag Khoshafian Technology Deployment International (TDI) Ara Kullukian Technology Deployment International (TDI) Andrew Layman Microsoft Dmitry Lenkov Hewlett-Packard Company John McCarthy Lawrence Berkeley National Laboratory Murata Makoto Xerox Eve Maler Sun Microsystems Murray Maloney Muzmo Communication, acting for Commerce One Chris Olds Wall Data Frank Olken Lawrence Berkeley National Laboratory Shriram Revankar Xerox Mark Reinhold Sun Microsystems John C. Schneider MITRE Lew Shannon NCR William Shea Merrill Lynch Ralph Swick W3C Tony Stewart Rivcom Matt Timmermans Microstar Jim Trezzo Oracle Corp. Steph Tryphonas Microstar