Please refer to theerrata for this document, which may include some normative corrections.
See alsotranslations.
This document is also available in these non-normative formats:XML,XHTML with changes since version 1.0 marked,XHTML with changes since previous Working Draft marked,Independent copy of the schema for schema documents,Independent copy of the DTD for schema documents,Independent tabulation of components and microcomponents, and List of translations.
Copyright © 2012 W3C® (MIT,ERCIM,Keio), All Rights Reserved. W3Cliability,trademark anddocument use rules apply.
This document specifies the XML Schema Definition Language, which offers facilities for describing the structure and constraining the contents of XML documents, including those which exploit the XML Namespace facility. The schema language, which is itself represented in an XML vocabulary and uses namespaces, substantially reconstructs and considerably extends the capabilities found in XML document type definitions (DTDs). This specification depends onXML Schema Definition Language 1.1 Part 2: Datatypes.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in theW3C technical reports index at http://www.w3.org/TR/.
This W3C Recommendation specifies the W3C XML Schema Definition Language (XSD) 1.1. It is here made available for use by W3C members and the public. XSD 1.1 retains all the essential features of XSD 1.0 but adds several new features to support functionality requested by users, fixes many errors in XSD 1.0, and clarifies wording.
For those primarily interested in the changes since version 1.0, the appendixChanges since version 1.0 (non-normative) (§G) is the recommended starting point. It summarizes both changes made since XSD 1.0 and some changes which were expected (and predicted in earlier drafts of this specification) but have not been made after all. Accompanying versions of this document display in color all changes to normative text since version 1.0 and since the previous Working Draft.
Comments on this document should be made in W3C's public installation of Bugzilla, specifying "XML Schema" as the product. Instructions can be found athttp://www.w3.org/XML/2006/01/public-bugzilla. If access to Bugzilla is not feasible, please send your comments to the W3C XML Schema comments mailing list,www-xml-schema-comments@w3.org (archive) and note explicitly that you have not made a Bugzilla entry for the comment. Each Bugzilla entry and email message should contain only one comment.
This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited 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.
Animplementation report for XSD 1.1 was prepared and used in the Director's decision to publish the previous version of this specification as a Proposed Recommendation. The Director's decision to publish this document as a W3C Recommendation is based on consideration of reviews of the Proposed Recommendation by the public and by the members of the W3C Advisory committee.
The W3C XML Schema Working Group intends to process comments made about this recommendation, with any approved changes being handled as errata to be published separately.
This document has been produced by theW3C XML Schema Working Group as part of the W3CXML Activity. The goals of XSD 1.1 are discussed in the documentRequirements for XML Schema 1.1. The authors of this document are the members of the XML Schema Working Group. Different parts of this specification have different editors.
This document was produced by a group operating under the5 February 2004 W3C Patent Policy. W3C maintains apublic list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes containsEssential Claim(s) must disclose the information in accordance withsection 6 of the W3C Patent Policy.
The English version of this specification is the only normative version. Information about translations of this document is available athttp://www.w3.org/2003/03/Translations/byTechnology?technology=xmlschema.
This document sets out the structural part of the XML Schema Definition Language.
Chapter 2 presents aConceptual Framework (§2) for XSD, including an introduction to the nature of XSD schemas and an introduction to the XSD abstract data model, along with other terminology used throughout this document.
Chapter 3,Schema Component Details (§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 an XSD schema for an XSD 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 presentsSchemas and Namespaces: Access and Composition (§4), 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 discussesSchemas and Schema-validity Assessment (§5), including the overall approach to schema-validity assessment of documents, and responsibilities of schema-aware processors.
The normative appendices include aSchema for Schema Documents (Structures) (normative) (§A) for the XML representation of schemas andNormative (§L.1).
The non-normative appendices include theDTD for Schemas (non-normative) (§I) and aGlossary (non-normative) (§H).
This document is primarily intended as a language definition reference. As such, although it contains a few examples, it isnot 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[XML Schema: Primer] is a much better starting point than this document.
The Working Group has three main goals for this version of W3C XML Schema:
These goals are in tension with one another. The Working Group's strategic guidelines for changes between versions 1.0 and 1.1 can be summarized as follows:
The aim with regard to compatibility is that
The purpose ofXML Schema Definition Language: Structures is to define the nature of XSD 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 XSD schema is to define and describe a class of XML documents by using schema components to constrain and document the meaning, usage and relationships of their constituent parts: datatypes, elements and their content and attributes and their values. Schemas can 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,XML Schema Definition Language: Structures can be used to define, describe and catalogue XML vocabularies for classes of XML documents.
Any application that consumes well-formed XML can use the formalism defined here to express syntactic, structural and value constraints applicable to its document instances. The XSD formalism allows a useful level of constraint checking to be described and implemented for a wide spectrum of XML applications. However, the language defined by this specification does not attempt to provideall the facilities that might be needed by applications. Some applications will require constraint capabilities not expressible in this language, and so will need to perform their own additional validations.
xs
) The XML representation of schema components uses a vocabulary identified by the namespace namehttp://www.w3.org/2001/XMLSchema
. For brevity, the text and examples in this specification use the prefixxs:
to stand for this namespace; in practice, any prefix can be used.
untyped
,untypedAtomic
) which are not defined in thisspecification; see the[XDM]specification for details of those types.Users of the namespaces defined here should be aware, as a matter of namespace policy, that more names in this namespace may be givendefinitions in future versions of this or other specifications.
xsi
)This specification defines several attributes for direct use in any XML documents, as described inSchema-Related Markup in Documents Being Validated (§2.7). These attributes are in the namespace whose name ishttp://www.w3.org/2001/XMLSchema-instance
. For brevity, the text and examples in this specification use the prefixxsi:
to stand for this namespace; in practice, any prefix can be used.
Users of the namespaces defined here should be aware, as a matter of namespace policy, that more names in this namespace may be givendefinitions in future versions of this or other specifications.
vc
) The pre-processing of schema documents described inConditional inclusion (§4.2.2) uses attributes in the namespacehttp://www.w3.org/2007/XMLSchema-versioning
. For brevity, the text and examples in this specification use the prefixvc:
to stand for this namespace; in practice, any prefix can be used.
Users of the namespaces defined here should be aware, as a matter of namespace policy, that more names in this namespace may be given definitions in future versions of this or other specifications.
http://www.w3.org/XML/1998/namespace
http://www.w3.org/2001/XMLSchema
http://www.w3.org/2001/XMLSchema-instance
http://www.w3.org/2007/XMLSchema-versioning
Components and source declarationsmust not specifyhttp://www.w3.org/2000/xmlns/
as their target namespace. If they do, then the schema and/or schema document is in·error·.
html
bound tohttp://www.w3.org/1999/xhtml
my
(in examples) bound to the target namespace of the example schema documentrddl
bound tohttp://www.rddl.org/
vc
bound tohttp://www.w3.org/2007/XMLSchema-versioning
(defined in this and related specifications)xhtml
bound tohttp://www.w3.org/1999/xhtml
xlink
bound tohttp://www.w3.org/1999/xlink
xs
bound tohttp://www.w3.org/2001/XMLSchema
(defined in this and related specifications)xsi
bound tohttp://www.w3.org/2001/XMLSchema-instance
(defined in this and related specifications)xsl
bound tohttp://www.w3.org/1999/XSL/Transform
In practice, any prefix bound to the appropriate namespace namemay be used (unless otherwise specified by the definition of the namespace in question, as forxml
andxmlns
).
Sometimes other specifications or Application Programming Interfaces (APIs) need to refer to the XML Schema Definition Language in general, sometimes they need to refer to a specific version of the language, possibly even to a version defined in a superseded draft. To make such references easy and enable consistent identifiers to be used, we provide the following URIs to identify these concepts.
http://www.w3.org/XML/XMLSchema
http://www.w3.org/XML/XMLSchema/vX.Y
http://www.w3.org/XML/XMLSchema/v1.0
identifies XSD version 1.0 andhttp://www.w3.org/XML/XMLSchema/v1.1
identifies XSD version 1.1.http://www.w3.org/XML/XMLSchema/vX.Y/Ne
X.Y
of the XSD specification. For example,http://www.w3.org/XML/XMLSchema/v1.0/2e
identifies the second edition of XSD version 1.0.http://www.w3.org/XML/XMLSchema/vX.Y/Ne/yyyymmdd
X.Y
of the XSD specification published on the particular dateyyyy-mm-dd
. For example,http://www.w3.org/XML/XMLSchema/v1.0/1e/20001024
identifies the language defined in the XSD version 1.0 Candidate Recommendation (CR) published on 24 October 2000, andhttp://www.w3.org/XML/XMLSchema/v1.0/2e/20040318
identifies the language defined in the XSD version 1.0 Second Edition Proposed Edited Recommendation (PER) published on 18 March 2004.Please seeXSD Language Identifiers (non-normative) (§K) for a complete list of XML Schema Definition Language identifiers which exist to date.
The definition ofXML Schema Definition Language: Structures depends on the following specifications:[XML Infoset],[XML Namespaces 1.1],[XPath 2.0], and[XML Schema: Datatypes].
SeeRequired Information Set Items and Properties (normative) (§D) for a tabulation of the information items and properties specified in[XML Infoset] which this specification requires as a precondition to schema-aware processing.
[XML Schema: Datatypes] defines some datatypes which depend on definitions in[XML 1.1] and[XML Namespaces 1.1]; those definitions, and therefore the datatypes based on them, vary between version 1.0 ([XML 1.0],[Namespaces in XML 1.0]) and version 1.1 ([XML 1.1],[XML Namespaces 1.1]) of those specifications. In any given schema-validity-·assessment· episode, the choice of the 1.0 or the 1.1 definition of those datatypes is·implementation-defined·.
Conforming implementations of this specificationmay provide either the 1.1-based datatypes or the 1.0-based datatypes, or both. If both are supported, the choice of which datatypes to use in a particular assessment episodeshould be under user control.
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[Definition:] aterm 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">
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:
References to properties of schema components are links to the relevant definition as exemplified above, set off with curly braces, for instance{example property}.
For a given componentC, an expression of the form "C.{example property}" denotes the (value of the) property{example property} for componentC. The leading "C." (or more) is sometimes omitted, if the identity of the component and any other omitted properties is understood from the context. This "dot operator" is left-associative, so "C.{p1}.{p2}" means the same as "(C.{p1}) .{p2}" and denotes the value of property{p2} within the component or·property record· which itself is the value ofC's{p1} property. White space on either side of the dot operator has no significance and is used (rarely) solely for legibility.
For componentsC1 andC2, an expression of the form "C1 . {example property 1} =C2 . {example property 2}" means thatC1 andC2 have the same value for the property (or properties) in question. Similarly, "C1 =C2" means thatC1 andC2 are identical, and "C1.{example property} =C2" thatC2 is the value ofC1.{example property}.
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 determines which of several different components corresponds to the source declaration, 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 forsize
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[XML Schema: Datatypes], 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.
example
Element Information ItemReferences to elements in the text are links to the relevant illustration as exemplified above, set off with angle brackets, for instance<example>.
Unless otherwise specified, references to attribute values are references to the·actual value· of the attribute information item in question, not to its·normalized value· or to other forms or varieties of "value" associated with it. For a given element information itemE, expressions of the form "E hasatt1
=V" are short-hand for "there is an attribute information item namedatt1
among the[attributes] ofE and its·actual value· isV." If the identity ofE is clear from context, expressions of the form "att1
=V" are sometimes used. The form "att1
≠V" is also used to specify that the·actual value· ofatt1
isnotV.
References to properties of information items as defined in[XML Infoset] are notated as links to the relevant section thereof, set off with square brackets, for example[children].
Properties which this specification defines for information items are introduced as follows:
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[new property].
The "dot operator" described above for components and their properties is also used for information items and their properties. For a given information itemI, an expression of the form "I . [new property]" denotes the (value of the) property[new property] for itemI.
Lists of normative constraints are typically introduced with phrase like "all of the following are true" (or "... apply"), "one of the following is true", "at least one of the following is true", "one or more of the following is true", "the appropriate case among the following is true", etc. The phrase "one of the following is true" is used in cases where the authors believe the items listed to be mutually exclusive (so that the distinction between "exactly one" and "one or more" does not arise). If the items in such a list are not in fact mutually exclusive, the phrase "one of the following" should be interpreted as meaning "one or more of the following". The phrase "the appropriate case among the following" is used only when the cases are thought by the authors to be mutually exclusive; if the cases in such a list are not in fact mutually exclusive, the first applicable case should be taken. Once a case has been encountered with a true condition, subsequent casesmust not be tested.
The following highlighting is used for non-normative commentary in this document:
Within normative prose in this specification, the wordsmay,should,must andmust not are defined as follows:
These definitions describe in terms specific to this document the meanings assigned to these terms by[IETF RFC 2119]. The specific wording follows that of[XML 1.1].
Where these terms appear without special highlighting, they are used in their ordinary senses and do not express conformance requirements. Where these terms appear highlighted within non-normative material (e.g. notes), they are recapitulating rules normatively stated elsewhere.
This specification provides a further description of error and of conformant processors' responsibilities with respect to errors inSchemas and Schema-validity Assessment (§5).
This chapter gives an overview ofXML Schema Definition Language: Structures at the level of its abstract data model.Schema Component Details (§3) provides details on this model, including a normative representation in XML for the components of the model. Readers interested primarily in learning to write schema documents will find it most useful first to read[XML Schema: Primer] for a tutorial introduction, and only then to consult the sub-sections ofSchema Component Details (§3) namedXML Representation of ... for the details.
An XSD schema is a set 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[XML Infoset]), and furthermore to specify additional information about those items and their descendants. These augmentations to the information set make explicit information that was implicitly present in the original document (or in the original document and the governing schema, taken together), such as normalized and/or default values for attributes and elements and the types of element and attribute information items. The input information set is also augmented with information about the validity of the item, or about other properties described in this specification.[Definition:] We refer to the augmented infoset which results from conformant processing as defined in this specification as thepost-schema-validation infoset, orPSVI. Conforming processorsmay provide access to some or all of the PSVI, as described inSubset of the Post-schema-validation Infoset (§C.1). The mechanisms by which processors provide such access to the PSVI are neither defined nor constrained by this specification.
Throughout this specification,[Definition:] the wordassessment is used to refer to the overall process of local validation, recursive determination of validation outcome, and infoset augmentation, i.e. as a short form for "·schema-validity assessment·".
In general, avalid document is a document whose contents obey the constraints expressed in a particular schema. Since a document may be validated against many different schemas, it is often clearer to speak of a document being validagainst a particular schema. When this specification is used, document validity can be defined operationally in terms of the·post-schema-validation infoset· properties on the nodes of the document (in particular [validity]). Several similar but distinct kinds of validity are usefully distinguished, for which terms are defined below inSchema-validity and documents (§2.5).
This specification builds on[XML 1.1] and[XML Namespaces 1.1]. The concepts and definitions used herein regarding XML are framed at the abstract level ofinformation items as defined in[XML Infoset]. By definition, this use of the infoset providesa priori guarantees ofwell-formedness (as defined in[XML 1.1]) andnamespace conformance (as defined in[XML Namespaces 1.1]) for all candidates for·assessment· and for all·schema documents·.
Just as[XML 1.1] and[XML Namespaces 1.1] can be described in terms of information items, XSD schemas can be described in terms of an abstract data model. In defining schemas in terms of an abstract data model, this specification rigorously specifies the information whichmust be available to a conforming XSD 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.
[Definition:] Schema component is the generic term for the building blocks that make up the abstract data model of the schema.[Definition:] AnXSD schema is a set of·schema components·. There are several kinds of schema component, falling into three groups. The primary schema components, whichmay (type definitions) ormust (element and attribute declarations) have names, are as follows:
The secondary schema components, are as follows:
Finally, the "helper" schema components provide small parts of other schema components; they are dependent on their context:
The name[Definition:] Component covers all the different kinds of schema component defined in this specification.
During·validation·,[Definition:] declaration components are associated by (qualified) name to information items being·validated·.
On the other hand,[Definition:] definition components define internal schema components that can be used in other schema components.
[Definition:] Declarations and definitionsmay and in some casesmust have and be identified bynames, which are NCNames as defined by[XML Namespaces 1.1].
[Definition:] Several kinds of component have atarget namespace, which is either·absent· or a namespace name, also as defined by[XML Namespaces 1.1]. The·target namespace· serves to identify the namespace within which the association between the component and its name exists.
Anexpanded name, as defined in[XML Namespaces 1.1], is a pair consisting of a namespace name, whichmay be·absent·, and a local name. Theexpanded name of any component with both a·target namespace· property and a·component name· property is the pair consisting of the values of those two properties. Theexpanded name of a declaration is used to help determine which information items will be·governed· by the declaration.
·Validation·, defined in detail inSchema Component Details (§3), is a relation between information items and schema components. For example, an attribute information item is·validated· with respect to an attribute declaration, a list of element information items 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·.
The abstract model provides two kinds of type definition component: simple and complex.
[Definition:] This specification uses the phrasetype 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.
[Definition:] Except for·xs:anyType
·, every·type definition· is, by construction,either a·restriction· or an·extension· of someother type definition. The exception·xs:anyType
· is a·restriction· of itself.With the exception of the loop on·xs:anyType
·, the graph of these relationships formsa tree known as theType DefinitionHierarchy with·xs:anyType
· as itsroot.
[Definition:] The type definition used as the basisfor an·extension· or·restriction· isknown as thebase type definition of thatdefinition.[Definition:] If a type definitionD can reach a type definitionB by following its base type definition chain, thenD is said to bederived fromB. In most cases, a type definition is derived from other type definitions. The only exception is·xs:anyType
·, which is derived from itself.
[Definition:] A type defined with the same constraints as its·base type definition·, or with more, is said to be arestriction. The added constraints might include narrowed ranges or reduced alternatives. Given two typesA andB, if the definition ofA is a·restriction· of thedefinition ofB, then members of typeA are always locallyvalid against typeB as well.
[Definition:] A complextype definition which allows element or attribute content inaddition to that allowed by another specified type definitionis said to be anextension.
[Definition:] A special complex typedefinition, (referred to in earlier versions of this specification as 'the ur-type definition') whosename isanyType in the XSD namespace, ispresent in each·XSD schema·. Thedefinition ofanyType serves as defaulttype definition for element declarations whose XMLrepresentation does not specify one.
[Definition:] A special simple typedefinition, whose name iserror in the XSDnamespace, is also present in each·XSD schema·. TheXSDerror
typehas no valid instances. It can be used in any place whereother types are normally used; in particular, it can be usedin conditional type assignment to cause elements which satisfycertain conditions to be invalid.
For brevity, the text and examples in this specification often use the qualified namesxs:anyType
andxs:error
for these type definitions. (In practice, any appropriately declared prefix can be used, as described inSchema-Related Markup in Documents Being Validated (§2.7).)
A simple type definition is a set of constraints on strings and information about the values they encode, applicable to the·normalized value· of an 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[XML Schema: Datatypes]) or user-defined, is a·restriction· of its·base type definition·.[Definition:] A special·restriction· of·xs:anyType
·, whose name isanySimpleType in the XSD namespace, is the root of the·Type Definition Hierarchy· for all simple type definitions.·xs:anySimpleType
· has a lexical space containing all sequences of characters in the Universal Character Set (UCS) and a value space containing allatomic values and all finite-length lists ofatomic values. As with·xs:anyType
·, thisspecification sometimes uses the qualified namexs:anySimpleType
to designate this typedefinition. Thebuilt-in list datatypes all have·xs:anySimpleType
· as their·base type definition·.
[Definition:] There is a further special datatypecalledanyAtomicType, a·restriction· of·xs:anySimpleType
·, which is the·base type definition·of all the primitive datatypes. This type definition is often referredto simply as "xs:anyAtomicType
". It too is considered to have an unconstrained lexical space. Its value space consists of the union of the value spaces of all the primitive datatypes.
[Definition:] Datatypes can beconstructed from other datatypes byrestricting the value space or lexical space of a{base type definition} using zero or moreConstraining Facets, by specifying the new datatype as alist of items of some{item type definition}, or by defining it as aunion of some specified sequence of{member type definitions}.
The mapping from lexical space to value space is unspecified for items whose type definition is·xs:anySimpleType
· or·xs:anyAtomicType
·. Accordingly this specification does not constrain processors' behavior in areas where this mapping is implicated, for example checking such items against enumerations, constructing default attributes or elements whose declared type definition is·xs:anySimpleType
· or·xs:anyAtomicType
·, checking identity constraints involving such items.
[XML Schema: Datatypes]provides mechanisms for defining new simple type definitionsby·restricting·some primitive or ordinary datatype. It alsoprovides mechanisms for constructing new simple typedefinitions whose members are lists of items themselves constrained by some other simple type definition, or whose membership is the union of the memberships of some other simple type definitions. Such list and union simple type definitions are also·restrictions· of·xs:anySimpleType
·.
For detailed information on simple type definitions, seeSimple Type Definitions (§3.16) and[XML Schema: Datatypes]. The latter also defines an extensive inventory of pre-defined simple types.
A complex type definition is a set of attribute declarations and a content type, applicable to the[attributes] and[children] of an element information item respectively. The content typemay require the[children] to contain neither element nor character information items (that is, to be empty), or 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.
xs:anyType
· is eitherall
-groups in ways that do not guarantee that the new material occurs only at the end of the content. Another special case is extension viaOpen Contents ininterleave mode.For detailed information on complex type definitions, seeComplex Type Definitions (§3.4).
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.
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 identity-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 identity-constraint definition·validation·.
For detailed information on element declarations, seeElement Declarations (§3.3).For an overview of identity constraints, seeIdentity-constraint Definition (§2.2.4.1).
[Definition:] Through the mechanism ofelement substitutiongroups, XSD provides a more powerful model than DTDs dosupporting substitution of one named element foranother. Any top-level element declaration can serve as the defining member, or head, for an element·substitution group·. Other top-level element declarations, regardless of target namespace, can be designated as members of the·substitution group· headed by this element. In a suitably enabled content model, a reference to the head·validates· not just the head itself, but elements corresponding to any other member of the·substitution group· as well.
All such membersmust have type definitions which are either the same as the head's type definition or derived from 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 constrained by 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 (seeElement Declarations (§3.3)).
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, seeAttribute Declarations (§3.2).
A notation declaration is an association between a name and an identifier for a notation. For an attribute or element information item to be·valid· with respect to aNOTATION
simple type definition, its valuemust have been declared with a notation declaration.
For detailed information on notation declarations, seeNotation Declarations (§3.14).
The model group, particle, and wildcard components contribute to the portion of a complex type definition that controls an element information item's content.
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:
Each model group denotes a set of sequences of element information items. Regarding that set of sequences as a language, the set of sequences recognized by a groupG may be writtenL(G).[Definition:] A model groupG is said toacceptorrecognize the members ofL(G).
For detailed information on model groups, seeModel Groups (§3.8).
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.
The name[Definition:] Term is used to refer to any of the three kinds ofcomponents which can appear in particles. All·Terms· are themselves·Annotated Components·.[Definition:] Abasic term is anElement Declaration or aWildcard.[Definition:] Abasic particle is aParticle whose{term} is a·basic term·.
Each content model, indeed each particle and each term, denotes a set of sequences of element information items. Regarding that set of sequences as a language, the set of sequences recognized by a particleP may be writtenL(P).[Definition:] A particleP is said toaccept orrecognize the members ofL(P). Similarly, a termTaccepts orrecognizes the members ofL(T).
If a sequenceS is a member ofL(P), then it is necessarily possible to trace a path through the·basic particles· withinP, with each item withinS corresponding to a matching particle withinP. The sequence of particles withinP corresponding toS is called the·path· ofS inP.
For detailed information on particles, seeParticles (§3.9).
An attribute use plays a role similar to that of a particle, but for attribute declarations: an attribute declaration used by 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.
A wildcard is a special kind of particle which matches element and attribute information items dependent on their namespace names and optionally on their local names.
For detailed information on wildcards, seeWildcards (§3.10).
This section describes constructs which use[XPath 2.0] expressions to constrain the input document; using them, certain rules can be expressed conveniently which would be inconvenient or impossible to express otherwise. Identity-constraint definitions are associated with element declarations; assertions are associated with type definitions; conditional type assignment using type alternatives allows the type of an element instance to be chosen based on properties of the element instance (in particular, based on the values of its attributes).
An identity-constraint definition is an association between a name and one of several varieties of identity-constraint related to uniqueness and reference. All the varieties use[XPath 2.0] 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 identity-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 identity-constraint definitions, seeIdentity-constraint Definitions (§3.11).
AType Alternative component(type alternative for short) associates a type definition with a predicate. Type alternatives are used in conditionaltype assignment, in which the choice of·governing type definition·for elements governed by a particular element declarationdepends on properties of the document instance. An elementdeclaration may have a{type table} which contains a sequence of type alternatives; the predicates on the alternativesare tested, and when a predicate is satisfied, the typedefinition paired with it is chosen as the element instance's·governing type definition·.
For detailed information on Type Alternatives, seeType Alternatives (§3.12).
An assertion is a predicate associated with a type, which is checked for each instance of the type. If an element or attribute information item fails to satisfy an assertion associated with a given type, then that information item is not locally·valid· with respect to that type.
For detailed information on Assertions, seeAssertions (§3.13).
Many rules that can be enforced by identity constraints and conditional type assignment can also be formulated in terms of assertions. That is, the various constructs have overlapping functionality. The three forms of constraint differ from each other in various ways which may affect the schema author's choice of formulation.
Most obviously, the·post-schema-validation infoset· will differ somewhat, depending on which form of constraint is chosen.
Less obviously, identity constraints are associated with element declarations, while assertions are associated with type definitions. If it is desired to enforce a particular property of uniqueness or referential integrity associated with a particular element declarationE, of typeT, the schema author may often choose either an identity constraint associated withE, or an assertion associated withT. One obvious difference is that elements substitutable forE are required to have types derived fromT, but are not required to enforce the identity constraints (or the nillability) ofE. If the constraint applicable toE should be enforced by elements substitutable forE, it is often most convenient to formulate the constraint as an assertion onT; conversely, if only some elements of typeT are intended to be subject to the constraint, or if elements substitutable forE need not enforce the constraint, then it will be more convenient to formulate the rule as an identity constraint onE.
Similar considerations sometimes apply to the choice between assertions and conditional type assignment.
Because identity constraints and conditional type assignment are simpler and less variable than assertions, it may be easier for software to exploit or optimize them. Assertions have greater expressive power, which means they are often convenient. The "rule of least power" applies here; it is often preferable to use a less expressive notation in preference to a more expressive one, when either will suffice. See[Rule of Least Power].
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.
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, seeModel Group Definitions (§3.7).
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, seeAttribute Group Definitions (§3.6).
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, seeAnnotations (§3.15).
The[XML 1.1] specification describes two kinds of constraints on XML documents:well-formedness andvalidity constraints. Informally, the well-formedness constraints are those imposed by the definition of XML itself (such as the rules for the use of the < and > characters and the rules for proper nesting of elements), while validity constraints are the further constraints on document structure provided by a particular DTD.
The preceding section focused on·validation·, that 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:
The last of these, schema information set contributions, are not as new as they might at first seem. XML validation augments the XML information set in similar ways, for example by providing values for attributes not present in instances, and by implicitly exploiting type information for normalization or access. (As an example of the latter case, consider the effect ofNMTOKENS
on attribute white space, and the semantics ofID
andIDREF
.) By including schema information set contributions, this specification makes explicit some features that XML leaves implicit.
Within the context of this specification, conformance can be claimed for schema documents, for schemas, and for processors.
If the schema document is invalid only in consequence of invalid descendants of<annotation> elements, processorsmay treat the schema document as valid. It is·implementation-defined· what effect, if any, invalid<annotation> elements have on the construction of schema components.
A schema conforms to this specification if and only if it consists of components which individually and collectively satisfy all the relevant constraints specified in this document, including but not limited to all the·Schema Component Constraints·.
This specification distinguishes several classes of conforming processors, which are defined in terms of the following concepts.
[Definition:] Avalidator (orinstance validator) is a processor which·validates· an XML instance document against a conforming schema and distinguishes between valid documents and others, for one or more of the definitions of validity (·root-validity·,·deep validity·, or·uniform validity·) defined below in sectionSchema-validity and documents (§2.5). Conforming validatorsmay additionally support other definitions of validity defined in terms of the·post-schema-validation infoset·.
[Definition:] Aschema-validity assessor (or justassessor) is a processor which performs full or partial·schema-validity assessment· of an XML instance document, element information item, or attribute information item, with reference to a conforming schema, and provides access to the entirety of the resulting·post-schema-validation infoset·. The means by which an·assessor· provides access to the·post-schema-validation infoset· is·implementation-defined·.
[Definition:] Ageneral-purpose processor is a·validator· or·assessor· which accepts schemas represented in the form of XML documents as described inLayer 2: Schema Documents, Namespaces and Composition (§4.2).
<include>
) (§4.2.3).[Definition:] A schema processor which is not a·general-purpose· processor is aspecial-purpose processor.
[Definition:] Web-aware processors are network-enabled processors which are not only·general-purpose· but which additionallymust be capable of accessing schema documents from the World Wide Web as described inRepresentation of Schemas on the World Wide Web (§2.8) andHow schema definitions are located on the Web (§4.3.2)..
Several important classes of processor can be defined in terms of the concepts just given:
A claim that a processor conforms to this specificationmust specify to which processor classes defined here the processor belongs.
SeeChecklist of implementation-defined features (§E.1) andTerminology for implementation-defined features (normative) (§C) for terminology and concepts which may be helpful in defining the behavior of conforming processors and/or claiming conformance to this specification.
As noted above, in general a document isvalid against a particular schema if it obeys the constraints imposed by that schema. Depending on the nature of the application and on the specific invariants to be enforced, different forms of validity may be appropriately required by an application, a specification, or other users of XSD. This section defines terminology for use in describing the requirements of applications or other technologies which use XSD schema to describe constraints on XML documents.
All the terms defined below require that the document's root element be·assessed· using either·element-driven validation· (when the intended root element of the schema is clearly specified ) or else·strict wildcard validation· (if several different root elements are acceptable).
As discussed inXSD Abstract Data Model (§2.2), most schema components (may) have·names·. If all such names were assigned from the same "pool", then it would be impossible to have, for example, a simple type definition and an element declaration both with the name "title" in a given·target namespace·.
Therefore[Definition:] this specification introduces the termsymbol space to denote a collection of names, each of which is unique with respect to the others. Within a given schema there are distinct symbol spaces for each kind of named definition and declaration component identified inXSD Abstract Data Model (§2.2), except that simple type definitions and complex type definitions share a symbol space. Within a given symbol space, namesmust be unique; as a consequence, eachexpanded name within a given symbol space uniquely identifies a single component. The sameexpanded namemay however appear in more than one symbol space without conflict. For example, assuming that the namespace prefixmy
is bound to some particular namespace, both a simple type definition and a top-level element declaration can bear the namemy:abc
without conflict or necessary relation between the two. But it is not possible for both a simple type definition and a complex type definition, or two distinct top-level element declarations, to share the namemy:abc
.
Locally scoped attribute and element declarations are special with regard to symbol spaces. Their names are not included in the global symbol spaces for attribute and element names; each complex type definition defines its own attribute symbol space, and elements local to a complex type definition are constrained byElement Declarations Consistent (§3.8.6.3), but not by means of symbol spaces. Their names are not regarded as being in any particular symbol space. 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.
XML Schema Definition Language: Structures defines several attributes for direct use in any XML documents. These attributes are in the schema instance namespace (http://www.w3.org/2001/XMLSchema-instance
) described inThe Schema Instance Namespace (xsi
) (§1.3.1.2) above. All schema processorsmust have appropriate attribute declarations for these attributes built in, seeAttribute Declaration for the 'type' attribute (§3.2.7.1),Attribute Declaration for the 'nil' attribute (§3.2.7.2),Attribute Declaration for the 'schemaLocation' attribute (§3.2.7.3) andAttribute Declaration for the 'noNamespaceSchemaLocation' attribute (§3.2.7.4).
xsi:type
", "xsi:nil
", etc. This is shorthand for "an attribute information item whose[namespace name] ishttp://www.w3.org/2001/XMLSchema-instance
and whose[local name] istype
" (ornil
, etc.).TheSimple Type Definition (§2.2.1.2) orComplex Type Definition (§2.2.1.3) used in·validation· of an element is usually determined by reference to the appropriate schema components. An element information item in an instancemay, however, explicitly assert its type using the attributexsi:type
. The value of this attribute is a·QName·; seeQName resolution (Instance) (§3.17.6.3) for the means by which the·QName· is associated with a type definition.
XML Schema Definition Language: Structures introduces a mechanism for signaling that an elementmust 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 can be·valid· without content if it has the attributexsi:nil
with the valuetrue
. An element so labeledmust be empty, but can carry attributes if permitted by the corresponding complex type.
Thexsi:schemaLocation
andxsi:noNamespaceSchemaLocation
attributes can be used in a document to provide hints as to the physical location of schema documents which can be used for·assessment·. SeeHow schema definitions are located on the Web (§4.3.2) for details on the use of these attributes.
xsi:schemaLocation
attribute typically appears in XML document instances being·validated·; it is distinct from theschemaLocation
attribute defined for some elements in schema documents (which is not always a hint but sometimes a firm directive).On the World Wide Web, schemas are conventionally represented as XML documents (preferably of MIME typeapplication/xml
ortext/xml
, but see clause1.1 ofInclusion Constraints and Semantics (§4.2.3)), conforming to the specifications inLayer 2: Schema Documents, Namespaces and Composition (§4.2). For more information on the representation and use of schema documents on the World Wide Web seeStandards for representation of schemas and retrieval of schema documents on the Web (§4.3.1) andHow schema definitions are located on the Web (§4.3.2).
Components are defined in terms of their properties, and each property in turn is defined by giving its range, that is the values itmay 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, decimal) and every labeled edge is a property. The graph isnot acyclic: multiple copies of components with the same name in the same·symbol space·must not exist, so in some cases re-entrant chains of properties will exist.
Component properties are simply named values. Most properties have either other components or literals (that is, strings or booleans or enumerated keywords) for values, but in a few cases, where more complex values are involved,[Definition:] a property value may itself be a collection of named values, which we call aproperty record.
[Definition:] Throughout this specification, the termabsent is used as a distinguished property value denoting absence. Again this should not be interpreted as constraining implementations, as for instance between using anull value for such properties or not representing them at all.[Definition:] A property value which is not·absent· ispresent.
Any property not defined as optional is always 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 might have an empty value unless this is explicitly ruled out: this isnot the same as·absent·. Any property value identified as a superset or subset of some set might 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 aslegal XML characters in[XML 1.1].
The principal purpose ofXML Schema Definition Language: Structures 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.[Definition:] A document in this form (i.e. a<schema> element information item) is aschema document. For the schema document as a whole, and its constituents, the sections below define correspondences between element information items (with declarations inSchema for Schema Documents (Structures) (normative) (§A) andDTD for Schemas (non-normative) (§I)) and schema components. The key element information items in the XML representation of a schema are in the XSD namespace, that is their[namespace name] ishttp://www.w3.org/2001/XMLSchema
. Although a common way of creating the XML Infosets which are or contain·schema documents· will be using an XML parser, this is not required: any mechanism which constructs conformant infosets as defined in[XML Infoset] is a possible starting point.
A recurrent pattern in the XML representation of schemas may also be mentioned here. In many cases, the same element name (e.g.element
orattribute
orattributeGroup
), serves both to define a particular schema component and to incorporate it by reference. In the first case thename
attribute is required, in the second theref
attribute is required. These two usages are mutually exclusive, and sometimes also depend on context.
The descriptions of the XML representation of components, and the·Schema Representation Constraints·, apply to schema documentsafter, not before, the·conditional-inclusion pre-processing· described inConditional inclusion (§4.2.2) and the·chameleon pre-processing· described inAssembling a schema for a single target namespace from multiple schema definition documents (<include>
) (§4.2.3).
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 expressed in theSchema for Schema Documents (Structures) (normative) (§A). Neither the correspondences described nor the XML Representation Constraints apply to elements in the Schema namespace which occur as descendants of<appinfo> or<documentation>.
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[attributes] of an element information item. Since schema documents are constrained by theSchema for Schema Documents (Structures) (normative) (§A), there is always a simple type definition associated with any such attribute information item.[Definition:] With reference to any string, interpreted as denotingan instance of a given datatype, the termactual value denotes the value to which thelexical mapping of that datatype maps the string.In the case of attributes in schema documents, the string used as the lexical representation is normally the·normalized value· of the attribute. The associated datatype is, unless otherwise specified, the one identified in the declaration of the attribute, in the schema for schema documents; in some cases (e.g. theenumeration facet, or fixed and default values for elements and attributes) the associated datatype will be a more specific one, as specified in the appropriate XML mapping rules. The·actual value· will often be a string, but can 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·assessed·.
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 will in some cases be violated if one or more references cannot be·resolved·. This specification addresses the matter of missing components in a uniform manner, described inMissing Sub-components (§5.3): no mention of handling missing components will be found in the individual component descriptions below.
Forward reference to named definitions and declarationsis 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·, it is possible that an appropriately-named component will have become available to discharge the reference: seeSchemas and Namespaces: Access and Composition (§4) for details.
Throughout this specification,[Definition:] theinitial value of someattribute information item is the value of the[normalizedvalue] property of that item. Similarly, theinitial value of an element information item is the string composed of, in order, the[character code] of each character information item in the[children] of thatelement information item.
The above definition means that comments and processing instructions,even in the midst of text, are ignored for most·validation· purposes.For the exception to this rule, see the discussion of comments and processing instructions inAssertion Satisfied (§3.13.4.1).
#x9
(tab),#xA
(line feed) and#xD
(carriage return) are replaced with#x20
(space).#x20
s are collapsed to a single#x20
, and initial and/or final#x20
s are deleted.When more than onepre-lexical facet applies, thewhiteSpace facet is applied first; the order in which·implementation-defined· facets are applied is·implementation-defined·.
If the simple type definition used in an item's·validation· is·xs:anySimpleType
·, then the·normalized value·must be determined as in thepreserve case above.
There are three alternative validation rules which help supply the necessary background for theabove:Attribute Locally Valid (§3.2.4.1) (clause3),Element Locally Valid (Type) (§3.3.4.4) (clause3.1.3) orElement Locally Valid (Complex Type) (§3.4.4.2) (clause1.2).
These three levels of normalization correspond to the processing mandatedin XML for element content, CDATA attribute content and tokenizedattributed content, respectively. SeeAttribute Value Normalization in[XML 1.1] for the precedent forreplace andcollapse for attributes. Extending this processing to element content is necessary to ensure consistent·validation· semantics for simple types, regardless of whether they are applied to attributes or elements. Performing it twice in the case of attributes whose[normalizedvalue] has already been subject to replacement or collapse on the basis ofinformation in a DTD is necessary to ensure consistent treatment of attributesregardless of the extent to which DTD-based information has been made use ofduring infoset construction.
Attribute declarations provide for:
<xs:attribute name="age" type="xs:positiveInteger" use="required"/>
The attribute declaration schema component has the following properties:
The{name} propertymust match the local part of the names of attributes being·validated·.
The value of each attribute validatedmust conform to the supplied{type definition}.
A·non-absent· value of the{target namespace} property provides for·validation· of namespace-qualified attribute information items (whichmust be explicitly prefixed in the character-level form of XML documents).·Absent· values of{target namespace}·validate· unqualified (unprefixed) items.
For an attribute declarationA, ifA.{scope}.{variety} =global, thenA is available for use throughout the schema. IfA.{scope}.{variety} =local, thenA is available for use only within (theComplex Type Definition orAttribute Group Definition)A.{scope}.{parent}.
The{value constraint} property reproduces the functions of XML default and#FIXED
attribute values. A{variety} ofdefault specifies that the attribute is to appear unconditionally in the·post-schema-validation infoset·, with{value} and{lexical form} used whenever the attribute is not actually present;fixed indicates that the attribute value if presentmust be equal or identical to{value}, and if absent receives{value} and{lexical form} as fordefault. Note that it isvalues that are checked, not strings, and that the test is for either equality or identity.
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
[XML Infoset] distinguishes attributes with names such asxmlns
orxmlns:xsl
fromordinary attributes, identifying them as[namespace attributes]. Accordingly, it is unnecessary and in fact not possible forschemas to contain attribute declarations corresponding to suchnamespace declarations, seexmlns
Not Allowed (§3.2.6.3). No means is provided inthis specification to supply adefault value for a namespace declaration.
The XML representation for an attribute declaration schemacomponent is an<attribute> element information item. It specifies asimple type definition for an attribute either by reference orexplicitly, andmay provide default information. Thecorrespondences between the properties of the information item after the appropriate·pre-processing·and theproperties of the component are given in this section.
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, thetype
attribute is used when the declaration can use a built-in or pre-declared simple type definition. Otherwise an anonymous<simpleType> is provided inline. When no simple type definition is referenced or provided, the default is·xs:anySimpleType
·, which imposes no constraints at all.
attribute
Element Information ItemAn<attribute> element maps to an attribute declaration, and allows the type definition of that declaration to be specified either by reference or by explicit inclusion.
Top-level<attribute> elements (i.e. those which appear within the schema document as children of<schema> elements) produceglobal attribute declarations;<attribute>s within<attributeGroup> or<complexType> produce either attribute uses which containglobal attribute declarations (if there's aref
attribute) or local declarations (otherwise). For complete declarations, top-level or local, thetype
attribute is used when the declaration can use a built-in or user-defined global type definition. Otherwise an anonymous<simpleType> is provided inline.
<override>
) (§4.2.5) for details.Attribute information items·validated· by a top-level declarationmust be qualified with the{target namespace} of that declaration. If the{target namespace} is·absent·, the itemmust be unqualified. Control over whether attribute information items·validated· by a local declarationmust be similarly qualified or not is provided by theform
[attribute], whose default is provided by theattributeFormDefault
[attribute] on the enclosing<schema>, via its determination of{target namespace}.
The names for top-level attribute declarations are in their own·symbol space·. The names of locally-scoped attribute declarations reside in symbol spaces local to the type definition which contains them.
ref
[attribute] is absent, and theuse
[attribute] is not"prohibited"
, then it maps both to anAttribute Declaration and to anAttribute Use component, as described inMapping Rules for Local Attribute Declarations (§3.2.2.2).ref
[attribute] is·present·, and theuse
[attribute] is not"prohibited"
, then it maps to anAttribute Use component, as described inMapping Rules for References to Top-level Attribute Declarations (§3.2.2.3).use='prohibited'
, then it does not map to, or correspond to, any schema component at all.use
attribute is not allowed on top-level<attribute> elements, so this can only happen with<attribute> elements appearing within a<complexType> or<attributeGroup> element.If the<attribute> element information item has<schema> as its parent, the corresponding schema component is as follows:
targetNamespace
[attribute] of the parent<schema> element information item, or·absent· if there is none.type
[attribute], if present, otherwise·xs:anySimpleType
·.default
or afixed
[attribute],then aValue Constraint as follows, otherwise·absent·.If the<attribute> element information item has<complexType> or<attributeGroup> as an ancestor and theref
[attribute] is absent, it maps both to an attribute declaration (seebelow) and to an attribute use with properties as follows (unlessuse='prohibited'
, in which case the item corresponds to nothing at all):
default
or afixed
[attribute],then aValue Constraint as follows, otherwise·absent·.The<attribute> element also maps to the{attribute declaration} of the attribute use, as follows:
targetNamespace
is present ,then its·actual value·.targetNamespace
is not present andone of the following is trueform
=qualified
form
is absent and the<schema> ancestor hasattributeFormDefault
=qualified
targetNamespace
[attribute] of the ancestor<schema> element information item, or·absent· if there is none.type
[attribute], if present, otherwise·xs:anySimpleType
·. If the<attribute> element information item has<complexType> or<attributeGroup> as an ancestor and theref
[attribute] is present, it maps to an attribute use with properties as follows (unlessuse='prohibited'
, in which case the item corresponds to nothing at all):
use
=required
, otherwisefalse.default
or afixed
[attribute],then aValue Constraint as follows, otherwise·absent·.inheritable
[attribute], if present, otherwise{attribute declaration}.{inheritable}.default
andfixed
must not both be present.default
anduse
are both present,use
must have the·actual value·optional
.ref
orname
is present, but not both.ref
is present, then all of<simpleType>,form
andtype
are absent.type
attribute and a<simpleType> child elementmust not both be present.fixed
anduse
are both present,use
must not have the·actual value·prohibited
.targetNamespace
attribute is present thenall of the followingmust be true:name
attribute is present.form
attribute is absent.targetNamespace
[attribute] or its·actual value· is different from the·actual value· oftargetNamespace
of<attribute>, thenall of the following are true:base
[attribute] of<restriction> does not·match· thename of·xs:anyType
·.Informally, an attribute in an XML instance is locally·valid· against an attribute declaration if and only if (a) the name of the attribute matches the name of the declaration, (b) after whitespace normalization its·normalized value· is locally valid against the type declared for the attribute, and (c) the attribute obeys any relevant value constraint. Additionally, forxsi:type
, it is required that the type named by the attribute be present in the schema. A logical prerequisite for checking the local validity of an attribute against an attribute declaration is that the attribute declaration itself and the type definition it identifies both be present in the schema.
Local validity of attributes is tested as part of schema-validity·assessment· of attributes (and of the elements on which they occur), and the result of the test is exposed in the[validity] property of the·post-schema-validation infoset·.
A more formal statement is given in the following constraint.
xsi:type
(Attribute Declaration for the 'type' attribute (§3.2.7.1)), thenA's·actual value··resolves· to a type definition.xsi:type
,xsi:nil
,xsi:schemaLocation
, orxsi:noNamespaceSchemaLocation
are always governed by their corresponding built-in declarations (seeBuilt-in Attribute Declarations (§3.2.7)).Schema-validity assessment of an attribute information item involves identifying its·governing attribute declaration· and checking its local validity against the declaration. If the·governing type definition· is not present in the schema, then assessment is necessarily incomplete.
[Definition:] Forattribute information items, there is no difference between assessment and strictassessment, so the attribute information item hasbeenstrictly assessedif and only if its schema-validity has been assessed.
See alsoAttribute Default Value (§3.4.5.1),Match Information (§3.4.5.2) andSchema Information (§3.17.5.1), which describeother information set contributions related to attribute information items.
All attribute declarations (seeAttribute Declarations (§3.2))must satisfy the following constraints.
xsi:
Not Allowedxsi:
Not Allowedhttp://www.w3.org/2001/XMLSchema-instance
(unless it is one of the four built-in declarations given in the next section).xsi:
attributes to specify default or fixed value constraints (e.g. in a component corresponding to a schema document construct of the form<xs:attribute ref="xsi:type" default="xs:integer"/>
), but the practice is not recommended; including such attribute uses will tend to mislead readers of the schema document, because the attribute uses would have no effect; seeElement Locally Valid (Complex Type) (§3.4.4.2) andAttribute Default Value (§3.4.5.1) for details.There are four attribute declarations present in everyschema by definition:
xsi:type
Thexsi:type
attribute is used to signal use of a type other than the declared type of an element. Seexsi:type (§2.7.1).
xsi:nil
Thexsi:nil
attribute is used to signal that an element's content is "nil" (or "null"). Seexsi:nil (§2.7.2).
xsi:schemaLocation
Thexsi:schemaLocation
attribute is used to signal possible locations of relevant schema documents. Seexsi:schemaLocation, xsi:noNamespaceSchemaLocation (§2.7.3).
schemaLocation
http://www.w3.org/2001/XMLSchema-instance
http://www.w3.org/2001/XMLSchema-instance
xs:anySimpleType
·xsi:noNamespaceSchemaLocation
Thexsi:noNamespaceSchemaLocation
attribute is used to signal possible locations of relevant schema documents. Seexsi:schemaLocation, xsi:noNamespaceSchemaLocation (§2.7.3).
noNamespaceSchemaLocation
http://www.w3.org/2001/XMLSchema-instance
Element declarations provide for:
<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>
The element declaration schema component has the following properties:
The{name} propertymust match the local part of the names of element information items being·validated·.
For an element declarationE, ifE.{scope}.{variety} =global, thenE is available for use throughout the schema. IfE.{scope}.{variety} =local, thenE is available for use only within (theComplex Type Definition orModel Group Definition)E.{scope}.{parent}.
A·non-absent· value of the{target namespace} property provides for·validation· of namespace-qualified element information items.·Absent· values of{target namespace}·validate· unqualified items.
An element information item is normally required to satisfy the{type definition}. For such an item, schema information set contributions appropriate to the{type definition} are added to the corresponding element information item in the·post-schema-validation infoset·. The type definition against which an element information item is validated (its·governing type definition·) can be different from the declared{type definition}. The{type table} property of anElement Declaration, which governs conditional type assignment, andthexsi:type
attribute of an element information item (seexsi:type (§2.7.1)) can cause the·governing type definition· and thedeclared{type definition} to be different.
If{nillable} istrue, then an element with no text or element content can be·valid· despite a{type definition} which would otherwise require content, if it carries the attributexsi:nil
with the valuetrue
(seexsi:nil (§2.7.2)). Formal details of element·validation· are described inElement Locally Valid (Element) (§3.3.4.3).
xsi:nil
=true.{value constraint} establishes a default or fixed value for an element. If a{value constraint} with{variety} =default is present, and if the element being·validated· is empty, then forpurposes of calculating the[schema normalized value]and other contributions to the·post-schema-validation infoset· the element is treated as if{value constraint}.{lexical form} was used as the content of the element. Iffixed is specified, then the element's contentmust either be empty, in which casefixed behaves asdefault, or its valuemust be equal or identical to{value constraint}.{value}.
{identity-constraint definitions} express constraints establishing uniquenesses and reference relationships among the values of related elements and attributes. SeeIdentity-constraint Definitions (§3.11).
The{substitution group affiliations} property of an element declaration indicates which·substitution groups·, if any, it can potentially be a member of. Potential membership is transitive but not symmetric; an element declaration is a potential member of any group named in its{substitution group affiliations}, and also of any group of which any entry in its{substitution group affiliations} is a potential member. Actual membershipmay be blocked by the effects of{substitution group exclusions} or{disallowed substitutions}, see below.
An empty{substitution group exclusions} allows a declaration to be named in the{substitution group affiliations} of other element declarations having the same declared{type definition} or some type·derived· therefrom. The explicit values of{substitution group exclusions},extension orrestriction, rule out element declarations having types whose derivation from{type definition} involves anyextension steps, orrestriction steps, respectively.
The supplied values for{disallowed substitutions} determine whether an element declaration appearing in a·content model· will be prevented from additionally·validating· elements (a) with anxsi:type (§2.7.1) that identifies anextension orrestriction 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{disallowed substitutions} is empty, then all·derived· types and·substitution group· members are allowed.
Element declarations for which{abstract} istrue can appear in content models only when substitution is allowed; such declarationsmust not themselves ever be used to·validate· element content.
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
The XML representation for an element declaration schema component is an<element> element information item. It specifies a type definition for an element either by reference or explicitly, andmay provide occurrence and default information. The correspondences between the properties of the information item after the appropriate·pre-processing· and the properties of the component(s) it corresponds to are given in this section.
element
Element Information ItemAn<element> elementinformation item in a schema document maps to an element declaration and allows thetype definition of that declaration to be specified either byreference or by explicit inclusion.
Top-level<element>elements (i.e. those which appear withinthe schema document as children of<schema> elements) produceglobal element declarations;<element>s within<group> or<complexType> produce either particles which containglobal element declarations (if there's aref
attribute) or local declarations (otherwise). For complete declarations, top-level or local, thetype
attribute is used when the declaration can use abuilt-in or user-defined global type definition. Otherwise ananonymous<simpleType> or<complexType> is provided inline.
<override>
) (§4.2.5) for details.Element information items·validated· by a top-level declarationmust be qualified with the{target namespace} of that declaration.If the{target namespace} is·absent·,the itemmust be unqualified.Control over whether element information items·validated· by a local declarationmust be similarly qualified or notis provided by theform
[attribute], whose default is providedby theelementFormDefault
[attribute] on the enclosing<schema>, via its determination of{target namespace}.
The names for top-level element declarations are in a separate·symbol space· from the symbol spaces forthe names of type definitions, so there can (but neednot be) a simple or complex type definition with the same name as atop-level element. The names of locally-scopedelement declarations need not be unique and thus reside in no symbol space at all (but the element declarations areconstrained byElement Declarations Consistent (§3.8.6.3)).
Note that the above allows for two levels of defaulting for unspecifiedtype definitions. An<element> with no referenced or included type definition willcorrespond to an element declaration which hasthe same type definition as the first substitution-group head named in thesubstitutionGroup
[attribute], if present,otherwise·xs:anyType
·. This has the important consequence that the minimum valid element declaration, that is, one with only aname
attribute and no contents, is also (nearly) the most general, validating any combination of text and element content and allowing any attributes, and providing for recursive validation where possible.
SeeXML Representation of Identity-constraint Definition Schema Components (§3.11.2) for<key>,<unique> and<keyref>.
ref
[attribute] is absent, and it does not haveminOccurs=maxOccurs=0
, then it maps both to aParticle, as described inMapping Rules for Local Element Declarations (§3.3.2.3), and also to anElement Declaration, using the mappings described inCommon Mapping Rules for Element Declarations (§3.3.2.1) andMapping Rules for Local Element Declarations (§3.3.2.3).ref
[attribute] is present, and it does not haveminOccurs=maxOccurs=0
, then it maps to aParticle as described inReferences to Top-Level Element Declarations (§3.3.2.4).minOccurs=maxOccurs=0
, then it maps to no component at all.minOccurs
andmaxOccurs
attributes are not allowed on top-level<element> elements, so in valid schema documents this will happen only when the<element> element information item has<complexType> or<group> as an ancestor.The following mapping rules apply in all cases where an<element> element maps to anElement Declaration component.
type
[attribute], if it is present.substitutionGroup
[attribute], if present.test
[attribute].test
[attribute], the final<alternative> maps to the{default type definition}; if it does have atest
attribute, it is covered by the rule for{alternatives} and the{default type definition} is taken from the declared type of theElement Declaration. So the value of the{default type definition} is given by the appropriatecase among the following:test
) aType Alternative with the following properties:default
or afixed
[attribute], then aValue Constraint as follows, otherwise·absent·.[Definition:] Use the nameeffective simple type definition for the declared{type definition}, if it is a simple type definition, or, if{type definition}.{content type}.{variety} =simple, for{type definition}.{content type}.{simple type definition}, or else for the built-instring simple type definition).substitutionGroup
[attribute], if present,otherwise the empty set.block
[attribute], if present, otherwise on the·actual value· of theblockDefault
[attribute] of the ancestor<schema> element information item, if present,otherwise on the empty string. Call this theEBV (for effective block value). Then thevalue of this property isthe appropriatecase among the following:#all
,then{
extension,restriction,substitution}
;blockDefault
[attribute] of<schema>may include values other thanextension,restriction orsubstitution, those values are ignored in the determination of{disallowed substitutions} for element declarations (theyare used elsewhere).final
andfinalDefault
[attributes] in place of theblock
andblockDefault
[attributes] and with the relevantset being{
extension,restriction}
.ref
[attribute], as defined inXML Representation of Annotation Schema Components (§3.15.2).If the<element> element information item has<schema> as its parent, itmaps to aglobalElement Declaration, using the mapping giveninCommon Mapping Rules for Element Declarations (§3.3.2.1),supplemented by the following.
targetNamespace
[attribute] of the parent<schema> element information item, or·absent· if there is none. If the<element> element information item has<complexType> or<group> as an ancestor, and theref
[attribute] is absent, and it does not haveminOccurs=maxOccurs=0
, then it maps both to aParticle and to a localElement Declaration which is the{term}of thatParticle. TheParticleis as follows:
maxOccurs
[attribute] equalsunbounded, otherwise the·actual value· of themaxOccurs
[attribute], if present, otherwise1
.The<element> element also maps to an element declaration using themapping rules given inCommon Mapping Rules for Element Declarations (§3.3.2.1), supplemented by thosebelow:
targetNamespace
is present ,then its·actual value·.targetNamespace
is not present andone of the following is trueform
=qualified
form
is absent and the<schema> ancestor haselementFormDefault
=qualified
targetNamespace
[attribute] of the ancestor<schema> element information item, or·absent· if there is none. If the<element> element information item has<complexType> or<group> as an ancestor, and theref
[attribute] is present, and it does not haveminOccurs=maxOccurs=0
, then it maps toaParticle as follows.
maxOccurs
[attribute] equalsunbounded, otherwise the·actual value· of themaxOccurs
[attribute], if present, otherwise1
.<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>
xs:anyType
·.The second uses an embedded anonymous complextype definition.myLocalElement
withincontextOne
will be constrained bymyFirstType
,while those withincontextTwo
will be constrained bymySecondType
.<xs:complexType name="facet"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:attribute name="value" use="required"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="facet" type="xs:facet" abstract="true"/> <xs:element name="encoding" substitutionGroup="xs:facet"> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:facet"> <xs:sequence> <xs:element ref="annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="value" type="xs:encodings"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="period" substitutionGroup="xs:facet"> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:facet"> <xs:sequence> <xs:element ref="annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="value" type="xs:duration"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element> <xs:complexType name="datatype"> <xs:sequence> <xs:element ref="facet" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="name" type="xs:NCName" use="optional"/> . . . </xs:complexType>
facet
type is definedand thefacet
element is declared to use it. Thefacet
element is abstract -- it'sonly defined to stand as the head for a·substitution group·. Two furtherelements are declared, each a member of thefacet
·substitution group·. Finally a type is defined which refers tofacet
, therebyallowingeitherperiod
orencoding
(orany other member of the group).message
element will beassigned either to typemessageType
or to a morespecific type derived from it.messageType
accepts any well-formed XMLor character sequence as content, and carries akind
attribute which can be used to describe the kind or format of the message. The value ofkind
is either one of a few well known keywords or, failing that, any string.<xs:complexType name="messageType" mixed="true"> <xs:sequence> <xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="kind"> <xs:simpleType> <xs:union> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="string"/> <xs:enumeration value="base64"/> <xs:enumeration value="binary"/> <xs:enumeration value="xml"/> <xs:enumeration value="XML"/> </xs:restriction> </xs:simpleType> <xs:simpleType> <xs:restriction base="xs:string"/> </xs:simpleType> </xs:union> </xs:simpleType> </xs:attribute> <xs:anyAttribute processContents="skip"/></xs:complexType>
messageType
are defined, eachcorresponding to one of the three well-known formats:messageTypeString
forkind="string"
,messageTypeBase64
forkind="base64"
andkind="binary"
, andmessageTypeXML
forkind="xml"
orkind="XML"
.<xs:complexType name="messageTypeString"> <xs:simpleContent> <xs:restriction base="messageType"> <xs:simpleType> <xs:restriction base="xs:string"/> </xs:simpleType> </xs:restriction> </xs:simpleContent></xs:complexType><xs:complexType name="messageTypeBase64"> <xs:simpleContent> <xs:restriction base="messageType"> <xs:simpleType> <xs:restriction base="xs:base64Binary"/> </xs:simpleType> </xs:restriction> </xs:simpleContent></xs:complexType><xs:complexType name="messageTypeXML"> <xs:complexContent> <xs:restriction base="messageType"> <xs:sequence> <xs:any processContents="strict"/> </xs:sequence> </xs:restriction> </xs:complexContent></xs:complexType>
message
element itself usesmessageType
both as its declared type andas its default type, and usestest
attributes on its<alternative>[children] to assign the appropriatespecialized message type to messages with the well knownvalues for thekind
attribute.Because the declared type and the default type are the same, the last<alternative> (without thetest
attribute)can be omitted.<xs:element name="message" type="messageType"> <xs:alternative test="@kind='string'" type="messageTypeString"/> <xs:alternative test="@kind='base64'" type="messageTypeBase64"/> <xs:alternative test="@kind='binary'" type="messageTypeBase64"/> <xs:alternative test="@kind='xml'" type="messageTypeXML"/> <xs:alternative test="@kind='XML'" type="messageTypeXML"/> <xs:alternative type="messageType"/></xs:element>
default
andfixed
are notboth present.ref
orname
is present, but not both.ref
is present, thenno unqualified attributes are present other thanminOccurs
,maxOccurs
, andid
, and no children in the Schema namespace (xs
) other than<annotation>.type
attribute.targetNamespace
is present thenall of the following are true:name
is present.form
is not present.targetNamespace
[attribute] or its·actual value· is different from the·actual value· oftargetNamespace
of<element>, thenall of the following are true:base
[attribute] of<restriction> does not·match· thename of·xs:anyType
·.test
[attribute]; the last<alternative> elementmay have such an[attribute].When an element is·assessed·, it is first checked against its·governing element declaration·, if any; this in turn entails checking it against its·governing type definition·. The second step is recursive: the element's[attributes] and[children] are·assessed· in turn with respect to the declarations assigned to them by their parent's·governing type definition·.
The·governing type definition· of an element is normally the declared{type definition} associated with the·governing element declaration·, but this may be·overridden· using conditional type assignment in theElement Declaration or using an·instance-specified type definition·, or both. When the element is declared withconditional type assignment, the·selected type definition· is used as the·governing type definition· unless·overridden· by an·instance-specified type definition·.
xs:error
·.[Definition:] If the set of keywords controlling whether a typeS is·validly substitutable· for another typeT is the empty set, thenS is said to bevalidlysubstitutable forTwithout limitation orabsolutely. The phrasevalidlysubstitutable, without mention of any set of blocking keywords, means "validly substitutable withoutlimitation".
Sometimes one typeS is·validly substitutable· for another typeT only ifS is derived fromT by a chain of restrictions, or ifT is a union type andS a member type of the union. The concept of·valid substitutability· is appealed to often enough in such contexts that it is convenient to define a term to cover this specific case.[Definition:] A type definitionS isvalidlysubstitutable as a restriction for another typeT if and only ifS is·validly substitutable· forT, subject to the blocking keywords {extension,list,union}.
The concept of local validity of an element information item against an element declaration is an important part of the schema-validity·assessment· of elements. (The other important part is the recursive·assessment· of attributes and descendant elements.) Local validity partially determines the element information item's[validity] property, and fully determines the[local element validity] property, in the·post-schema-validation infoset·.
xsi:nil
attribute on the element obeys the rules. The element is allowed to have anxsi:nil
attribute only if the element is declared nillable, andxsi:nil = 'true'
is allowed only if the element itself is empty. If the element declaration specifies a fixed value for the element,xsi:nil='true'
will make the element invalid.xsi:type
attribute present names a type which is·validly substitutable· for the element's declared{type definition}.The following validation rule gives the normative formal definition of local validity of an element against an element declaration.
xsi:nil
attribute.xsi:nil
attribute information item.xsi:nil
=false
.xsi:nil
=true
(that is,E is·nilled·), andall of the following are true:xsi:type
attribute, the type definition indicated by that attribute normally takes precedence over the·selected type definition· which would otherwise govern the element. If anxsi:type
attribute is present and·resolves· to a known type definition, but fails to·override· the·selected type definition·, thenE is not locally valid againstD, sinceE has failed to satisfy clause4. In this case (or ifxsi:type
fails to·resolve·), the·governing type definition· of the element is the·selected type definition· of its·governing element declaration·, and the element is validated against that type as described in clause5. The local validity of the element with respect to the·governing type definition· is recorded in the[local type validity] property. The use of the·selected type definition· when the·instance-specified type definition· cannot be used allows useful validation to proceed in some cases (not all) even when the schema is incomplete. It also helps ensure consistent typing for sub-elements with the same name.The following validation rule specifies formally what it means for an element to be locally valid against a type definition. This concept is appealed to in the course of checking an element's local validity against its·governing type definition·. It is also part of schema-validity·assessment· of an element when the element is·laxly assessed·, by checking its local validity againstxs:anyType
.
Informally, local validity against a type requires first that the type definition be present in the schema and not declared abstract. For a simple type definition, the element must lack attributes (except for namespace declarations and the special attributes in thexsi
namespace) and child elements, and must be type-valid against that simple type definition. For a complex type definition, the element must be locally valid against that complex type definition.
xsi:type
,xsi:nil
,xsi:schemaLocation
, orxsi:noNamespaceSchemaLocation
.The following validation rule specifies document-level ID/IDREF constraints checked on the·validation root· if it is an element; this rule is not checked on other elements. Informally, the requirement is that each ID identifies a single element within the·validation root·, and that each IDREF value matches one ID.
xs:ID
providesa unique identifier for the element's parent element, it is not usefulto have an element governed byxs:ID
when the elementhas no parent element or when the parent element lies outside thescope of validation.DOC
andY
are governed by type·xs:anyType
·,the elementX
and the attributexml:id
are governed byxs:ID
, and the elementZ
is governed by a complex type with simple content derived fromxs:ID
.<DOC><X>abcd</X></DOC>
,the ID value 'abcd
' will normally be bound totheDOC
element. But if theX
element is the validation root, then 'abcd
'will have no element binding, becauseDOC
is outside the scope of the validation episode.So the first clause is violated and the document is invalid.<DOC><Y xml:id="abcd"/></DOC>
will, in contrast, be valid whether theDOC
elementor theY
element is the validation root. TheID/IDREF table will have one entry in either case, binding'abcd
' to theY
element.<DOC><Zxml:id="abcd">abcd</Z></DOC>
,ifZ
is the validation root, then the ID/IDREF table for the documentwill have a single entry for 'abcd
' and will be valid. The single binding comes from thexml:id
attribute; the content ofZ
produces no binding, just as the content ofX
above produces no binding.DOC
is thevalidation root, then the ID/IDREF table for the document willhave two entries for 'abcd
' (one, from thexml:id
attribute, binding 'abcd
' totheZ
element, one from the content ofZ
binding 'abcd
' to theDOC
element) andwill be invalid.ID/IDREF
functionality is imperfect in that ifthe·validation root· is not the document element of an XMLdocument, the results will not necessarily be the same asthose a validating parser would give were the document to havea DTD with equivalent declarations.xsi:type
attribute), otherwise the element will be·laxly assessed·.xs:anyType
·.xs:anyType
· as defined inElement Locally Valid (Type) (§3.3.4.4), and the schema-validity ofE's[attributes] and[children] is assessed as described in clause2 and clause3 ofSchema-Validity Assessment (Element) (§3.3.4.6).xsi:type
attribute which fails to·resolve· to a type definition that·overrides· the declared{type definition}xsi:type
attribute which fails to·resolve· to a type definition that·overrides· the·selected type definition·xs:anyType
·xs:anyType
·.See alsoMatch Information (§3.4.5.2),Identity-constraint Table (§3.11.5),Validated with Notation (§3.14.5), andSchema Information (§3.17.5.1), which describe other information set contributions related to element information items.
All element declarations (seeElement Declarations (§3.3))must satisfy the following constraint.
xs:error
·.This and the following sections define relations appealed to elsewhere in this specification.
[Definition:] One element declaration is substitutable for another if together they satisfy constraintSubstitution Group OK (Transitive) (§3.3.6.3).
[Definition:] Every element declaration (call thisHEAD) in the{element declarations} of a schema defines asubstitutiongroup, a subset of those{element declarations}. An element declaration is in thesubstitution group ofHEAD if and only if it is·substitutable· forHEAD.
Complex Type Definitions provide for:
<xs:complexType name="PurchaseOrderType"> <xs:sequence> <xs:element name="shipTo" type="USAddress"/> <xs:element name="billTo" type="USAddress"/> <xs:element ref="comment" minOccurs="0"/> <xs:element name="items" type="Items"/> </xs:sequence> <xs:attribute name="orderDate" type="xs:date"/> </xs:complexType>
A complex type definition schema component has the followingproperties:
Either anElement Declaration or aComplex Type Definition.
Complex type definitions are identified by their{name} and{target namespace}. Exceptfor anonymous complex type definitions (those with no{name}), sincetype definitions (i.e. both simple and complex type definitions taken together)must be uniquely identified within an·XSD schema·, no complex type definition can have the same name as anothersimple or complex type definition. Complex type{name}s and{target namespace}sare provided for reference frominstances (seexsi:type (§2.7.1)), and for use in the XMLrepresentation of schema components(specifically in<element>). SeeReferences to schema components across namespaces (<import>
) (§4.2.6) for the use of componentidentifiers when importing one schema into another.
As described inType Definition Hierarchy (§2.2.1.1), each complex type is·derived· from a{base type definition} which is itself either aSimple Type Definition (§2.2.1.2) or aComplex Type Definition (§2.2.1.3).{derivation method} specifies the means of·derivation· as eitherextension orrestriction (seeType Definition Hierarchy (§2.2.1.1)).
A complex type with an empty specification for{final} can be used as a{base type definition} for other types·derived· by either ofextension or restriction; the explicit valuesextension, andrestriction prevent further·derivations· by extension and restriction respectively. If all values are specified, then[Definition:] the complex type is said to befinal, because nofurther·derivations· are possible. Finality isnotinherited, that is, a type definition·derived· by restriction from a typedefinition which is final for extension is not itself, in the absence of anyexplicitfinal
attribute of its own, final for anything.
The{context} property is only relevant for anonymous typedefinitions, for which its value is the component in which this typedefinition appears as the value of a property, e.g.{type definition}.
Complex types for which{abstract} istrue haveno valid instances and thus cannot be used in the normal way as the{type definition} for the·validation· of element information items (if for some reason an abstracttype is identified as the·governing type definition· of an elementinformation item, the item will invariably be invalid). Itfollows that suchabstract typesmust not be referenced from anxsi:type (§2.7.1) attribute in an instance document. Abstractcomplex types can be used as{base type definition}s, or even asthe declared{type definition}s of element declarations, provided in everycase a concrete·derived· type definition is used for·validation·, either viaxsi:type (§2.7.1) or the operation of a·substitution group·.
{attribute uses} are a set of attribute uses. SeeElement Locally Valid (Complex Type) (§3.4.4.2)andAttribute Locally Valid (§3.2.4.1) for details of attribute·validation·.
{attribute wildcard}s provide a more flexible specification for·validation· ofattributes not explicitly included in{attribute uses}.SeeElement Locally Valid (Complex Type) (§3.4.4.2),The Wildcard Schema Component (§3.10.1) andWildcard allows Expanded Name (§3.10.4.2) for formaldetails of attribute wildcard·validation·.
xsi:type
attribute; seexsi:type (§2.7.1);{assertions} constrain elements and attributesto exist, not to exist, or to have specified values.Though specified as a sequence, the orderamong the assertions is not significant during assessment.SeeAssertions (§3.13).
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
The XML representation for a complex type definition schema component is a<complexType> element information item.
The XML representation for complex type definitions with a{content type} with{variety}simple is significantly different from that of those with other{content type}s, and this is reflected in the presentation below, which describes the mappings for the two cases in separate subsections. Common mapping rules are factored out and given in separate sections. As always, the mapping rules given here apply after, not before, the appropriate·pre-processing·.
complexType
Element Information Item<complexType name="anyThing"/>
is allowed.Where convenient, the mapping rules are described exclusively in terms of the schema document's information set. The mappings, however, depend not only upon the source declaration but also upon the schema context. Some mappings, that is, depend on the properties of other components in the schema. In particular, several of the mapping rules given in the following sections depend upon the{base type definition} having been identified before they apply.
Whichever alternative for the content of<complexType> is chosen, the following property mappings apply.Except where otherwise specified, attributes and childelements are to be sought among the[attributes] and[children] of the<complexType> element.
targetNamespace
[attribute] of the<schema> ancestor element information item if present,otherwise·absent·.block
[attribute], if present, otherwise to the·actual value· of theblockDefault
[attribute] of the ancestor<schema> element information item, if present,otherwise on the empty string. Call this theEBV (for effective block value). Then thevalue of this property isthe appropriatecase among the following:#all
,then{
extension,restriction}
;blockDefault
[attribute] of<schema>may include values other thanrestriction orextension, those values are ignored in the determination of{prohibited substitutions} for complex type definitions (theyare used elsewhere).final
andfinalDefault
[attributes] in place of theblock
andblockDefault
[attributes].name
[attribute] is present, then·absent·, otherwise (among the ancestor element information items there will be a nearest<element>), theElement Declaration corresponding to the nearest<element> information item among the the ancestor element information items.When the<complexType>source declaration has a<simpleContent> child, the following elements are relevant (as are<attribute>,<attributeGroup>, and<anyAttribute>), and the property mappings are as below,supplemented by the mappings inCommon Mapping Rules for Complex Type Definitions (§3.4.2.1),Mapping Rule for Attribute Uses Property (§3.4.2.4),andMapping Rule for Attribute Wildcard Property (§3.4.2.5). Note that either<restriction> or<extension>must appear in the content of<simpleContent>.
simpleContent
Element Information Item et al.When the<complexType>element has a<simpleContent> child, then the<complexType> element maps to a complex type with simple content, as follows.
base
[attribute] on the<restriction> or<extension> element appearing as a child of<simpleContent>targetNamespace
[attribute] of the ancestor<schema> element information item if present, otherwise·absent·xs:anySimpleType
·) a simple type definition which restrictsSB with a set of facet components corresponding to the appropriate element information items among the<restriction>'s[children] (i.e. those which specify facets, if any), as defined inSimple Type Restriction (Facets) (§3.16.6.4);xs:anySimpleType
·), the result will be a simple type definition component which fails to obey the constraints on simple type definitions, including for example clause1.1 ofDerivation Valid (Restriction, Simple) (§3.16.6.2).xs:anySimpleType
·.When the<complexType>element does not have a<simpleContent> childelement, then it maps to a complex type with complexcontent. The following elements are relevant (as are the<attribute>,<attributeGroup>, and<anyAttribute> elements, which are described more fully inXML Representation of Attribute Declaration Schema Components (§3.2.2),Mapping Rule for Attribute Uses Property (§3.4.2.4), andXML Representation of Wildcard Schema Components (§3.10.2), respectively, and which are not repeated here), and the additional property mappings are as below, supplementedby the mappings inCommon Mapping Rules for Complex Type Definitions (§3.4.2.1),Mapping Rule for Attribute Uses Property (§3.4.2.4),Mapping Rule for Attribute Wildcard Property (§3.4.2.5),Mapping Rules for Local Attribute Declarations (§3.2.2.2), andMapping Rules for References to Top-level Attribute Declarations (§3.2.2.3). Note that either<restriction> or<extension>must appear in the content of<complexContent>, but their content models are different in this case from the case above when they occur as children of<simpleContent>.
complexContent
Element Information Item et al.Complex types with complex content can be the image of two different forms of<complexType> element: one with a<complexContent> child (discussed inMapping Rules for Complex Types with Explicit Complex Content (§3.4.2.3.1)), and one with neither<simpleContent> nor<complexContent> as a child (discussed inMapping Rules for Complex Types with Implicit Complex Content (§3.4.2.3.2)). The mapping of the{content type} is the same in both cases; it is described inMapping Rules for Content Type Property of Complex Content (§3.4.2.3.3).
When the<complexType>source declaration has a<complexContent>child, the following mappings apply, supplemented by thosespecified inMapping Rules for Content Type Property of Complex Content (§3.4.2.3.3),Common Mapping Rules for Complex Type Definitions (§3.4.2.1),Mapping Rule for Attribute Uses Property (§3.4.2.4), andMapping Rule for Attribute Wildcard Property (§3.4.2.5).
When the<complexType> source declarationhas neither<simpleContent> nor<complexContent> as a child, it is takenas shorthand for complex content restricting·xs:anyType
·. The mapping rules specific to thissituation are as follows; the mapping rules for propertiesnot described here are as given inMapping Rules for Content Type Property of Complex Content (§3.4.2.3.3),Common Mapping Rules for Complex Type Definitions (§3.4.2.1),Mapping Rule for Attribute Uses Property (§3.4.2.4), andMapping Rule for Attribute Wildcard Property (§3.4.2.5).
For complex types with complex content,the{content type} property iscalculated as follows. (For the{content type} on complex types with simple content,seeMapping Rules for Complex Types with Simple Content (§3.4.2.2).)
abc
attribute is present on thexyz
element", if noxyz
element information item is present, then noabc
attribute is present on the (non-existent)xyz
element.false
.minOccurs
[attribute] has the·actual value·0
and which has no[children] of its own except for<annotation>;maxOccurs
[attribute] with an·actual value· of 0;true
,thenA particle whose properties are as follows:true
, otherwiseelement-onlytrue
, otherwiseelement-onlyappliesToEmpty
=truemode
='none'
,thenthe·explicit content type·.Any<complexType> source declaration can have<attribute> and<attributeGroup> elements as children, or descendants. The<attribute> element is described inXML Representation of Attribute Declaration Schema Components (§3.2.2) and will not be repeated here.
attributeGroup
Element Information ItemThe<attribute> and<attributeGroup> elements map to the{attribute uses} property of theComplex Type Definition component as described below. This mapping rule is the same for all complex type definitions.
If the<schema> ancestor has adefaultAttributes
attribute, and the<complexType> element does not havedefaultAttributesApply
=false
, then the{attribute uses} property is computed as if there were an<attributeGroup>[child] with empty content and aref
[attribute] whose·actual value· is the same as that of thedefaultAttributes
[attribute] appearing after any other<attributeGroup>[children]. Otherwise proceed as if there were no such<attributeGroup>[child].
ref
[attribute] of the<attributeGroup>[children], if any.use
=prohibited.use
attribute of an<attribute> is inestablishing the correspondence between a complex type definedby restriction and its XML representation. It serves toprevent inheritance of an identically named attribute use fromthe{base type definition}. Such an<attribute> does not correspond to any component, andhence there is no interaction with either explicit orinherited wildcards in the operation ofComplex Type Definition Validation Rules (§3.4.4) orConstraints on Complex Type Definition Schema Components (§3.4.6).It is pointless, though not an error, for theuse
attribute to have the valueprohibited in other contexts (e.g. in complex type extensions or named model group definitions), in which cases the <attribute> element is simply ignored, provided that it does not violate other constraints in this specification.The{attribute wildcard} property of aComplex Type Definition depends on the<anyAttribute> element which may be present within the<complexType> element or within the attribute groups referred to within<complexType>. The<attributeGroup> element is described in the preceding sectionMapping Rule for Attribute Uses Property (§3.4.2.4) and will not be repeated here.
If the<schema> ancestor has adefaultAttributes
attribute, and the<complexType> element does not havedefaultAttributesApply
=false
, then the{attribute wildcard} property is computed as if there were an<attributeGroup>[child] with empty content and aref
[attribute] whose·actual value· is the same as that of thedefaultAttributes
[attribute] appearing after any other<attributeGroup>[children]. Otherwise proceed as if there were no such<attributeGroup>[child].
The following declaration defines a type for specifications of lengthby creating a complex type with simple content, withxs:nonNegativeInteger
as the type of the content, and aunit
attribute to give theunit of measurement.
<xs:complexType name="length1"> <xs:simpleContent> <xs:extension base="xs:nonNegativeInteger"> <xs:attribute name="unit" type="xs:NMTOKEN"/> </xs:extension> </xs:simpleContent></xs:complexType><xs:element name="width" type="length1"/>
An instance using this type might look like this:
<width unit="cm">25</width>
A second approach to defining lengthuses two elements, one for size and one for the unit of measure. The definition of the type and thedeclaration of the element might look like this:
<xs:complexType name="length2"> <xs:complexContent> <xs:restriction base="xs:anyType"> <xs:sequence> <xs:element name="size" type="xs:nonNegativeInteger"/> <xs:element name="unit" type="xs:NMTOKEN"/> </xs:sequence> </xs:restriction> </xs:complexContent></xs:complexType><xs:element name="depth" type="length2"/>
An instance using this method might look like this:
<depth> <size>25</size><unit>cm</unit> </depth>
A third definition of type leaves the base typeimplicit; at the component level, the following declarationis equivalent to the preceding one.
<xs:complexType name="length3"> <xs:sequence> <xs:element name="size" type="xs:nonNegativeInteger"/> <xs:element name="unit" type="xs:NMTOKEN"/> </xs:sequence></xs:complexType>
<xs:complexType name="personName"> <xs:sequence> <xs:element name="title" minOccurs="0"/> <xs:element name="forename" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="surname"/> </xs:sequence></xs:complexType><xs:complexType name="extendedName"> <xs:complexContent> <xs:extension base="personName"> <xs:sequence> <xs:element name="generation" minOccurs="0"/> </xs:sequence> </xs:extension> </xs:complexContent></xs:complexType><xs:element name="addressee" type="extendedName"/> <addressee> <forename>Albert</forename> <forename>Arnold</forename> <surname>Gore</surname> <generation>Jr</generation> </addressee>
<xs:complexType name="simpleName"> <xs:complexContent> <xs:restriction base="personName"> <xs:sequence> <xs:element name="forename" minOccurs="1" maxOccurs="1"/> <xs:element name="surname"/> </xs:sequence> </xs:restriction> </xs:complexContent></xs:complexType><xs:element name="who" type="simpleName"/> <who> <forename>Bill</forename> <surname>Clinton</surname> </who>
<xs:complexType name="paraType" mixed="true"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="emph"/> <xs:element ref="strong"/> </xs:choice> <xs:attribute name="version" type="xs:decimal"/></xs:complexType>
mixed
attribute appearing oncomplexType
itself.<xs:complexType name="name"> <xs:openContent> <xs:any namespace="##other" processContents="skip"/> </xs:openContent> <xs:sequence> <xs:element name="given" type="xs:string"/> <xs:element name="middle" type="xs:string" minOccurs="0"/> <xs:element name="family" type="xs:string"/> </xs:sequence></xs:complexType>
<xs:complexType name="computer"> <xs:all> <xs:element name="CPU" type="CPUType"/> <xs:element name="memory" type="memoryType"/> <xs:element name="monitor" type="monitorType"/> <xs:element name="speaker" type="speakerType" minOccurs="0"/> <!-- Any additional information about the computer --> <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </xs:all></xs:complexType><xs:complexType name="quietComputer"> <xs:complexContent> <xs:restriction base="computer"> <xs:all> <xs:element name="CPU" type="CPUType"/> <xs:element name="memory" type="memoryType"/> <xs:element name="monitor" type="monitorType"/> <!-- Any additional information about the computer --> <xs:any processContents="lax" notQName="speaker" minOccurs="0" maxOccurs="unbounded"/> </xs:all> </xs:restriction> </xs:complexContent></xs:complexType>
quietComputer
has alax wildcard, which·matches· any element but one with the namespeaker
.notQName
attribute, the wildcard would·match· elements namedspeaker
, as well. In that case, the restriction would be valid only if there is a top-level declaration forspeaker
that also has typespeakerType
or a type derived from it. Otherwise, there would be instances locally valid against the restrictionquietComputer
that are not locally valid against the base typecomputer
.notQName
attribute on the wildcard and no top-level declaration forspeaker
, then the following is allowed byquietComputer
, but not bycomputer
:<speaker xsi:type="xs:string"/>
mixed
=true.xs:enumeration
,xs:pattern
, orxs:assertion
may appear more than once among the[children] of<restriction>.mode
≠'none'
, then theremust be an<any> among the[children] of<openContent>.mode
='none'
, then theremust not be an<any> among the[children] of<openContent>.mixed
[attribute] is present on both<complexType> and<complexContent>, then·actual values· of those[attributes]must be the same.This section defines the concept of·locally declared type·; this concept plays a role in determining whether restrictions and extensions of complex type definitions are legitimate. The·locally declared type· is also used to help determine the·governing element declaration· and·governing type definition· of an element information item.
[Definition:] EveryComplex Type Definition determines a partial functional mapping fromelement or attributeinformation items (and theirexpanded names) to typedefinitions. This mapping serves as alocally declared type for elements and attributes which are allowed bytheComplex Type Definition.
The attribute case is simpler and will be taken first.
The definition for elements is slightlymore complex.
xsi:type
,xsi:nil
,xsi:schemaLocation
, orxsi:noNamespaceSchemaLocation
(seeBuilt-in Attribute Declarations (§3.2.7)), the appropriatecase among the following is true:xsi:type
and the other attributes named in clause2.1; no·attribution· is performed for them.[Definition:] A sequence of element information items islocally valid with respect to aContent Type if and only if it satisfiesElement Sequence Locally Valid (Complex Content) (§3.4.4.3) with respect to thatContent Type.
[Definition:] During·validation· of an element information item against its (complex)·governing type definition·, associations between element and attribute information items among the[children] and[attributes] on the one hand, and the attribute uses, attribute wildcard, particles and open content property record on the other, are established. The element or attribute information item isattributed to the corresponding component.
When an attribute information item has the sameexpanded name as the{attribute declaration} of anAttribute Use, then the item isattributed to that attribute use. Otherwise, if the item matches an attribute wildcard, as described inItem Valid (Wildcard) (§3.10.4.1), then the item isattributed to that wildcard. Otherwise the item isnotattributed to any component.
<xs:sequence> <xs:element name="a"/> <xs:element name="b"/> <xs:element name="c"/> </xs:sequence>and an input sequence
<a/><b/><d/>Then the element <a> is·attributed· to the particle whose term is the "a" element declaration. Similarly, <b> is·attributed· to the "b" particle.
[Definition:] During·validation·, associations between element and attribute information items among the[children] and[attributes] on the one hand, and element and attribute declarations on the other, are also established. When an item is·attributed· to an·element particle·, then it is associated with the declaration which is the{term} of the particle. Similarly, when an attribute information item is·attributed to· anAttribute Use, then the item is associated with the{attribute declaration} of thatAttribute Use. Such declarations are called thecontext-determined declarations. See clause2.1 (inElement Locally Valid (Complex Type) (§3.4.4.2)) for attribute declarations, clause2 (inElement Sequence Locally Valid (Particle) (§3.9.4.2)) for element declarations.
All complex type definitions (seeComplex Type Definitions (§3.4))must satisfy the following constraints.
xs:anyType
·. That is, it is possible to reach the definition of·xs:anyType
· by repeatedly following the{base type definition}.xs:anyType
·.[Definition:] A complex typeT is avalid extension of its{base type definition} if and only ifT.{derivation method} =extension andTsatisfies the constraintDerivation Valid (Extension) (§3.4.6.2).
xs:anyType
·.The constraint just given, like other constraints on schemas,must be satisfied by every complex typeT to which it applies.
However, under certain conditions conforming processors need not (although theymay) detect some violations of this constraint. If (1) the type definition being checked hasT .{content type} .{particle} .{term} .{compositor} =all and (2) an implementation is unable to determine by examination of the schema in isolation whether or not clause2.4.2 is satisfied, then the implementationmay provisionally accept the derivation. If any instance encountered in the·assessment· episode is valid againstT but not againstT.{base type definition}, then the derivation ofT does not satisfy this constraint, the schema does not conform to this specification, and no·assessment· can be performed using that schema.
It is·implementation-defined· whether a processor (a) always detects violations of clause2.4.2 by examination of the schema in isolation, (b) detects them only when some element information item in the input document is valid againstT but not againstT.{base type definition}, or (c) sometimes detects such violations by examination of the schema in isolation and sometimes not. In the latter case, the circumstances in which the processor does one or the other are·implementation-dependent·.
The following constraint defines a relation appealed to elsewherein this specification.
xs:anyType
·.xsi:type
or·substitution groups·), that the type used is actually·derived· from the expectedtype, and that that·derivation· does not involve a form of·derivation· which wasruled out by the expected type.There is a complextype definition for·xs:anyType
· present in every schemaby definition. It has the following properties:
The outer particle of·xs:anyType
· contains a sequence with a single term:
The inner particle of·xs:anyType
· contains a wildcard which matches any element:
rational
) and utility (e.g.array
) type definitions. In particular, there is atext
type definition which is recommended for useas the type definition in element declarations intended for general textcontent, as it makes sensible provision for various aspects ofinternationalization. For more details, see the schema document for the typelibrary at its namespace name:http://www.w3.org/2001/03/XMLSchema/TypeLibrary.xsd.An attribute use is a utility component which controls the occurrence anddefaulting behavior of attribute declarations. It plays the same role forattribute declarations in complex types that particles play for element declarations.
<xs:complexType> . . . <xs:attribute ref="xml:lang" use="required"/> <xs:attribute ref="xml:space" default="preserve"/> <xs:attribute name="version" type="xs:decimal" fixed="1.0"/></xs:complexType>
The attribute use schema component has the following properties:
{required} determines whether this use of an attributedeclaration requires an appropriate attribute information item to be present, ormerely allows it.
{attribute declaration} provides the attribute declaration itself,which will in turn determine the simple type definition used.
{value constraint} allows for local specification of a default or fixed value. Thismust be consistent with that of the{attribute declaration}, in that if the{attribute declaration} specifies a fixed value, the only allowed{value constraint} is the same fixed value, or a value equal or identical to it.
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
Attribute uses correspond to all uses of<attribute> whichallow ause
attribute. These in turn correspond totwo components in each case, an attribute use and its{attribute declaration} (although note the latter is not new when the attribute use is a reference to a top-level attribute declaration). The appropriate mapping is described inXML Representation of Attribute Declaration Schema Components (§3.2.2).
[Definition:] Theeffective value constraint of an attribute useU isU.{value constraint}, if present, otherwiseU.{attribute declaration}.{value constraint}, if present, otherwise theeffective value constraint is·absent·.
All attribute uses (seeAttribute Uses (§3.5))must satisfy the following constraints.
A schema can name a group of attribute declarations so that they can be incorporated as agroup into complex type definitions.
Attribute group definitions do not participate in·validation· as such, but the{attribute uses} and{attribute wildcard}of one ormore complex type definitionsmay be constructed in whole or part by referenceto an attribute group. Thus, attribute group definitions provide areplacement for some uses of XML'sparameter entity facility.Attribute group definitions are provided primarily for reference from the XMLrepresentation of schema components(see<complexType> and<attributeGroup>).
<xs:attributeGroup name="myAttrGroup"> <xs:attribute . . ./> . . .</xs:attributeGroup><xs:complexType name="myelement"> . . . <xs:attributeGroup ref="myAttrGroup"/></xs:complexType>
The example above illustrates the pattern mentioned inXML Representations of Components (§3.1.2): The same element, in this caseattributeGroup
, serves both to define and to incorporate by reference. In the firstattributeGroup
element in the example, thename
attribute is required and theref
attribute is forbidden; in the second theref
attribute is required, thename
attribute is forbidden.
The attribute group definition schema component has thefollowing properties:
Attribute groups are identified by their{name} and{target namespace}; attribute group identitiesmust be unique within an·XSD schema·. SeeReferences to schema components across namespaces (<import>
) (§4.2.6) for the use of componentidentifiers when importing one schema into another.
{attribute uses} is a set ofattribute uses, allowingfor local specification of occurrence and default or fixed values.
{attribute wildcard} provides for an attribute wildcard to be included in anattribute group.See above underComplex Type Definitions (§3.4) for theinterpretation ofattribute wildcards during·validation·.
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
The XML representation for an attribute group definition schema component is an<attributeGroup> element information item. It provides for naming a group of attribute declarations and an attribute wildcard for use by reference in the XML representation of complex type definitions and other attribute group definitions. The correspondences between the properties of the information item after the appropriate·pre-processing· and the properties of the component it corresponds to are given in this section.
attributeGroup
Element Information ItemWhen an<attributeGroup> appears as a child of<schema> or<redefine>, it corresponds to an attribute group definition as below. When it appears as a child of<complexType> or<attributeGroup>, it does not correspond to any component as such.
<override>
) (§4.2.5) for details.targetNamespace
[attribute] of the<schema> ancestor element information item if present, otherwise·absent·.ref
[attribute] of the<attributeGroup>[children], if any.The rules given above for{attribute uses} and{attribute wildcard} specify that if an<attributeGroup> elementA contains a reference to another attribute groupB (i.e.A's[children] include an<attributeGroup> with aref
attribute pointing atB), thenA maps to anAttribute Group Definition component whose{attribute uses} reflect not only the<attribute>[children] ofA but also those ofB and of any<attributeGroup> elements referred to inB. The same is true for attribute groups referred to from complex types.
Circular reference isnot disallowed. That is, it is not an error ifB, or some<attributeGroup> element referred to byB (directly, or indirectly at some remove) contains a reference toA. An<attributeGroup> element involved in such a reference cycle maps to a component whose{attribute uses} and{attribute wildcard} properties reflect all the<attribute> and<any> elements contained in, or referred to (directly or indirectly) by elements in the cycle.
All attribute group definitions (seeAttribute Group Definitions (§3.6))must satisfy the following constraint.
A model group definition associates a name and optional annotations with aModel Group.By reference to the name, the entire model group can be incorporated by reference into a{term}.
Model group definitions are providedprimarily for reference from theXML Representation of Complex Type Definition Schema Components (§3.4.2) (see<complexType>and<group>). Thus, model group definitions provide areplacement for some uses of XML'sparameter 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>
The model group definition schema component has the followingproperties:
Model group definitions are identified by their{name} and{target namespace}; model group identitiesmust be unique within an·XSD schema·. SeeReferences to schema components across namespaces (<import>
) (§4.2.6) for the use of componentidentifiers when importing one schema into another.
Model group definitionsper se do not participate in·validation·, but the{term} ofa particlemay correspond in whole or in partto a model group from a model group definition.
{model group} is theModel Group for which the model group definition provides a name.
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
The XML representation for a model group definition schema component is a<group> element information item.It provides fornaming a model group for use by reference in the XML representation ofcomplex type definitions and model groups. The correspondences between theproperties of the information item after the appropriate·pre-processing·and theproperties of the component it corresponds to are given in this section.
group
Element Information ItemIf the item has<schema> or<redefine> as its parent (in which case there will be aname
[attribute], then the item maps to a model group definition component with properties as follows:
name
[attribute]; if it overrides a corresponding declaration in the·target set· of its parent, it will also (in the overridden schema document) map to a component as described below. SeeOverriding component definitions (<override>
) (§4.2.5) for details.targetNamespace
[attribute] of the<schema> ancestor element informationitem if present, otherwise·absent·.Otherwise, if the item has aref
[attribute] and doesnot haveminOccurs=maxOccurs=0
, then the<group> element maps to a particle component with properties as follows:
maxOccurs
[attribute] equalsunbounded, otherwise the·actual value· of themaxOccurs
[attribute], if present, otherwise1
.ref
[attribute]Otherwise, the<group> hasminOccurs=maxOccurs=0
, in which case it maps to no component at all.
ref
and noname
) 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 tominOccurs
ormaxOccurs
: this is because the schema for schema documents does not allow them on the child of<group> when it is named. This in turn is because the{min occurs} and{max occurs} of the particles whichrefer to the definition are what count.All model group definitions (seeModel Group Definitions (§3.7))must satisfy the following constraint.
When the[children] of element information items are not constrainedto beempty or by reference to a simple type definition(Simple Type Definitions (§3.16)), the sequence of elementinformation item[children] contentmay be specified inmore detail with a model group. Because the{term} property of a particle can be amodel group, and model groups contain particles, model groups can indirectly contain other model groups; the grammar for model groupsis therefore recursive.[Definition:] A model groupdirectly contains the particles in the value of its{particles} property.[Definition:] A model groupindirectly contains the particles, groups, wildcards, andelement declarations which are·contained· by the particles it·directly contains·.[Definition:] A model groupcontains the components which it either·directly contains·or·indirectly contains·.
<xs:group name="otherPets"> <xs:all> <xs:element name="birds"/> <xs:element name="fish"/> </xs:all> </xs:group> <xs:all> <xs:element ref="cats"/> <xs:element ref="dogs"/> <xs:group ref="otherPets"/></xs:all><xs:sequence> <xs:choice> <xs:element ref="left"/> <xs:element ref="right"/> </xs:choice> <xs:element ref="landmark"/></xs:sequence>
The model group schema component has the followingproperties:
When two or more element declarations contained·directly·,·indirectly·, or·implicitly· in the{particles} of a model group have identical names, the type definitions of those declarationsmust be thesame.
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
The XML representation for a model group schema component iseither an<all>, a<choice> or a<sequence>element information item. The correspondences between theproperties of those information itemsafter the appropriate·pre-processing·and theproperties of the component they correspond to are given in this section.
all
Element Information Item et al.Each of the above items corresponds to a particle containing a model group, with properties as follows (unlessminOccurs=maxOccurs=0
, in which case the item corresponds to no component at all):
maxOccurs
[attribute] equalsunbounded, otherwise the·actual value· of themaxOccurs
[attribute], if present, otherwise1
.The particle just described has aModel Group as the value of its{term} property, as follows.
In order to define the validation rules for modelgroups clearly, it will be useful to define some basic terminology;this is done in the next two sections, before the validation rulesthemselves are formulated.
Each model groupM denotes a languageL(M), whose members are the sequences of element information items·accepted· byM.
WithinL(M) a smaller languageV(M) can beidentified, which is of particular importance for schema-validityassessment. The difference between the two languages is thatV(M) enforces some constraints which are ignored in the definitionofL(M).InformallyL(M) is the set of sequences which are accepted by a modelgroup if no account is taken of the schema componentconstraintUnique Particle Attribution (§3.8.6.4) or the related provisions in the validation rules which specify how to choose a unique·path· in a non-deterministic model group. By contrast,V(M) takesaccount of those constraints and includes only the sequences which are·locally valid· againstM. For all model groupsM,V(M) is asubset ofL(M).L(M) and related concepts are described in thissection;V(M) is described in the next section,Principles of Validation against Groups (§3.8.4.2).
[Definition:] When a sequenceS of element informationitems is checked against a model groupM, the sequence of·basic particles· which the items ofS match, in order, is apath ofS inM. For a givenS andM, thepath ofS inM is not necessarily unique.Detailed rules for the matching, and thus for the construction ofpaths, are given inLanguage Recognition by Groups (§3.8.4.1) andPrinciples of Validation against Particles (§3.9.4.1).Not every sequence has a path in every model group, but everysequence accepted by the model group does have a path.[Definition:] Fora model groupM and a sequenceS inL(M), the pathofS inM is acomplete path; prefixes ofcomplete paths which are themselves not complete pathsareincomplete paths. For example, in the model group
<xs:sequence> <xs:element name="a"/> <xs:element name="b"/> <xs:element name="c"/> </xs:sequence>
the sequences (<a/><b/><c/>
)and (<a/><b/>
) have·paths·(the first a·complete path· and the secondan·incomplete path·),but the sequences (<a/><b/><c/><d/>
) and(<a/><x/>
) do not have paths.
<xs:sequence> <xs:element name="a"/> <xs:element name="b"/> <xs:choice/> </xs:sequence>accepts no sequences because the empty
choice
recognizesno input sequences. But the sequences (<a/>
)and (<a/><b/>
) have paths in the model group.The definitions ofL(M) and·paths· inM, whenM is a·basic term· ora·basic particle·, are given inPrinciples of Validation against Particles (§3.9.4.1). The definitions for groups aregiven below.
This section definesL(M), the set of·paths· inM, andV(M), ifMis a sequence group.
IfM is aModel Group,and the{compositor} ofM issequence, and the{particles} ofM is the sequenceP1,P2, ...,Pn, thenL(M) is the set of sequencesS =S1 +S2 + ... +Sn (taking "+" as the concatenation operator), whereSi is inL(Pi) for 0 <i ≤n.The sequence of sequencesS1,S2, ...,Sn is a·partition· ofS.Less formally, whenM is a sequence ofP1,P2, ...Pn, thenL(M) is the set of sequences formed by taking one sequence which isaccepted byP1, then one accepted byP2, and so on, up throughPn, and then concatenating them together in order.
[Definition:] Apartition of a sequence is a sequence of sub-sequences,some or all of whichmay be empty, such that concatenating allthe sub-sequences yields the original sequence.
<xs:sequence> <xs:element name="a"/> <xs:element name="b"/> <xs:element name="c"/> </xs:sequence>
<a/><b/>
WhenM is a sequence group,the setV(M) (the set of sequences·locally valid· againstM) is the set of sequencesS whichare inL(M) and which have a·validation-path· inM.Informally,V(M) contains those sequences which areaccepted byM and for which no element information itemis ever·attributed to· a·wildcard particle· if it can, incontext, instead be·attributed to· an·element particle·.There will invariably be a·partition· ofS whosemembers are·locally valid· against{particles}ofM.
<xs:sequence> <xs:any minOccurs="0"/> <xs:element name="a" minOccurs="0"/> </xs:sequence>then the sequence (
<a/>
) has two·paths·inM, one containing just the·wildcard particle· and the othercontaining just the·element particle·. It is the latterwhich is a·validation-path· and which determines whichParticle the item in the input is·attributed to·.<xs:sequence> <xs:any minOccurs="0"/> <xs:element name="a"/> </xs:sequence>then the sequence (
<a/><a/>
) is inL(M), but notinV(M), because the validation rules require that the firsta
be·attributed to· the·wildcard particle·.In a·validation-path· the initiala
will invariably be·attributed to· the·element particle·, and so no sequencewith an initiala
can be·locally valid· againstthis model group.This section definesL(M), the set of·paths· inM, andV(M), ifMis a choice group.
When the{compositor} ofM ischoice, and the{particles} ofM is the sequenceP1,P2, ...,Pn,thenL(M) isL(P1) ∪L(P2) ∪ ... ∪L(Pn),and the set of·paths· ofS inP is the setQ =Q1 ∪Q2 ∪ ... ∪Qn, whereQi is the set of·paths· ofS inPi, for0 <i ≤n.Less formally, whenM is a choice ofP1,P2, ...Pn, thenL(M) contains any sequence accepted by any of the particlesP1,P2, ...Pn,and any·path· ofS in any of the particlesP1,P2, ...Pnis a·path· ofS inP.
The setV(M) (the set of sequences·locally valid· againstM) is the set of sequencesS whichare inL(M) and which have a·validation-path· inM.In effect, this means that if one of the choices inM·attributes· an initial element information item toa·wildcard particle·, and another·attributes· the sameitem to an·element particle·, then the latter choice is usedfor validation.
<xs:choice> <xs:any/> <xs:element name="a"/> </xs:choice>then the·validation-path· for the sequence (
<a/>
)contains just the·element particle· and it is to the·element particle· that the input element will be·attributed·; the alternate·path·containing just the·wildcard particle· is not relevant forvalidation as defined in this specification.This section definesL(M), the set of·paths· inM, andV(M), ifMis an all-group.
When the{compositor} ofM isall, and the{particles} ofM is the sequenceP1,P2, ...,Pn,thenL(M) is the set of sequencesS =S1 ×S2 × ... ×Sn(taking "×" as the interleave operator),wherefor 0 <i ≤n,Si is inL(Pi).The set of sequences{S1,S2, ...,Sn} is a·grouping· ofS.The set of·paths· ofS inP isthe set of all·paths·Q =Q1 ×Q2 × ... ×Qn,whereQi is a·path· ofSi inPi, for 0 <i ≤n.
Less formally, whenM is anall-group ofP1,P2, ...Pn, thenL(M) is the set of sequences formed by taking one sequence whichis accepted byP1, then one accepted byP2,and so on, up throughPn, and then interleaving themtogether. Equivalently,L(M) is the set of sequencesSsuch that the set {S1,S2, ...,Sn} is a·grouping· ofS, and for 0 <i ≤n,Si is inL(Pi).
[Definition:] Agrouping of a sequence is a set of sub-sequences, some orall of which may be empty, such that each member of the originalsequence appears once and only once in one of the sub-sequences andall members of all sub-sequences are in the originalsequence.
<xs:all> <xs:element name="a" minOccurs="0" maxOccurs="5"/> <xs:element name="b" minOccurs="1" maxOccurs="1"/> <xs:element name="c" minOccurs="0" maxOccurs="5"/> </xs:all>and an input sequenceS
<a/><b/><a/>wheren = 3, thenS1 is (
<a/><a/>
),S2 is (<b/>
),and the·path· ofS inM is the sequence containing first theParticlefor thea
element, then theParticle for theb
element, then once more theParticle for thea
element.The setV(M) (the set of sequences·locally valid· againstM) is the set of sequencesS whichare inL(M) and which have a·validation-path· inM.In effect, this means that if one of theParticles inM·attributes· an element information item toa·wildcard particle·, and a·competing·Particle·attributes· the same item to an·element particle·, then the·element particle· is used for validation.
<xs:all> <xs:any/> <xs:element name="a"/> </xs:all>thenM accepts sequences of length two, containingone
a
element and one other element.a
element. After the firsta
the·element particle· accepts no more elementsand so no longer·competes· with the·wildcard particle·.So if the sequence (<a/><a/>
)is checked againstM, in the·validation-path· thefirsta
element will be·attributed to·the·element particle· and the second to the·wildcard particle·.a
,use a wildcard that explicitly disallows it. That is,<xs:all> <xs:any notQName="a"/> <xs:element name="a"/> </xs:all>Now the sequence (
<a/><a/>
) is notaccepted by the particle.It is possible for a given sequence of element information itemsto have multiple·paths· in a given model groupM; this isthe case, for example, whenM is ambiguous, as for example
<xs:choice> <xs:sequence> <xs:element ref="my:a" maxOccurs="unbounded"/> <xs:element ref="my:b"/> </xs:sequence> <xs:sequence> <xs:element ref="my:a"/> <xs:element ref="my:b" maxOccurs="unbounded"/> </xs:sequence> </xs:choice>
which can match the sequence (<a/><b/>
)in more than one way.It may also be the case with unambiguous model groups, ifthey do not correspond to adeterministicexpression (as it is termed in[XML 1.1])or a "1-unambiguous" expression, as itis defined by[Brüggemann-Klein / Wood 1998].For example,
<xs:sequence> <xs:element name="a" minOccurs="0"/> <xs:element name="a"/> </xs:sequence>
As noted above, each model groupM denotes alanguageL(M), whose members are sequences of element informationitems. Each member ofL(M) has one or more·paths· inM, as doother sequences of element information items.
By imposing conditions on·paths· in a model groupMit is possible to identify a set of·validation-paths· inM,such that ifM is a model group which obeys theUnique Particle Attribution (§3.8.6.4) constraint, then any sequenceS has at most one·validation-path· inM.The languageV(M) can then be defined as the set ofsequences which have·validation-paths· inM.
[Definition:] TwoParticlesP1 andP2 contained in someParticlePcompete with each other if and only if some sequenceSof element information items has two·paths· inP which areidentical except that one path hasP1 as its last item and the otherhasP2.
For example, in the content model
<xs:sequence> <xs:element name="a"/> <xs:choice> <xs:element name="b"/> <xs:any/> </xs:choice> </xs:sequence>
the sequence (<a/><b/>
) has two paths,one (Q1) consisting of theParticle whose{term} isthe declaration fora
followed by theParticle whose{term} isthe declaration forb
, anda second (Q2) consisting of theParticle whose{term} isthe declaration fora
followed by theParticle whose{term} isthe wildcard. The sequencesQ1 andQ2 are identical except for their last items, and so thetwoParticles which are the last items ofQ1 andQ2 are said to·compete· with each other.
<xs:choice> <xs:sequence> <xs:element name="a"/> <xs:element name="b"/> </xs:sequence> <xs:sequence> <xs:element name="c"/> <xs:any/> </xs:sequence> </xs:choice>theParticles for
b
and the wildcard do not·compete·, because there is nopair of·paths· inP which differ only in one having the·element particle· forb
andthe other having the·wildcard particle·.[Definition:] Two(or more)·paths· of a sequenceS in aParticleParecompeting paths if and only ifthey are identical except for their final items, which differ.
[Definition:] For any sequenceS of elementinformation items and any particleP, a·path· ofS inPis avalidation-path if and only if for eachprefix of the·path· which ends with a·wildcard particle·, thecorresponding prefix ofS has no·competing path· whichends with an·element particle·.
[Definition:] A sequenceS ofelement information items islocally valid againsta particleP if and only ifS has a·validation-path· inP. The set of all such sequences is writtenV(P).
All model groups (seeModel Groups (§3.8))must satisfy the following constraints.
= 1
which is the{particle} of the{content type} of a complex type definition.=
{max occurs}= 1
, whereP is among the{particles} of aModel Group whose{compositor} isall.[Definition:] Anelement particle is aParticle whose{term} is anElement Declaration.[Definition:] Awildcard particle is aParticle whose{term} is aWildcard.Wildcard particles may bereferred to as "strict", "lax",or "skip" particles, depending on the{process contents} propertyof their{term}.
The following constraints define relations appealed to elsewhere in this specification.
0
if there are no{particles}).0
if there are no{particles}).0
if there are no{particles}).0
if there are no{particles}).As described inModel Groups (§3.8), particles contribute to the definitionof content models.
When an element is validated against a complex type, its sequence of child elements is checked against the content model ofthe complex type and the children are·attributed to· toParticles of the content model.The attribution of items toParticlesdetermines the calculation of the items'·context-determined declarations·and thus partially determines the·governingelement declarations· for the children:when an element information item is·attributed to· an·element particle·, thatParticle'sElement Declaration,or anElement Declaration·substitutable· for it,becomesthe item's·context-determined declaration· andthus normally its·governing element declaration·; when the item is·attributed to· a·wildcard particle·, the·governing element declaration· depends on the{process contents} property of the wildcard andonQName resolution (Instance) (§3.17.6.3).
<xs:element ref="egg" minOccurs="12" maxOccurs="12"/><xs:group ref="omelette" minOccurs="0"/><xs:any maxOccurs="unbounded"/>
The particle schema component has the following properties:
In general, multiple elementinformation item[children], possibly with intervening character[children] if the content typeismixed, can be·validated· withrespect to a single particle. When the{term} is an elementdeclaration or wildcard,{min occurs} determines the minimum number of such element[children] that can occur. The number of such childrenmust be greater than or equal to{min occurs}. If{min occurs} is0, then occurrence of such children is optional.
Again, when the{term} is an elementdeclaration or wildcard, the number of such element[children]must be less than or equal to any numeric specification of{max occurs}; if{max occurs} isunbounded, then there is noupper bound on the number of such children.
When the{term} is a model group, the permittedoccurrence range is determined by a combination of{min occurs} and{max occurs} and the occurrence ranges of the{term}'s{particles}.
[Definition:] A particledirectly contains the component which is the value of its{term} property.[Definition:] A particleindirectly contains the particles, groups, wildcards, andelement declarations which are contained by the value of its{term} property.[Definition:] A particlecontains the components which it either·directly contains·or·indirectly contains·.
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
minOccurs
andmaxOccurs
attributes in the schema document:Every particleP·recognizes· some languageL(P).When{min occurs} and{max occurs} ofP areboth 1,L(P) is the language ofP's{term},as described inValidation of Basic Terms (§3.9.4.1.2). Thefollowing section (Language Recognition for Repetitions (§3.9.4.1.1))describes how more complicated counts are handled.
WhenP.{min occurs} =P.{max occurs} =n, andP.{term} =T, thenL(P) is the set of sequencesS =S1 +S2 + ... +Sn such thatSi is inL(T) for 0 <i ≤n.Less formally:L(P) is theset of sequences which have·partitions· inton sub-sequencesfor which each of then subsequences is in the language accepted by the{term} ofP.
WhenP.{min occurs} =j andP.{max occurs} =k,andP.{term} =T, thenL(P) is the set of sequencesS =S1, +S2 + ... +Sn, i.e. theset of sequences which have·partitions· inton sub-sequencessuch thatn ≥j andn ≤k (ork isunbounded)andSi is inL(T) for 0 <i ≤n.
WhenP.{min occurs} = 0, thenL(P) also includes the empty sequence.
In the preceding section (Language Recognition for Repetitions (§3.9.4.1.1)), the languageL(P)·accepted· by aParticleP is defined in terms of the language·accepted· byP's{term}. This section definesL(T) for·basic terms·;for the definition ofL(T) whenT is a group, seeLanguage Recognition by Groups (§3.8.4.1).
[Definition:] For anyElement DeclarationD, the languageL(D)·accepted· byD is the set of all sequences oflength 1 whose sole member is an element information item which·matches·D.
[Definition:] For anyWildcardW, the languageL(W)·accepted· byWis the set of all sequences oflength 1 whose sole member is an element information item which·matches·W.
[Definition:] An element information itemEmatches aWildcardW (or a·wildcard particle· whose{term} isW)if and only ifEis locally·valid· with respect toW, as defined in the validation ruleItem Valid (Wildcard) (§3.10.4.1).
[Definition:] Two namespacenamesN1 andN2 are said tomatch if and only if they are identical or both are·absent·.
For principles of validation when the{term} is a model groupinstead of a·basic particle·, seeLanguage Recognition by Groups (§3.8.4.1) andPrinciples of Validation against Groups (§3.8.4.2).
All particles (seeParticles (§3.9))must satisfy the following constraint.
The following constraint defines a relation appealed to elsewhere in this specification.
The following constraint defines a relation appealed to elsewhere in this specification.
0
.0
.In order to exploit the full potential for extensibility offered by XMLplus namespaces, more provision is needed than DTDs allow for targeted flexibility in contentmodels and attribute declarations. A wildcard provides for·validation· ofattribute and element information items dependent on their namespacenamesand optionally on their local names.
<xs:any processContents="skip"/><xs:any namespace="##other" processContents="lax"/><xs:any namespace="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" notQName="xsl:comment xsl:fallback"/><xs:any notNamespace="##targetNamespace ##local"/><xs:anyAttribute namespace="http://www.w3.org/XML/1998/namespace"/>
The wildcard schema component has the following properties:
A set each of whose members is either an xs:anyURI value or the distinguished value·absent·. Required.
##local
" in the schema document maps to the value·absent· in the{namespace constraint} property)xsi:type
, and theitemmust be·valid· asappropriate.SeeAnnotations (§3.15) for information on the role of the{annotations} property.
The XML representation for a wildcard schema component is an<any> or<anyAttribute> element information item.
any
Element Information ItemanyAttribute
Element Information ItemAn<any> information item corresponds both to a wildcard component and to a particle containing that wildcard (unlessminOccurs=maxOccurs=0
, in which case the item corresponds to no component at all). The mapping rules are given in the following two subsections. As always, the mapping rules given here apply after, not before, the appropriate·pre-processing·.
Processorsmay issue a warning if a list ofxs:anyURI
values in thenamespace
ornoNamespace
attributes includes any values beginning with the string '##
'.
##
' are not IRIs or URIS according to the definitions given in the relevant RFCs (for references see[XML Schema: Datatypes]) and users of this specification are discouraged from using them as namespace names, to avoid confusion with the keyword values defined by this specification.The mapping from an<any> information item to a particle is as follows.
maxOccurs
=unbounded, otherwise the·actual value· of themaxOccurs
[attribute], if present, otherwise1
.The mapping from an<any> information item to a wildcard component is as follows. This mapping is also used for mapping<anyAttribute> information items to wildcards, although in some cases the result of the mapping is further modified, as specified in the rules for<attributeGroup> and<complexType>.
namespace
[attribute] is present,then the appropriatecase among the following:namespace
="##any"
,thenany;namespace
="##other"
,thennot;notNamespace
[attribute] is present,thennot;namespace
nornotNamespace
is present)any.namespace
nornotNamespace
is present,thenthe empty set;namespace
="##any"
,thenthe empty set;namespace
="##other"
,thena set consisting of·absent· and, if thetargetNamespace
[attribute] of the<schema> ancestor element information item is present, its·actual value·;namespace
ornotNamespace
[attribute] (whichever is present), except##targetNamespace
, the correspondingmember is the·actual value· of thetargetNamespace
[attribute] of the<schema> ancestorelement information item if present, otherwise·absent·;##local
, thecorresponding member is·absent·.notQName
[attribute] is present, then a set whose members correspond to the items in the·actual value· of thenotQName
[attribute], as follows.##defined
", then the keyworddefined is a member of the set.##definedSibling
", then the keywordsibling is a member of the set.notQName
[attribute] is not present, then the empty set.Wildcards are subject to the same ambiguity constraints (Unique Particle Attribution (§3.8.6.4)) as other content model particles: If an instance element could match one of two wildcards, within the content model of a type, that model is in error.
namespace
andnotNamespace
attributesmust not both bepresent.When an element or attribute informationitem is·attributed· to a wildcard and the preceding constraint(Item Valid (Wildcard) (§3.10.4.1)) is satisfied, then the item has no·context-determined declaration·. Its·governing· declaration, if any, is found by matching itsexpanded name as described inQName resolution (Instance) (§3.17.6.3).Note that QName resolution is performed only if the item is·attributed· toastrict orlax wildcard; if the wildcard has a{process contents} property ofskip, then the item has no·governing· declaration.
[Definition:] An element or attribute information item isskipped if it is·attributed· to askip wildcard or if one of its ancestor elements is.
All wildcards (seeWildcards (§3.10))must satisfy the following constraint.
The following constraints define a relation appealed to elsewhere in this specification.
Identity-constraint definition components provide for uniqueness andreference constraints with respect to the contents of multiple elements and attributes.
<xs:key name="fullName"> <xs:selector xpath=".//person"/> <xs:field xpath="forename"/> <xs:field xpath="surname"/></xs:key><xs:keyref name="personRef" refer="fullName"> <xs:selector xpath=".//personPointer"/> <xs:field xpath="@first"/> <xs:field xpath="@last"/></xs:keyref><xs:unique name="nearlyID"> <xs:selector xpath=".//*"/> <xs:field xpath="@id"/></xs:unique>
The identity-constraint definition schema component has the followingproperties:
If a value is present, its{identity-constraint category} must bekey orunique.
Identity-constraint definitions are identified by their{name} and{target namespace};identity-constraintdefinition identitiesmust be unique within an·XSD schema·. SeeReferences to schema components across namespaces (<import>
) (§4.2.6) for the use of componentidentifiers when importing one schema into another.
These constraints are specified alongside the specification of types for theattributes and elements involved, i.e. something declared as of type integercan also serve as a key. Each constraint declaration has a name, which exists in asingle symbol space for constraints. The equality and inequalityconditionsappealed to in checking these constraints apply to thevalues ofthe fields selected, not theirlexical representation, so that for example3.0
and3
would be conflicting keys if they were both decimal, but non-conflicting ifthey were both strings, or one was a string and one a decimal. When equality andidentity differ for the simple types involved, all threeforms of identity-constraint test foreither equalityor identityof values.
Overall the augmentations to XML'sID/IDREF
mechanism are:
{selector} specifies a restricted XPath([XPath 2.0]) expression relative toinstances of the element being declared. Thismust identify asequence of element nodes that arecontained within the declared elementto which the constraint applies.
{fields} specifies XPath expressions relative to eachelement selected by a{selector}. EachXPath expression in the{fields} propertymust identifya single node (element or attribute), whose content or value, whichmust beof a simple type, is used in the constraint. It is possible to specify anordered list of{fields}s, to cater to multi-field keys,keyrefs, and uniqueness constraints.
In order to reduce the burden on implementers, in particularimplementers of streaming processors, only restricted subsets of XPathexpressions are allowed in{selector} and{fields}. The details are given inConstraints on Identity-constraint Definition Schema Components (§3.11.6).
xsl:key
.SeeAnnotations (§3.15) for information on the role of the{annotations} property.
The XML representation for an identity-constraint definition schema component is either a<key>, a<keyref> or a<unique> element information item. The correspondences between the properties of those information items after the appropriate·pre-processing· and the properties of the component they correspond to are as follows:
unique
Element Information Item et al. If theref
[attribute] is absent, the corresponding schema component is as follows:
targetNamespace
[attribute] of the<schema> ancestor element information item if present, otherwise·absent·.xpath
as the designatedexpression[attribute].xpath
as the designated expression[attribute].refer
[attribute], otherwise·absent·. Otherwise (theref
[attribute] is present), the corresponding schema component is the identity-constraint definition·resolved· to by the·actual value· of theref
[attribute].
<xs:element name="vehicle"> <xs:complexType> . . . <xs:attribute name="plateNumber" type="xs:integer"/> <xs:attribute name="state" type="twoLetterCode"/> </xs:complexType></xs:element><xs:element name="state"> <xs:complexType> <xs:sequence> <xs:element name="code" type="twoLetterCode"/> <xs:element ref="vehicle" maxOccurs="unbounded"/> <xs:element ref="person" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <!-- vehicles are keyed by their plate within states --> <xs:key name="reg"> <xs:selector xpath=".//vehicle"/> <xs:field xpath="@plateNumber"/> </xs:key></xs:element><xs:element name="root"> <xs:complexType> <xs:sequence> . . . <xs:element ref="state" maxOccurs="unbounded"/> . . . </xs:sequence> </xs:complexType> <!-- states are keyed by their code --> <xs:key name="state"> <xs:selector xpath=".//state"/> <xs:field xpath="code"/> </xs:key> <xs:keyref name="vehicleState" refer="state"> <!-- every vehicle refers to its state --> <xs:selector xpath=".//vehicle"/> <xs:field xpath="@state"/> </xs:keyref> <!-- vehicles are keyed by a pair of state and plate --> <xs:key name="regKey"> <xs:selector xpath=".//vehicle"/> <xs:field xpath="@state"/> <xs:field xpath="@plateNumber"/> </xs:key> <!-- people's cars are a reference --> <xs:keyref name="carRef" refer="regKey"> <xs:selector xpath=".//car"/> <xs:field xpath="@regState"/> <xs:field xpath="@regPlate"/> </xs:keyref></xs:element><xs:element name="person"> <xs:complexType> <xs:sequence> . . . <xs:element name="car"> <xs:complexType> <xs:attribute name="regState" type="twoLetterCode"/> <xs:attribute name="regPlate" type="xs:integer"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType></xs:element>
state
element is defined, whichcontains acode
child and somevehicle
andperson
children. Avehicle
in turn has aplateNumber
attribute,which is an integer, and astate
attribute. State'scode
s are a key for them within the document. Vehicle'splateNumber
s are a key for them within states, andstate
andplateNumber
is asserted to be akey forvehicle
within the document as a whole. Furthermore, aperson
element hasan emptycar
child, withregState
andregPlate
attributes, which are then asserted together to refer tovehicle
s via thecarRef
constraint. The requirementthat avehicle
'sstate
match its containingstate
'scode
is not expressed here.<xs:element name="stateList"> <xs:complexType> <xs:sequence> . . . <xs:element name="state" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> . . . <xs:element name="code" type="twoLetterCode"/> . . . </xs:sequence> </xs:complexType> </xs:element> . . . </xs:sequence> </xs:complexType> <xs:key ref="state"/> <!-- reuse the key constraint from the above example --></xs:element>
state
elements can appear as child elements understateList
. Akey constraint can be used to ensure that there is no duplicate statecode
. We already defined akey in the above example for the exact same purpose (the key constraint is named "state
"). We can reuse it directly via theref
attribute on thekey
element.ref
orname
is present, but not both.name
is present, then<selector> appears in[children].name
is present on<keyref>, thenrefer
is also present.ref
is present, then onlyid
and<annotation> are allowed to appear together withref
.ref
is present, then the{identity-constraint category} of the identity-constraint definition·resolved· to by the·actual value· of theref
[attribute] matches the name of the element information item.For purposes of checking identity-constraints, single atomic values are not distinguished from lists with single items. An atomic valueV and a listL with a single item are treated as equal, for purposes of this specification, ifV is equal to the atomic value which is the single item ofL. And similarly for identity.
All identity-constraint definitions (seeIdentity-constraint Definitions (§3.11))must satisfy the following constraint.
|
child
axis whose abbreviated form is as given above.
|
[Definition:] The subset of XPath defined inSelector Value OK (§3.11.6.2) is called theselector subset of XPath.
|
child
and/orattribute
axes whose abbreviated form isas given above.[Definition:] The subset of XPath defined inFields Value OK (§3.11.6.3) is called thefield subset of XPath.
Type Alternative components provide associations between boolean conditions (as XPath expressions) andType Definitions. They are used in conditional type assignment.
The type alternative schema component has the following properties:
Type alternatives can be used by anElement Declaration to specify a condition ({test}) under which a particular type ({type definition}) is used as the·governing type definition· for element information items governed by thatElement Declaration. EachElement Declarationmay have multipleType Alternatives in its{type table}.
The XML representation for a type alternative schema component is an<alternative> element information item. The correspondences between the properties of that information item after the appropriate·pre-processing· and the properties of the component it corresponds to are as follows:
alternative
Element Information ItemEach<alternative> element maps to aType Alternative component as follows.
test
[attribute] is not present, then·absent·; otherwise anXPath Expression property record, as described in sectionXML Representation of Assertion Schema Components (§3.13.2), with<alternative> as the "host element" andtest
as the designated expression[attribute].type
[attribute], if one is present, otherwise the type definition correspondingto thecomplexType
orsimpleType
among the[children] of the<alternative> element.type
attribute, or acomplexType
child element, or asimpleType
child element.true
andA.{type definition} =T. The{test} is evaluated in the following way:false
.All type alternatives (seeType Alternatives (§3.12))must satisfy the following constraints.
|
attribute
axis whose abbreviated form is as given above.fn:not
and constructors for the built-in datatypes.a:b('123')
" has 2 paths in the grammar, by matching eitherBooleanFunction orConstructorFunction. The rules given here require different function names for the productions. As a result, the ambiguity can be resolved based on the function name.cast as
"QName in theCastExpr production) are casts to built-in datatypes.Assertion components constrain the existence and values of related elements and attributes.
<xs:assert test="@min le @max"/>
min
attribute be less than or equal to that of themax
attribute, and fails if that is not the case.The assertion schema component has the following properties:
To check an assertion, an instance of the XPath 2.0 data model ([XDM]) is constructed, in which the element information item being·assessed· is the (parentless) root node, and elements and attributes are assigned types and values according to XPath 2.0 data model construction rules, with some exceptions. SeeAssertion Satisfied (§3.13.4.1) for details about how the data model is constructed. When evaluated against this data model instance,{test} evaluates to eithertrue
orfalse
(if any other value is returned, it's converted to eithertrue
orfalse
as if by a call to the XPathfn:boolean function).
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
The XML representation for an assertion schema component is an<assert> element information item. The correspondences between the properties of that information item after the appropriate·pre-processing· and the properties of the component it corresponds to are as follows:
assert
Element Information ItemThe<assert> element maps to anAssertion component as follows.
test
as the designated expression[attribute].Assertions, like identity constraints and conditional type assignment, use[XPath 2.0] expressions. The expression itself is recorded, together with relevant parts of the context, in anXPath Expression property record. The mapping is as described below; in each case, the XPath expression itself is given in adesignated attribute of the appropriate "host element".
xpathDefaultNamespace
[attribute], if present on the host element, otherwise that of thexpathDefaultNamespace
[attribute] of the<schema> ancestor. Then the value is the appropriatecase among the following:##defaultNamespace
,thenthe appropriatecase among the following:##targetNamespace
,thenthe appropriatecase among the following:##local
,then·absent·;<xs:complexType name="intRange"> <xs:attribute name="min" type="xs:int"/> <xs:attribute name="max" type="xs:int"/> <xs:assert test="@min le @max"/></xs:complexType>
min
attribute must be less than or equal to that of themax
attribute.Note that the attributes are validated before the assertion on the parent element is checked, so the typed values of the attributesare available for comparison; it is not necessary to cast the valuestoint
or some other numeric type before comparing them.<xs:complexType name="arrayType"> <xs:sequence> <xs:element name="entry" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="length" type="xs:int"/> <xs:assert test="@length eq fn:count(./entry)"/></xs:complexType>
length
attribute must be the same as the number of occurrences ofentry
sub-elements.true
(see below) without raising anydynamic error ortype error.$value
", as described inAssertion Properties Correct (§3.13.6.1).$value
" appears as a member of thevariable values in thedynamic context. Theexpanded QName
of that member has no namespace URI and has "value
" as the local name. Thevalue
of the member is determined by the appropriatecase among the following:value
is theXDM representation ofE.[schema actual value]under the{content type} .{simple type definition} ofE's·governing type definition·..
", while its content may be referred to as "$value
". Since the element node, as a consequence of clause1.2, will normally have the type annotationanyType
, itsatomized value will be a single atomic value of typeuntypedAtomic
. By contrast,$value
will be a sequence of one or more atomic values, whose types are the most specific (narrowest) built-in types available.value
is the empty sequence.true
orfalse
as if by a call to the XPathfn:boolean function.It is·implementation-defined· (both in this specification and in[XPath 2.0]) when type errors are detected and whether, when detected, they are treated as static or dynamic errors.
All assertions (seeAssertions (§3.13))must satisfy the following constraints.
expanded QName
of that member has no namespace URI and hasvalue
as the local name. The (static)type
of the member isanyAtomicType*
.http://www.w3.org/2005/xpath-functions
namespace as defined in the[Functions and Operators] specification.anyAtomicType*
simply says that for static typing purposes the variable$value
will have a value consisting of a sequence of zero or more atomic values.http://www.w3.org/2005/xpath-functions
.http://www.w3.org/2005/xpath-functions/collation/codepoint
)defined by[Functions and Operators].It is·implementation-defined· (both in this specification and in[XPath 2.0]) when type errors are detected and whether, when detected, they are treated as static or dynamic errors.
Notation declarations reconstruct XML NOTATION declarations.
<xs:notation name="jpeg" public="image/jpeg" system="viewer.exe">
The notation declaration schema component has the followingproperties:
Notation declarations do not participate in·validation· as such. They are referenced in thecourse of·validating· strings asmembers of theNOTATION simple type. An element or attribute information item withits·governing· type definition or its·validating type·derived from theNOTATIONsimple type is·valid· only if itsvalue was among the enumerations of such simple type.As a consequence such a value is required to be the{name}of a notation declaration.
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
The XML representation for a notation declaration schema component isa<notation>element information item. The correspondences between theproperties of that information itemafter the appropriate·pre-processing·and theproperties of the component it corresponds to are as follows:
notation
Element Information ItemThe<notation> element maps to aNotation Declaration component as follows.
targetNamespace
[attribute] of the<schema> ancestorelement information item 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>
All notation declarations (seeNotation Declarations (§3.14))must satisfy the following constraint.
Annotations provide for human- and machine-targeted annotations of schema components.
<xs:simpleType fn:note="special"> <xs:annotation> <xs:documentation>A type for experts only</xs:documentation> <xs:appinfo> <fn:specialHandling>checkForPrimes</fn:specialHandling> </xs:appinfo> </xs:annotation>
The annotation schema component has the following properties:
{user information} is intended for human consumption,{application information} for automatic processing. In both cases, provision is made for an optional URI reference to supplement the local information, as the value of thesource
attribute of the respective element information items.·validation· doesnot involve dereferencing these URIs, when present. In the case of{user information}, indicationshould be given as to the identity of the (human) language used in the contents, using thexml:lang
attribute.
{attributes} ensures that when schema authors take advantage of the provision for adding attributes from namespaces other than the XSD 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. Providedan annotation itself satisfies all relevant·Schema Component Constraints· itcannot affect the·validation· of element informationitems.
The mapping defined in this specification from XML representations tocomponents does not apply to XML elements contained within an<annotation> element; such elements do not correspond tocomponents, when the mapping defined here is used.
It is·implementation-defined· what effect, if any, the invalidity of a descendant of<annotation> has on the construction of schema components from the enclosing schema document.
The name[Definition:] Annotated Component covers all the different kinds of component which mayhave annotations.
Annotation of schemas and schema components, with material for human orcomputer consumption, is provided for by allowing application information andhuman information at the beginning of most major schema elements, and anywhereat the top level of schemas. The XML representation for an annotation schema component isan<annotation>element information item. The correspondences between theproperties of that information item after the appropriate·pre-processing·and theproperties of the component it corresponds to are as follows:
annotation
Element Information Item et al.The<annotation> element and its descendants map to anAnnotation component as follows.
The annotation component corresponding to the<annotation> element in the example above will have one element item in each of its{user information} and{application information} and one attribute item in its{attributes}.
Virtually every kind of schema component defined in this specificationhas an{annotations} property. Whenthe component is described in a schema document, the mapping fromthe XML representation of the component to theAnnotationcomponents in the appropriate{annotations} property follows the rules described in the next paragraph.
None as such: the addition of annotations to the·post-schema-validation infoset· is covered by the·post-schema-validation infoset· contributions of the enclosing components.
All annotations (seeAnnotations (§3.15))must satisfy the following constraint.
Simple type definitions provide for constraining character information item[children] of element and attributeinformation items.
<xs:simpleType name="celsiusWaterTemp"> <xs:restriction base="xs:decimal"> <xs:fractionDigits value="2"/> <xs:minExclusive value="0.00"/> <xs:maxExclusive value="100.00"/> </xs:restriction></xs:simpleType>
The simple type definition schema component has the following properties:
Either anAttribute Declaration, anElement Declaration, aComplex Type Definition, or aSimple Type Definition.
With one exception, the{base type definition} of anySimple Type Definition is aSimple Type Definition. The exception is·xs:anySimpleType
·, which has·xs:anyType
·, aComplex Type Definition, as its{base type definition}.
xs:anySimpleType
·, in which it is·absent·.xs:anyAtomicType
·, whose{primitive type definition} is·absent·.The value of this propertymust be a primitive or ordinary simple type definitionwith{variety} =atomic,or an ordinary simple type definition with{variety} =unionwhose basic members are all atomic; the valuemust not itself be a list type (have{variety} =list)or have any basic members which are list types.
Simple types are identified by their{name} and{target namespace}. Exceptfor anonymous simple types (those with no{name}), sincetype definitions (i.e. both simple and complex type definitions taken together)must be uniquely identified within an·XSD schema·, no simple type definition can have the same name as anothersimple or complex type definition. Simple type{name}s and{target namespace}sare provided for reference frominstances (seexsi:type (§2.7.1)), and for use in the XMLrepresentation of schema components(specifically in<element> and<attribute>). SeeReferences to schema components across namespaces (<import>
) (§4.2.6) for the use of componentidentifiers when importing one schema into another.
A simple type definition with an empty specification for{final} can be used as the{base type definition} for other types·derived· by either ofextension or restriction, or as the{item type definition} inthe definition of a list, or in the{member type definitions} ofa union; the explicit valuesextension,restriction,list andunion prevent further·derivations· by extension (to yield a complex type) and restriction (to yield asimple type) and use in·constructing· lists and unions respectively.
{variety} determines whether the simple type corresponds toanatomic,list orunion type as defined by[XML Schema: Datatypes].
As described inType Definition Hierarchy (§2.2.1.1), every simple type definition isa·restriction· of some other simpletype (the{base type definition}), which is·xs:anySimpleType
· if and only if the typedefinition in question is·xs:anyAtomicType
· or a list orunion type definition which is not itself·derived· by restriction from alist or union respectively.A type definitionhas·xs:anyAtomicType
· as its{base type definition} if and only if it is one of the primitive datatypes. Eachatomic type is ultimately a restriction of exactly one such primitive datatype, which is its{primitive type definition}.
The{facets} property contains a set of constraining facets which are used to specify constraints on the datatype described by the simple type definition. Foratomic definitions, these are restricted to those appropriate for the corresponding{primitive type definition}. Therefore, the value space and lexical space (i.e. what is·validated· by any atomic simple type) is determined by the pair ({primitive type definition},{facets}).
Constraining facets are defined in[XML Schema: Datatypes]. All conforming implementations of this specificationmust support all of the facets defined in[XML Schema: Datatypes]. It is·implementation-defined· whether additional facets are supported; if they are, the implementationmust satisfy the rules for·implementation-defined· facets described in[XML Schema: Datatypes].
As specified in[XML Schema: Datatypes],list simple type definitions·validate· space separated tokens, each ofwhich conforms to a specified simple type definition, the{item type definition}. The item type specifiedmust not itself be alist type, andmust be one of the types identified in[XML Schema: Datatypes] as asuitable item type for a list simple type. In this case the{facets}apply to the list itself, and are restricted to those appropriate for lists.
Aunion simple type definition·validates· strings which satisfy atleast one of its{member type definitions}. As in the case oflist, the{facets}apply to the union itself, and are restricted to those appropriate for unions.
·xs:anySimpleType
· or·xs:anyAtomicType
·mustnot be named as the{base type definition} of any user-defined atomic simple type definitions: as they allow no constraining facets, this would be incoherent.
SeeAnnotations (§3.15) for information on the role of the{annotations} property.
As always, the mapping rules given in this section apply after, not before, the appropriate·pre-processing·.
simpleType
Element Information Item et al.The<simpleType> element and its descendantsnormally, when there are no errors, map to aSimple Type Definition component. The case in which anunknown facet is used in the definition of a simple typedefinition is handled specially: the<simpleType> in question is not in error, but it does not map to any component at all.
The following rules apply to all simple type definitions.
targetNamespace
[attribute] of the ancestor<schema> element information item if present, otherwise·absent·.base
[attribute] of<restriction>, if present, otherwise thetype definition corresponding to the<simpleType> amongthe[children] of<restriction>.{
restriction,extension,list,union}
, determined as follows.[Definition:] LetFS bethe·actual value· of thefinal
[attribute], if present, otherwise the·actual value· of thefinalDefault
[attribute] of the ancestorschema
element, if present, otherwise the empty string. Then the property value isthe appropriatecase among the following:The following rule applies if the{variety} isatomic
[Definition:] Theancestors of a·type definition· are its{base type definition} and the·ancestors· of its{base type definition}.(The ancestors of aSimple Type DefinitionT in the type hierarchy are themselves·type definitions·; they are distinct fromthe XML elements which may be ancestors, in the XML documenthierarchy, of the<simpleType> element which declaresT.)
If the{variety} islist, the following additionalproperty mapping applies:
xs:anySimpleType
·,thentheSimple Type Definition (a)·resolved· to by the·actual value· of theitemType
[attribute] of<list>,or (b), corresponding to the<simpleType> amongthe[children] of<list>, whichever is present.itemType
[attribute] or a<simpleType>[child], but not both.xs:anySimpleType
·), the{item type definition} of the{base type definition}.If the{variety} isunion, the followingadditional property mapping applies:
xs:anySimpleType
·,thenthe sequence ofSimple Type Definitions (a)·resolved· to by the items in the·actual value· of thememberTypes
[attribute] of<union>,if any, and (b) corresponding to the<simpleType>s amongthe[children] of<union>, if any, in order.memberTypes
[attribute] or one or more<simpleType>[children], or both.xs:anySimpleType
·), the{member type definitions} of the{base type definition}.xs
) namespace, unless thatexpanded name is one ofxs:enumeration
,xs:pattern
, orxs:assertion
.base
[attribute] or a<simpleType> among its[children], but notboth.itemType
[attribute] or a<simpleType> among its[children],but not both.memberTypes
[attribute] or ithas at least onesimpleType
[child].All simple type definitionsmust satisfy both the following constraints.
xs:anySimpleType
· (so circular definitions are disallowed). That is, it is possible to reach a primitive datatype or·xs:anySimpleType
· by following the{base type definition} zero or more times.xs:anyAtomicType
·, or elseB is an atomic simple type definition.xs:anyAtomicType
· is an exception because its{base type definition} is·xs:anySimpleType
·, whose{variety} is·absent·.xs:anySimpleType
· ,thenall of the following are true:xs:anySimpleType
· ,thenall of the following are true:[Definition:] Asimple type definitionT is avalid restriction of its{base type definition}if and only ifT satisfies constraintDerivation Valid (Restriction, Simple) (§3.16.6.2).
The following constraint defines relations appealed to elsewhere inthis specification.
xs:anyType
· and is validly·derived· fromBgivenS,as defined by this constraint.xs:anySimpleType
·.xs:anySimpleType
TheSimple Type Definition ofanySimpleTypeispresent in every schema. It has the following properties:
anySimpleType
'http://www.w3.org/2001/XMLSchema
'The definitionof·xs:anySimpleType
· is the root of the simple type definition hierarchy, and as such mediates between the other simple type definitions, which all eventually trace back to it via their{base type definition} properties, and·xs:anyType
·, which isits{base type definition}.
xs:anyAtomicType
TheSimple Type Definition ofanyAtomicTypeis present in every schema. It has the following properties:
anyAtomicType
'http://www.w3.org/2001/XMLSchema
'xs:error
ASimple Type Definition for·xs:error
· is present in every schema by definition. It has the following properties:
error
'http://www.w3.org/2001/XMLSchema
'xs:error
has no valid instances(i.e. it has an empty value space and an empty lexical space).This is a natural consequence of its construction: a value isa value of a union type if and only if it is a value of atleast one member of the{member type definitions} of the union. Sincexs:error
hasno member type definitions, there can be no values which arevalues of at least one of its member types. And since the valuespace is empty, the lexical space is also empty.xs:error
is expected to be usedmostly in conditional type assignment. Whenever it serves as the·governing· type definition for an attribute or element informationitem, that item will be invalid.Simple type definitions corresponding to all the built-in primitive datatypes, namelystring,boolean,float,double,decimal,dateTime,duration,time,date,gMonth,gMonthDay,gDay,gYear,gYearMonth,hexBinary,base64Binary,anyURI,QName andNOTATION (see thePrimitiveDatatypes section of[XML Schema: Datatypes]) are present by definition in every schemaas follows:
http://www.w3.org/2001/XMLSchema
'[as appropriate]
All conforming implementations of this specificationmust support all the primitive datatypes defined in[XML Schema: Datatypes]. It is·implementation-defined· whether additional primitive datatypes are supported, and whether, if so, they are automatically incorporated in every schema or not. If·implementation-defined· primitives are supported, the implementationmust satisfy the rules for·implementation-defined· primitive datatypes described in[XML Schema: Datatypes].
[Definition:] A type about which a processor possesses prior knowledge, and which the processor can support without any declaration of thetype being supplied by the user, is said to beautomatically knownto the processor.
Similarly, simple type definitions corresponding to all the other built-in datatypes (see theOther Built-in Datatypes sectionof[XML Schema: Datatypes]) are present by definition inevery schema, with properties as specified in[XML Schema: Datatypes] and asrepresented in XML inIllustrative XML representations for the built-in ordinary type definitions.
http://www.w3.org/2001/XMLSchema
'All conforming implementations of this specificationmust support all the built-in datatypes defined in[XML Schema: Datatypes]. It is·implementation-defined· whether additional derived types are·automatically known· to the implementation without declaration and whether, if so, they are automatically incorporated in every schema or not.
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>
At the abstract level, the schema itself is just a containerfor its components.
A schema is represented in XML by one or more·schema documents·, that is, one or more<schema> element information items. A·schema document· contains representations for a collection of schema components, e.g. type definitions and element declarations, which have a common{target namespace}. A·schema document· which has one or more<import> element information items corresponds to a schema with components with more than one{target namespace}, seeImport Constraints and Semantics (§4.2.6.2).
As always, the mapping rules given in this section apply after, not before, the appropriate·pre-processing·.
schema
Element Information Item et al.The<schema> element information item maps to aSchema component as follows.
<include>
) (§4.2.3)),<override> (seeOverriding component definitions (<override>
) (§4.2.5)),<redefine> (seeIncluding modified component definitions (<redefine>
) (§4.2.4)), and<import> (seeReferences to schema components across namespaces (<import>
) (§4.2.6)).Note that none of the attribute information items displayed above correspond directly to properties of schemas. TheblockDefault
,finalDefault
,attributeFormDefault
,elementFormDefault
andtargetNamespace
attributes are appealed to in the sub-sections above, as they provide global information applicable to many representation/component correspondences. The other attributes (id
andversion
) are for user convenience, and this specification defines no semantics for them.
The definition of the schema abstract data model inXSD Abstract Data Model (§2.2) makes clear that most components have a{target namespace}. Most components corresponding to representations within a given<schema> element information item will have a{target namespace} which corresponds to thetargetNamespace
attribute.
Since the empty string is not a legal namespace name, supplying an empty string fortargetNamespace
is incoherent, and isnot the same as not specifying it at all. The appropriate form of schema document corresponding to a·schema· whose components have no{target namespace} is one which has notargetNamespace
attribute specified at all.
Although the example schema at the beginning of this section might be a complete XML document,<schema>need not be the document element, but can appear within other documents.Indeed there is no requirement that a schema correspond to a (text) documentat all: it could correspond to an element information item constructed 'byhand', for instance via a DOM-conformant API.
Aside from<include> and<import>,which do not correspond directly to any schema component at all, eachof the element information items whichmay appear in the contentof<schema>corresponds to a schema component, and all except<annotation> arenamed. The sections below present each such item in turn, setting outthe components to which it corresponds.
Reference to schema components from a schema document is managed ina uniform way, whether the component corresponds to an elementinformation item from the same schema document or is imported(References to schema components across namespaces (<import>
) (§4.2.6)) from an external schema(whichmay, but need not, correspond to an actual schemadocument). The form of all such references is a·QName·.
[Definition:] AQName is aname with an optional namespace qualification, as defined in[XML Namespaces 1.1]. When used in connection with the XMLrepresentation of schema components or references to them, this refersto the simple typeQNameas defined in[XML Schema: Datatypes].For brevity, the term·QName·is also used to refer to·actual values· in the value space of theQName simple type, which areexpanded names with a[Definition:] local nameand a[Definition:] namespace name.
[Definition:] AnNCName isa name with no colon, as defined in[XML Namespaces 1.1]. When used in connection with the XMLrepresentation of schema components in this specification, this refersto the simple typeNCName as defined in[XML Schema: Datatypes].
[Definition:] A·QName· in a schema documentresolves to a component in a schema if and only if in the context of that schema the QName and the component together satisfy the ruleQName resolution (Schema Document) (§3.17.6.2). A·QName· in an input document, or a pair consisting of a local name and a namespace name,resolves to a component in a schema if and only if in the context of that schema the QName (or the name + namespace pair) and the component together satisfy the ruleQName resolution (Instance) (§3.17.6.3).
In each of the XMLrepresentation expositions in the following sections, an attribute is shown ashaving typeQName
if and only if it isinterpreted as referencing a schema component.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.example.com" targetNamespace="http://www.example.com"> . . . <xs:element name="elem1" type="Address"/> <xs:element name="elem2" type="xhtml:blockquote"/> <xs:attribute name="attr1" type="xsl:quantity"/> . . .</xs:schema>
<import>
) (§4.2.6) for a discussion of importing.The names of schema components such as type definitions and elementdeclarations are not of typeID: they are notunique within a schema, just within a symbol space. This means that simplefragment identifiers using these nameswill not work to reference schema components from outsidethe context of schema documents.
The preferred way to refer to schema components is to use[XML Schema: Component Designators], which defines a mechanism to designate schema components using thexscd()
[XPointer] scheme.
Alternatively, references to specificelement information items in the schema document can be interpreted as to theircorresponding schema documents. This can be done using mechanisms supported by[XPointer], for example, by using shorthand pointers.It is a matter for applications to specify whether they interpretthesereferences as being to the relevant element information item (i.e. withoutspecial recognition of the relation of schema documents to schema components) or as being to thecorresponding schema component.
targetNamespace
matches the sibling[schema namespace] property above (or whosetargetNamespace
was·absent· but that contributed components tothat namespace by being<include>d by a schema document with thattargetNamespace
as perAssembling a schema for a single target namespace from multiple schema definition documents (<include>
) (§4.2.3)):All schemas (seeSchemas as a Whole (§3.17))must satisfy the following constraint.
targetNamespace
[attribute].namespace
[attribute].targetNamespace
[attribute] of the<schema> element information item of the schema document containing the·QName·.namespace
[attribute] of some<import> element information item contained in the<schema> element information item of that schema document.http://www.w3.org/2001/XMLSchema
.http://www.w3.org/2001/XMLSchema-instance
.As the discussion above atSchema Component Details (§3) makes clear, at the level of schema components and·validation·, reference to components by name is normally not involved. In afew cases, however, qualified names appearing in information items being·validated·must be resolved to schema components by such lookup. The followingconstraint is appealed to in these cases.
This chapter defines the mechanisms by which this specification establishes the necessaryprecondition for·assessment·, namely access toone or more schemas. This chapter also sets out in detail the relationshipbetween schemas and namespaces, as well as mechanisms formodularization of schemas, including provision for incorporating definitionsand declarations from one schema in another, possibly with modifications.
Conformance (§2.4) describes three levels of conformance for schemaprocessors, andSchemas and Schema-validity Assessment (§5) provides a formal definition of·assessment·. This section sets outin detail the 3-layer architecture implied by the three conformance levels.The layersare:
Layer 1 specifies the manner in which a schema composed of schema componentscan be applied to in the·assessment· of an element information item. Layer 2 specifies the use of<schema>elements in XML documents as the standard XML representation forschema information in a broad range of computer systems and executionenvironments. To support interoperation over the World Wide Web in particular,layer 3 provides a set of conventions for schema reference on theWeb. Additional details on each of the three layers are provided in the sections below.
The fundamental purpose of the·assessment· core is to define·assessment· for a singleelement information item and its descendants, with respect to acomplex typedefinition. All processors are required to implement this core predicate in amanner which conforms exactly to this specification.
·Assessment· is defined with reference toan·XSD schema· (notenot a·schema document·).
As specified above, each schema component is associated directly orindirectly with a target namespace, or explicitly with no namespace. In the case of multi-namespace documents,components for more than one target namespace will co-exist in a schema.
Processors have the option to assemble (and perhaps to optimize orpre-compile) the entire schema prior to the start of an·assessment· episode, or togather the schema lazily as individual components are required. In allcases it is required that:
The obligation of a schema-aware processor as far as the·assessment·core is concerned is to implement one or more of the options for·assessment· given below inAssessing Schema-Validity (§5.2). Neither thechoice of element information item for that·assessment·, nor which of themeans of initiating·assessment· are used, is within the scope of this specification.
Although·assessment· is defined recursively, it is also intended to beimplementable in streamingprocessors. Such processorsmay choose to incrementally assemble the schema duringprocessing in response, for example, to encountering new namespaces. The implication of theinvariants expressed above is that such incremental assemblymustresult in an·assessment· outcome that is thesame as wouldbe given if·assessment· were undertaken againwith the final, fully assembled schema.
The sub-sections ofSchema Component Details (§3) define anXML representation for type definitions and element declarations and so on,specifying their target namespace and collecting them into schema documents.The following sections describe how toassemble a complete schema from multiple sources.
When a schema is assembled from multiple sources, those sources can include both·schema documents· and other sources of components. Several of the mechanisms described below allow a·schema document· to refer to a schema, either by giving the target namespace of its components, or indirectly, by referring to a·schema document· (and thus implicitly to the schema corresponding to that·schema document·).
The sections that follow appeal often to the following concepts.
xs:override
(§F.2); also written "override(E,D)".<redefine>
) (§4.2.4); also written "redefine(E,S)".xsi:schemaLocation
andxsi:noNamespaceSchemaLocation
attributes may validly appear on elements in an XML instance document. They are technicallyhints: conforming schema-aware processorsmay but need not attempt to dereference the schema documents named in these attributes and include the components described there in the schema used for validation.schemaLocation
attribute on the<import> element in a schema document is similarly a hint: a conforming schema-aware processormay but need not attempt to dereference the schema document named by the attribute.schemaLocation
attributes on the<include>,<override>, and<redefine> elements in a schema document, on the other hand, are not hints: conforming processorsmust attempt to de-reference the schema document named by the attribute. For non-empty<redefine> elements, it is an error for the attempt to fail; otherwise, the attemptmust be made but it is not an error for it to fail.Whenever a conforming XSD processor reads a·schema document· in order to include the components defined in it in a schema, it first performs on the schema document the pre-processing described in this section.
Every element in the·schema document· is examined to see whether any of the attributesvc:minVersion
,vc:maxVersion
,vc:typeAvailable
,vc:typeUnavailable
,vc:facetAvailable
, orvc:facetUnavailable
appear among its[attributes].
Where they appear, the attributesvc:minVersion
andvc:maxVersion
are treated as if declared with typexs:decimal
, and their·actual values· are compared to a decimal value representing the version of XSD supported by the processor (here represented as a variableV). For processors conforming to this version of this specification, the value ofV is 1.1.
IfV is less than the value ofvc:minVersion
, or ifV is greater than or equal to the value ofvc:maxVersion
, then the element on which the attribute appears is to be ignored, along with all its attributes and descendants. The effect is that portions of the schema document marked withvc:minVersion
and/orvc:maxVersion
are retained ifvc:minVersion
≤V <vc:maxVersion
.
Where they appear, the attributesvc:typeAvailable
andvc:typeUnavailable
are treated as if declared with typelist of xs:QName
, and the items in their·actual values· are checked to see whether they name types·automatically known· to the processor. The attributesvc:facetAvailable
andvc:facetUnavailable
are similarly typed, and checked to see if they name facets supported by the processor.
vc:typeAvailable
=T, where any item in the·actual value·T isnot theexpanded name of some type definition·automatically known· to the processorvc:typeUnavailable
=T, where every item in the·actual value·T is theexpanded name of some type definition·automatically known· to and supported by the processorvc:facetAvailable
=F, where any item in the·actual value·F is not theexpanded name of some facet known to and supported by the processorvc:facetUnavailable
=F, where every item in the·actual value·F is theexpanded name of some facet known to and supported by the processorvc:typeAvailable
etc. will be most useful in testing for·implementation-defined· primitive datatypes and facets, or for derived types for which the processor supplies a definition automatically. The rules just given do not, however, attempt to restrict their use to such tests. If thevc:typeAvailable
attribute is used with theexpanded name associated with one of the built-in primitive datatypes, the datatype will (in a conforming processor) always be available, so the test is unlikely to filter out any elements, ever, from the schema document. But such a usage is not in itself an error.xs:pattern
for thepattern facet.vc:typeAvailable
is the empty list (i.e.vc:typeAvailable=""
), then the corresponding element isnot ignored. (It does not list any type that is not available.) Conversely, if the·actual value· ofvc:typeUnavailable
is the empty list, then the corresponding element is ignored. Similar results hold forvc:facetAvailable
andvc:facetUnavailable
. The pre-processing of a schema documentS1 results in a second schema documentS2, identical toS1 except that all elements and attributes inS1 which are to be ignored are absent fromS2. We writeS2 =ci(S1). If the<schema>
element information item inS1 is to be ignored, thenS2 is identical toS1 except that any attributes other thantargetNamespace
,vc:minVersion
orvc:maxVersion
are removed from its[attributes], and its[children] is the empty sequence. It isS2, notS1, which is required to conform to this specification.
Except where conditional-inclusion pre-processing is explicitly mentioned, references to·schema documents· elsewhere in this specification invariably refer to the result of the pre-processing step described here, not to its input, which need not, and in the general case will not, always conform to the rules for schema documents laid out in this specification.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"> <xs:element name="e" vc:minVersion="3.2"> <!--* declaration suitable for 3.2 * and later processors *--> </xs:element> <xs:element name="e" vc:minVersion="1.1" vc:maxVersion="3.2"> <!--* declaration suitable for processors * supporting versions 1.1 through versions * up to (but not including) 3.2 *--> </xs:element> ...</xs:schema>
e
and thus violates clause2 of constraintSchema Properties Correct (§3.17.6.1), the pre-processing step described in this section filters out the first element declaration, making it possible for the resulting schema document to be valid and to conform to this specification.vc:maxVersion
attribute is "exclusive". This makes it easier for schema authors to use this feature without leaving gaps in the numeric ranges used to select version numbers.Suppose that a processor supports an·implementation-defined· primitive namedxpath_expression
in namespace "http://example.org/extension_types
", and is presented with the following schema document:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns:tns="http://example.org/extension_types" targetNamespace="http://example.org/extension_types" > <xs:element vc:typeAvailable="tns:xpath_expression" name="e" type="tns:xpath_expression" /> <xs:element vc:typeUnavailable="tns:xpath_expression" name="e" type="string" /></xs:schema>
The effect of conditional inclusion is to include the first declaration fore
and omit the second, so that the effective schema document, after pre-processing for conditional inclusion, is:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns:tns="http://example.org/extension_types" targetNamespace="http://example.org/extension_types" > <xs:element vc:typeAvailable="tns:xpath_expression" name="e" type="tns:xpath_expression" /></xs:schema>
A processor which does not support type "tns:xpath_expression", by contrast, will use the other declaration fore
: type in the namespace in question
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns:tns="http://example.org/extension_types" targetNamespace="http://example.org/extension_types" > <xs:element vc:typeUnavailable="tns:xpath_expression" name="e" type="string" /></xs:schema>
vc:minVersion
orvc:maxVersion
appears on an element information item in a·schema document·, its·initial value·must be locally·valid· with respect toxs:decimal
as perString Valid (§3.16.4).vc:typeAvailable
,vc:typeUnavailable
,vc:facetAvailable
, orvc:facetUnavailable
, appears on an element information item in a·schema document·, its·initial value·must be locally·valid· with respect to a simple type definition with{variety} =list and{item type definition} =xs:QName
, as perString Valid (§3.16.4).vc:
namespace that appears on an element information item in a·schema document·should be one of the attributes described elsewhere in this document (i.e. one ofvc:minVersion
,vc:maxVersion
,vc:typeAvailable
,vc:typeUnavailable
,vc:facetAvailable
, orvc:facetUnavailable
).vc:
attributes other than those named, but it is not an error for such attributes to appear in a·schema document·. The rule just given is formulated with a "should" and not a "must" in order to preserve the ability of future versions of this specification to add new attributes to the schema-versioning namespace.<include>
)Schema components for a single target namespace can be assembled from several·schema documents·, that is several<schema> element information items:
include
Element Information ItemA<schema> information itemmay contain any number of<include> elements. TheirschemaLocation
attributes, consisting of a URI reference, identify other·schema documents·, that is<schema> information items.
If two<include> elements specify the same schema location (after resolving relative URI references) then they refer to the same schema document. If they specify different schema locations, then they refer to different schema documents, unless the implementation is able to determine that the two URIs are references to the same resource.
If a·schema document·D1 contains one or more<include> elements, thenschema(D1) contains not onlyimmed(D1) but also all the components ofschema(D2), for each·schema document·D2 identified by an<include> element child ofD1. Such included schema documentsD2must either (a) have the sametargetNamespace
asD1, or (b) notargetNamespace
at all, in which case the components included inschema(D1) are not those ofschema(D2) itself, but instead those ofschema(chameleon(tns(D1),D2)), that is, the schema corresponding to the result of applying chameleon pre-processing toD2 to convert it to target namespacetns(D1).
schemaLocation
[attribute] successfully resolvesone or more of the following is true:application/xml
ortext/xml
with an XML declaration for preference, but this is not required), which in turn corresponds to a<schema> element information item in a well-formed information set.targetNamespace
[attribute], and its·actual value· is identical to the·actual value· of thetargetNamespace
[attribute] ofD1 (whichmust have such an[attribute]).targetNamespace
[attribute].targetNamespace
[attribute] (butD1 does).schemaLocation
[attribute] does not resolve successfully).targetNamespace
[attribute] toD2,whose value is the same as that of thetargetNamespace
[attribute] ofD1, and (b) updates all unqualifiedQName references so that their namespace names become the·actual value· of thetargetNamespace
[attribute].Implementations need not use the[XSLT 2.0]stylesheet given inTransformation for Chameleon Inclusion (§F.1), as long as an equivalent result is produced.In particular, different algorithms for generating a unique namespace prefixmay be used, even if they produce different results.targetNamespace
[attribute], but neitherB norC does, then the effect is as ifA includedB' andB' includedC', whereB' andC' are identical toB andC respectively, except that they both have atargetNamespace
[attribute] the same asA's.schemaLocation
[attribute] to fail to resolve at all,in which case the corresponding inclusionmust not be performed. Itis an error for it to resolve but the rest of clause 1above to fail to be satisfied. Failure to resolve is likelyto cause less than complete·assessment· outcomes, of course.If there is a sequence of schema documentsS1,S2, ...Sn, and a sequence of<include> elementsE1,E2, ...En, such that eachSi contains the correspondingEi, and eachEi (wherei <n) points to schema documentSi + 1, andEn points toS1 (i.e. if there is a cycle in the relation defined by the<include> element), then the same schema corresponds to all of the schema documentsS1, ...Sn in the cycle, and it includes the same components as the schema corresponding toS1 in the similar case whereSn has no<include> element pointing atS1.
<redefine>
)In order to provide some support for evolution and versioning, it ispossible to incorporate components corresponding to a schema documentwith modifications. The modifications have a pervasive impact,that is, only the redefined components are used, even when referenced fromother incorporated components, whether redefined themselves or not.
redefine
Element Information ItemA<schema> information itemmay contain any number of<redefine> elements. TheirschemaLocation
attributes, consisting of a URI reference, identify other·schema documents·, that is<schema> information items.
If a schema documentD1 contains a<redefine> elementE pointing to some schema documentD2, thenschema(D1) contains not only the components inimmed(D1), but also all the components (with the exception, in most cases, of the schema-as-a-whole component) ofredefine(E,schema(D2)). For any documentD2 pointed at by a<redefine> element inD1, itmust be the case either (a) thattns(D1) =tns(D2) or else (b) thattns(D2) is·absent·, in which caseschema(D1) includes notredefine(E,schema(D2)) itself butredefine(E,schema(chameleon(tns(D1),D2))). That is, the redefinition pre-processing is applied not to the schema corresponding toD2 but instead to the schema corresponding to the schema documentchameleon(tns(D1),D2), which is the result of applying chameleon pre-processing toD2 to convert it to target namespacetns(D1).
This mechanism is intended to provide a declarative and modular approach toschema modification, with functionality no different except in scope from whatwould be achieved by wholesale text copying and redefinition by editing. Inparticular redefining a type is not guaranteed to be side-effect free: it canhave unexpected impacts on other type definitions which are basedon the redefined one, even to the extent that some such definitions becomeill-formed.
v1.xsd: <xs:complexType name="personName"> <xs:sequence> <xs:element name="title" minOccurs="0"/> <xs:element name="forename" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:element name="addressee" type="personName"/>v2.xsd: <xs:redefine schemaLocation="v1.xsd"> <xs:complexType name="personName"> <xs:complexContent> <xs:extension base="personName"> <xs:sequence> <xs:element name="generation" minOccurs="0"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:redefine> <xs:element name="author" type="personName"/>
v2.xsd
has everything specifiedbyv1.xsd
, with thepersonName
type redefined, aswell as everything it specifies itself. According tothis schema, elements constrainedby thepersonName
typemay end with ageneration
element. This includes not only theauthor
element, but also theaddressee
element.schemaLocation
[attribute]must successfully resolve.schemaLocation
[attribute] successfully resolvesone or more of the following is true:targetNamespace
[attribute], and its·actual value· is identical to the·actual value· of thetargetNamespace
[attribute] ofD1 (whichmust have such an[attribute]).targetNamespace
[attribute].targetNamespace
[attribute] (butD1 does).restriction
orextension
among its grand-[children] the·actual value· of whosebase
[attribute]must be the same as the·actual value· of its ownname
attribute plus target namespace;ref
[attribute] is the same as the·actual value· of its ownname
attribute plus target namespace and that<group> does not have an<element> ancestor,thenall of the following are true:minOccurs
andmaxOccurs
[attribute] is1
(or·absent·).name
attributeplus target namespace successfully·resolves· to amodel group definition inS2.ref
[attribute] is the same as the·actual value· of its ownname
attribute plus target namespace,thenit has exactly one such group.name
attributeplus target namespace successfully·resolves· to anattribute group definition inS2.name
inthe<redefine>d schema document, as defined inSchema Component Details (§3), except that its{name} is·absent· and its{context} is the redefining component, as defined in clause1.2 below;ref
[attribute] whose·actual value· is the same as the item'sname
plus target namespace is·resolved·, a component which corresponds to the top-level definition item of that name and the appropriate kind inS2 is used.<override>
)The<redefine>
construct defined inIncluding modified component definitions (<redefine>
) (§4.2.4) is useful in schema evolution and versioning, when it is desirable to have some guaranteed restriction or extension relation between the old component and the redefined component. But there are occasions when the schema author simply wants to replace old components with new ones without any constraint. Also, existing XSD processors have implemented conflicting and non-interoperable interpretations of<redefine>, and the<redefine> construct is·deprecated·. The<override> construct defined in this section allows such unconstrained replacement.
override
Element Information ItemA<schema> information itemmay contain any number of<override> elements. TheirschemaLocation
attributes, consisting of a URI reference, identify ("point to") other·schema documents·, that is<schema> information items.
If a schema documentDnew contains an<override> elementE pointing to some schema documentDold, thenschema(Dnew) contains not only the components inimmed(Dnew), but also the components inschema(override(E,Dold)). For all such schema documentsDold, itmust be the case either (a) thattns(Dold) =tns(Dnew), or (b) thattns(Dold) is·absent·, in which caseschema(Dnew) contains not the components inschema(override(E,Dold)), but those inschema(override(E,chameleon(tns(Dnew),Dold))). That is, before the override pre-processsing is applied, chameleon pre-processing is applied toDold to convert it to target namespacetns(Dnew); the override pre-processing is applied to the result, namelychameleon(tns(Dnew),Dold).
include
andoverride
references among schema documents contains cycles. To guarantee termination, the algorithm must detect when it has reached closure, that is, when further computation will have no effect on the outcome. In particular, it is useful to recognize (a) that it is possible to terminate as soon as conflicting components have been generated (for example, two different type definitions with the same name), and (b) that whenoverride(E,D) (for someE andD) is equivalent toD, no new schema components will be contributed by further processing: this can be detected either by comparing the input and output of the override transformation using a comparator such as the[XPath 2.0]fn:deep-equal
function, or by observing the conditions that causeoverride(E,D) to be idempotent, for example the fact thatE is empty.The children of the<override> elementmay override any source declarations for·named· components which appear among the[children] of the<schema>,<redefine>, or<override> elements in the·target set· of the<override> element information item..
schemaLocation
attribute ofE.schemaLocation
attribute of any<override> element information item in a schema document contained in the·target set· ofE.schemaLocation
attribute of any<include> element information item in a schema document contained in the·target set· ofE.xs:override
(§F.2) translates both<override> and<include> elements into<override> elements. These<override> elements will, in turn, be handled by transforming their target schema documents. Since every schema document in the target set of the original<override> element is the target of either an<override> element or of an<include> element, it follows that the transformation described inTransformation forxs:override
(§F.2) will be applied to every schema document in the target set.xs:override
(§F.2) toD andE results in a schema document equivalent toD (e.g. when none of the[children] ofD, or of any<redefine> and<override> elements inD match any of the[children] ofE, except for the[children] ofE themselves), then the effect is the same as for a cyclic set of<include> references, or as for multiple inclusions of the same document (as described in the note at the end ofAssembling a schema for a single target namespace from multiple schema definition documents (<include>
) (§4.2.3)).The definitions within the<override> element itself arenot required to be similar in any way to the source declarations being overridden. Not all the source declarations of the overridden schema document need be overridden.
As this mechanism is very similar to<redefine>, many similar kinds of caution need to be taken in using<override>. Please refer toIncluding modified component definitions (<redefine>
) (§4.2.4) for details.
v1.xsd: <xs:complexType name="personName"> <xs:sequence> <xs:element name="firstName"/> <xs:element name="lastName"/> </xs:sequence> </xs:complexType> <xs:element name="addressee" type="personName"/>v2.xsd: <xs:override schemaLocation="v1.xsd"> <xs:complexType name="personName"> <xs:sequence> <xs:element name="givenName"/> <xs:element name="surname"/> </xs:sequence> </xs:complexType> </xs:override> <xs:element name="author" type="personName"/>
v1.xsd
has a complex type namedpersonName
with a sequence offirstName
andlastName
children. The schema corresponding tov2.xsd
overridespersonName
, by providing a different sequence of element children. All elements with thepersonName
type are now constrained to have the sequence ofgivenName
andsurname
. This includes not only theauthor
element, but also theaddressee
element.schemaLocation
[attribute] successfully resolvesone or more of the following is true:targetNamespace
[attribute], and its·actual value· is identical to the·actual value· of thetargetNamespace
[attribute] ofDnew (whichmust have such an[attribute]).targetNamespace
[attribute].targetNamespace
[attribute] (butDnew does).xs:override
(§F.2). ThenDold′ corresponds to a conforming schema (call itSold).<include>
) (§4.2.3).xs:override
(§F.2). ThenDold′ corresponds to a conforming schema (call itS2).<include>
) (§4.2.3).xs:override
(§F.2) is to makeDold′ identical toDold except that some elements inDold are replaced or modified, as described inTransformation forxs:override
(§F.2). Implementations do not have to use[XSLT 2.0] transformation, as long as the same result is produced.elementFormDefault
,attributeFormDefault
,blockDefault
,finalDefault
, and so on) are applied not in the context of the document containing the<override> (Dnew) but in the context of the document containing the original overridden declaration or definition (Dold). Unexpected results may be minimized if the children of an<override> are made independent of the document-level defaults by explicitly specifying the desired values for the properties in question.<redefine>
) (§4.2.4); import, as defined inReferences to schema components across namespaces (<import>
) (§4.2.6); and overriding, as defined in this section, that if the same schema document is both (a) included, imported, or redefined, and (b) non-vacuously overridden, or if the same schema document overridden twice in different ways, then the resulting schema will have duplicate and conflicting versions of some components and will not be conforming, just as if two different schema documents had been included, with different declarations for the same·named· components.<import>
)As described inXSD Abstract Data Model (§2.2), every top-level schema component is associated witha target namespace (or, explicitly, with none). Furthermore,each schema document carries on its<schema> elementat most onetargetNamespace
attribute associating that documentwith a target namespace. This section sets outthe syntax and mechanisms by which referencesmay be made from within a·schema document· to componentsoutside that document's targetnamespace. Also included within the same syntax is an optionalfacility for suggesting the URI of a·schema document· containing definitions and declarations for components from the foreign target namespace.
schemaLocation
attribute.Although the function of<import> isunchanged in this version, the presentation below has beenreorganized to clarify the two separate purposes served by<import>, namely(1) to license references, within a schema document, tocomponents in the imported namespace, and (2) to provide informationabout the location of schema documents for imported namespaces.import
Element Information ItemThe<import> element information item identifies namespacesused in external references, i.e. those whose·QName· identifies them as coming from adifferent namespace (or none) than the enclosing schema document'stargetNamespace
.
At least two conditions must be satisfied for areference to be made to a foreign component: (1)there must be ameans of addressing such foreign components, and(2) there must be a signal toschema-aware processors that a schema document contains suchreferences. The namespacemechanisms defined by[XML Namespaces 1.1]satisfy the first requirement by allowing foreign componentsto be addressed.(How those components are located is governed by theprocessor's strategies for locating schema componentsin a given namespace, in which theschemaLocation
attributeon the<import> element can play a role;see alsoTerminology of schema construction (§C.2).)The<import> element information itemservesto satisfy the second requirement, by identifying namespaces used in external componentreferences, i.e. those whose·QName· identifies them as coming from a namespace different from that of the enclosing schemadocument'stargetNamespace
. By contrast, a namespace used for other purposes in a schema document need not be imported.
<xs:import namespace="http://www.w3.org/1999/xhtml"/>(with the possible addition of a
schemaLocation
attributeand annotations). As just described, this explicit import makes it legitimate to refer to components in the XHTML namespace,as base type definitions, or from within content models.The·actual value· of thenamespace
[attribute] indicates that the containing schema documentmay containqualified references to schema components in that namespace (via one or moreprefixes declared with namespace declarations in the normal way). If thatattribute is absent, then the import allows unqualified reference to componentswith no target namespace.
It is a consequence of rules defined elsewherethat if references to components in a given namespaceNappear in a schema documentS,thenSmust contain an<import> elementimportingN.Otherwise, the references will fail to resolve; seeclause4 ofQName resolution (Schema Document) (§3.17.6.2).References in a schema document to foreign namespaces not importedby that schema document (or otherwise accounted for byQName resolution (Schema Document) (§3.17.6.2)) arenot"forward references" in the sense ofThe Mapping between XML Representations and Components (§3.1.3) and arenothandled as if they referred to"missing components" in the sense ofMissing Sub-components (§5.3).
Note that components to be imported need not be in the form of a·schema document· and need not in particular be declared in the particular schema document identified by aschemaLocation
attribute; the processoris free to access or construct components using means of its ownchoosing, whether or not aschemaLocation
hint is provided.
xhtml:p
.if there were no component reference, thenthe import would be unnecessary; no import is needed for use of a namespace in a<documentation> or similar schema document element or attribute name.<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml" targetNamespace="uri:mywork" xmlns:my="uri:mywork"> <xs:import namespace="http://www.w3.org/1999/xhtml"/> <xs:annotation> <xs:documentation> <!--* The XHTML 'p' element below requires us to define a prefix for the XHTML namespace, but it does NOT require us to import the XHTML namespace into the schema. The use of XHTML (or other) markup here is allowed by the lax wildcard in the schema for schema documents. *--> <xhtml:p>[Some documentation for my schema]</xhtml:p> </xs:documentation> </xs:annotation> . . . <xs:complexType name="myType"> <xs:sequence> <xs:element ref="xhtml:p" minOccurs="0"/> </xs:sequence> . . . </xs:complexType> <xs:element name="myElt" type="my:myType"/></xs:schema>
The·actual value· of theschemaLocation
attribute, if present onan<import> element, gives a hint as to where aserialization of a·schema document· with declarations and definitions for theimported namespace (or none) canpossibly be found. When noschemaLocation
[attribute] is present, the schema author is leaving theidentification of that schema to the instance, application or user,via the mechanisms described below inLayer 3: Schema Document Access and Web-interoperability (§4.3). When aschemaLocation
attribute is present, itmust contain a single URI reference which the schema author warrants will resolve to aserialization of a·schema document· containing definitions and declarations ofcomponent(s) in the<import>ed namespace.
Conformance profiles may further restrict the use of theschemaLocation
attribute. For example, one profile might mandate that the hint be honored by the schema software, perhaps calling for a processor-dependent error should the URI fail to resolve, or mandating that the hint agree with some expected URI value; another profile might mandate that the hint not be honored,etc.
namespace
andschemaLocation
[attribute] are optional, a bare<import/>
information itemis allowed. This simply allows unqualified reference to foreigncomponents with no target namespace without giving any hints as to where to find them.namespace
[attribute] is present,thenits·actual value· does not match the·actual value· of theenclosing<schema>'stargetNamespace
[attribute].namespace
[attribute] is not present,thenthe enclosing<schema> has atargetNamespace
[attribute]schemaLocation
andnamespace
[attributes]one of the followingmust be true:namespace
[attribute],thenits·actual value· is identical to the·actual value· of thetargetNamespace
[attribute] ofD2.schemaLocation
[attribute] is only a hint, it is opento applications to ignore all but the first<import> fora given namespace, regardless of the·actual value· ofschemaLocation
, but such a strategy risksmissing useful information when newschemaLocation
s areoffered.Layers 1 and 2 provide a framework for·assessment· and XML definition of schemas in abroad variety of environments. Over time, it is possible that a range of standards andconventions will evolve to supportinteroperability of XSD implementations on the World Wide Web.Layer 3 defines the minimum level of function required of allconformant processors operating on the Web: it is intended that, overtime, future standards (e.g. XML Packages) for interoperability on theWeb and in other environments can be introduced without the need torepublish this specification.
For interoperability, serialized·schema documents·, like all other Webresources,should be identified by URI andretrieved using the standard mechanisms of the Web (e.g. http, https,etc.) Such documents on the Webmust be part of XML documents (seeclause1.1 ofInclusion Constraints and Semantics (§4.2.3)), and are represented in the standard XMLschema definition form described by layer 2 (that is as<schema> element information items).
Accept
header ofapplication/xml,text/xml; q=0.9, */*
is perhaps a reasonable starting point.As described inLayer 1: Summary of the Schema-validity Assessment Core (§4.1), processors are responsible for providing theschema components (definitions and declarations) needed for·assessment·. Thissection introduces a set of conventions to facilitate interoperabilityfor instance and schema documents retrieved and processed from the Web.
targetNamespace
isidentical to thenamespace name, if any, of the element information item on which·assessment· is undertaken.The composition of the completeschema for use in·assessment· is discussed inLayer 2: Schema Documents, Namespaces and Composition (§4.2) above.The means used to locate appropriate schema document(s) are processor andapplication dependent, subject to the following requirements:
xsi:schemaLocation
andxsi:noNamespaceSchemaLocation
[attributes] are provided. The first recordsthe author's warrant with pairs of URI references (one for the namespace name, andone for a hint as to the location of a schema document defining names for thatnamespace name). The second similarly provides a URI reference as a hint as tothe location of a schema document with notargetNamespace
[attribute].xsi:schemaLocation
andxsi:noNamespaceSchemaLocation
[attributes].Schema processorsshould provide an option tocontrol whether they do so.It isnot an error for suchan attempt to fail, but failure may cause less than complete·assessment· outcomes.schemaLocation
hints in the input. Otherwise, the input document could circumvent the agreement and the consumer's validation of the input, by referring to an alternative schema for the same namespaces, which declares the input document schema-valid but which does not adhere to the prior agreement between the data source and the data consumer.schemaLocation
hints.schemaLocation
hints.schemaLocation
attributes on<include>,<redefine>,<override>, and<import> in schema documents, orxsi:schemaLocation
andxsi:noNamespaceSchemaLocation
attributes in instance documents) are dereferenced and the values are relative references, then the[base URI] of the[owner element]must be used to resolve the relative references.<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="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">
schemaLocation
can, but need not be identical to those actually qualifying the element within whose start tagit is found or its other attributes. For example, as above, all schema location information can be declared on the document elementof a document, if desired, regardless of where the namespaces are actually used.Improved or alternative conventions for Web interoperability canbe standardized in the future without reopening this specification. Forexample, the W3C is currently considering initiatives to standardize thepackaging of resources relating to particular documents and/or namespaces: thiswould be an addition to the mechanisms described here for layer 3. Thisarchitecture also facilitates innovation at layer 2: for example, it would bepossible in the future to define an additional standard for the representation ofschema components which allowed e.g. type definitions to be specified piece bypiece, rather than all at once.
The architecture of schema-aware processing allows for a richcharacterization of XML documents: schema validity is not a binarypredicate.
This specification distinguishes between errors in schemaconstruction and structure, on the one hand, and schema validationoutcomes, on the other.
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 processorsshould implement and document a strategy for assembling a schema, exploiting at least some if not all of the non-hard-coded methods outlined inTerminology of schema construction (§C.2), starting with the namespaces declared in the document whose·assessment· is being undertaken, and the·actual value·s of thexsi:schemaLocation
andxsi:noNamespaceSchemaLocation
[attributes] thereof, if any, along with any other information 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 subsections ofSchema Component Details (§3).
The 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 in the presence of errors, beyond the requirement that if there are errors in a schema, or in one or more schema documents used in constructing a schema, then a conforming processormust report the fact. However, any further operations performed in the presence of errors are outside the scope of this specification and are not·schema-validity assessment· as that term is defined here.
With a schema which satisfies the conditions expressed inErrors in Schema Construction and Structure (§5.1) above, the schema-validity of anelement or attributeinformation item (the·validation root·) can be assessed. Fiveprimary approaches to this are describedand given names here; conforming processorsmay but are not requiredto provide interfaces so that they can be invoked in ways consistent with any or all of these approaches.
xsi:type
), then·strictvalidation· is performed. If they donot identify any declaration or definition, then·lax assessment· isperformed.xsi:type
), then·strict· validation isperformed; if they do not identify any declaration ordefinition, then·lax assessment· is performed.[Definition:] The element or attribute information item at which·assessment· begins is called thevalidation root.
The outcome of schema-validityassessment will be manifest in the[validation attempted] and[validity] properties on the·validation root·, and if the·validation root·is an element information item then alsoon its[attributes] and[children], recursively, asdefined byAssessment Outcome (Element) (§3.3.5.1) andAssessment Outcome (Attribute) (§3.2.5.1). There is norequirement that input which is not schema-valid be rejected by anapplication. It is up to applications to decide whatconstitutes a successful outcome ofvalidation.
Note that every element and attribute information itemparticipating in the·assessment· willalso have a[validation context]property which refers back to the·validation root·.
At the beginning ofSchema Component Details (§3), attention is drawn to thefact that most kinds of schema components have properties which are described thereinas having other components, or sets of other components, as values, but thatwhen components are constructed on the basis of their correspondence withelement information items in schema documents, such properties usuallycorrespond toQNames, and the·resolution· of suchQNames can 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 attributeinformation item is being·validated· with respect to a component ofany kind any of whose properties has or contains such an·absent· value, the·validation· is modified,as following:
Because of the value specification for[validation attempted] inAssessment Outcome (Element) (§3.3.5.1), if this situation ever arises, thedocument as a whole cannot show a[validation attempted]offull.
References in aSimple Type Definition tounknown datatypes, or tounknown constraining facets, make the simple type definition unusable in ways similar to having·absent· property values. Often, such references will result in component properties with·absent· values, but not necessarily. In either case they, and likewise any types derived or constructed from them, are handled in the same way as described above for components with·absent· property values.
Schema-aware processors are responsible for processing XML documents,schemas and schema documents, as appropriate given the level of conformance(as defined inConformance (§2.4)) they support,consistently with the conditions set out above.
The XML representation of the schema for schema documents ispresented here as a normative part of the specification, and as anillustrative example of how the XML Schema Definition Language can define itselfusing its own constructs. The names of XSD types,elements, attributes and groups defined here are evocative of theirpurpose, but are occasionally verbose.
There is some annotation in comments, but a fuller annotation willrequire the use of embedded documentation facilities or a hyperlinkedexternal annotation for which tools are not yet readily available.
Like any other XML document, schemadocuments may carry XML and document type declarations. An XMLdeclaration and a document type declaration are provided here forconvenience. Since this schema document describes the XSDlanguage, thetargetNamespace
attribute on theschema
element refers to the XSD namespaceitself.
Schema documents conforming to this specification may be in XML1.0 or XML 1.1. Conforming implementations may accept input inXML 1.0 or XML 1.1 or both. SeeDependencies on Other Specifications (§1.4).
Independent copies of this material areavailable in an undated (mutable) version athttp://www.w3.org/2009/XMLSchema/XMLSchema.xsdand in a dated (immutable) version athttp://www.w3.org/2012/04/XMLSchema.xsd— the mutable version will be updated with future revisions of this specification, and the immutable one will not.
<?xml version='1.0'?><!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XSD 1.1//EN" "XMLSchema.dtd" [<!-- provide ID type information even for parsers which only read the internal subset --><!ATTLIST xs:schema id ID #IMPLIED><!ATTLIST xs:complexType id ID #IMPLIED><!ATTLIST xs:complexContent id ID #IMPLIED><!ATTLIST xs:simpleContent id ID #IMPLIED><!ATTLIST xs:extension id ID #IMPLIED><!ATTLIST xs:element id ID #IMPLIED><!ATTLIST xs:group id ID #IMPLIED> <!ATTLIST xs:all id ID #IMPLIED><!ATTLIST xs:choice id ID #IMPLIED><!ATTLIST xs:sequence id ID #IMPLIED><!ATTLIST xs:any id ID #IMPLIED><!ATTLIST xs:anyAttribute id ID #IMPLIED><!ATTLIST xs:attribute id ID #IMPLIED><!ATTLIST xs:attributeGroup id ID #IMPLIED><!ATTLIST xs:unique id ID #IMPLIED><!ATTLIST xs:key id ID #IMPLIED><!ATTLIST xs:keyref id ID #IMPLIED><!ATTLIST xs:selector id ID #IMPLIED><!ATTLIST xs:field id ID #IMPLIED><!ATTLIST xs:assert id ID #IMPLIED><!ATTLIST xs:include id ID #IMPLIED><!ATTLIST xs:import id ID #IMPLIED><!ATTLIST xs:redefine id ID #IMPLIED><!ATTLIST xs:override id ID #IMPLIED><!ATTLIST xs:notation id ID #IMPLIED>]><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xml:lang="EN" targetNamespace="http://www.w3.org/2001/XMLSchema" version="structures.xsd (rec-20120405)"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html"> The schema corresponding to this document is normative, with respect to the syntactic constraints it expresses in the XML Schema Definition Language. The documentation (within 'documentation' elements) below, is not normative, but rather highlights important aspects of the W3C Recommendation of which this is a part. See below (at the bottom of this document) for information about the revision and namespace-versioning policy governing this schema document. </xs:documentation> </xs:annotation> <xs:annotation> <xs:documentation> The simpleType element and all of its members are defined in datatypes.xsd</xs:documentation> </xs:annotation> <xs:include schemaLocation="datatypes.xsd"/> <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"> <xs:annotation> <xs:documentation> Get access to the xml: attribute groups for xml:lang as declared on 'schema' and 'documentation' below </xs:documentation> </xs:annotation> </xs:import> <xs:complexType name="openAttrs"> <xs:annotation> <xs:documentation> This type is extended by almost all schema types to allow attributes from other namespaces to be added to user schemas. </xs:documentation> </xs:annotation> <xs:complexContent> <xs:restriction base="xs:anyType"> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="annotated"> <xs:annotation> <xs:documentation> This type is extended by all types which allow annotation other than <schema> itself </xs:documentation> </xs:annotation> <xs:complexContent> <xs:extension base="xs:openAttrs"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="id" type="xs:ID"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:group name="composition"> <xs:choice> <xs:element ref="xs:include"/> <xs:element ref="xs:import"/> <xs:element ref="xs:redefine"/> <xs:element ref="xs:override"/> <xs:element ref="xs:annotation"/> </xs:choice> </xs:group> <xs:group name="schemaTop"> <xs:annotation> <xs:documentation> This group is for the elements which occur freely at the top level of schemas. All of their types are based on the "annotated" type by extension.</xs:documentation> </xs:annotation> <xs:choice> <xs:group ref="xs:redefinable"/> <xs:element ref="xs:element"/> <xs:element ref="xs:attribute"/> <xs:element ref="xs:notation"/> </xs:choice> </xs:group> <xs:group name="redefinable"> <xs:annotation> <xs:documentation> This group is for the elements which can self-redefine (see <redefine> below).</xs:documentation> </xs:annotation> <xs:choice> <xs:element ref="xs:simpleType"/> <xs:element ref="xs:complexType"/> <xs:element ref="xs:group"/> <xs:element ref="xs:attributeGroup"/> </xs:choice> </xs:group> <xs:simpleType name="formChoice"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> </xs:annotation> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="qualified"/> <xs:enumeration value="unqualified"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="reducedDerivationControl"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> </xs:annotation> <xs:restriction base="xs:derivationControl"> <xs:enumeration value="extension"/> <xs:enumeration value="restriction"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="derivationSet"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> <xs:documentation> #all or (possibly empty) subset of {extension, restriction}</xs:documentation> </xs:annotation> <xs:union> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="#all"/> </xs:restriction> </xs:simpleType> <xs:simpleType> <xs:list itemType="xs:reducedDerivationControl"/> </xs:simpleType> </xs:union> </xs:simpleType> <xs:simpleType name="typeDerivationControl"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> </xs:annotation> <xs:restriction base="xs:derivationControl"> <xs:enumeration value="extension"/> <xs:enumeration value="restriction"/> <xs:enumeration value="list"/> <xs:enumeration value="union"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="fullDerivationSet"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> <xs:documentation> #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation> </xs:annotation> <xs:union> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="#all"/> </xs:restriction> </xs:simpleType> <xs:simpleType> <xs:list itemType="xs:typeDerivationControl"/> </xs:simpleType> </xs:union> </xs:simpleType> <xs:element name="schema"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-schema"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:openAttrs"> <xs:sequence> <xs:group ref="xs:composition" minOccurs="0" maxOccurs="unbounded"/> <xs:sequence minOccurs="0"> <xs:element ref="xs:defaultOpenContent"/> <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:group ref="xs:schemaTop"/> <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:sequence> <xs:attribute name="targetNamespace" type="xs:anyURI"/> <xs:attribute name="version" type="xs:token"/> <xs:attribute name="finalDefault" type="xs:fullDerivationSet" default="" use="optional"/> <xs:attribute name="blockDefault" type="xs:blockSet" default="" use="optional"/> <xs:attribute name="attributeFormDefault" type="xs:formChoice" default="unqualified" use="optional"/> <xs:attribute name="elementFormDefault" type="xs:formChoice" default="unqualified" use="optional"/> <xs:attribute name="defaultAttributes" type="xs:QName"/> <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace" default="##local" use="optional"/> <xs:attribute name="id" type="xs:ID"/> <xs:attribute ref="xml:lang"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:key name="element"> <xs:selector xpath="xs:element"/> <xs:field xpath="@name"/> </xs:key> <xs:key name="attribute"> <xs:selector xpath="xs:attribute"/> <xs:field xpath="@name"/> </xs:key> <xs:key name="type"> <xs:selector xpath="xs:complexType|xs:simpleType"/> <xs:field xpath="@name"/> </xs:key> <xs:key name="group"> <xs:selector xpath="xs:group"/> <xs:field xpath="@name"/> </xs:key> <xs:key name="attributeGroup"> <xs:selector xpath="xs:attributeGroup"/> <xs:field xpath="@name"/> </xs:key> <xs:key name="notation"> <xs:selector xpath="xs:notation"/> <xs:field xpath="@name"/> </xs:key> <xs:key name="identityConstraint"> <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/> <xs:field xpath="@name"/> </xs:key> </xs:element> <xs:simpleType name="allNNI"> <xs:annotation> <xs:documentation> for maxOccurs</xs:documentation> </xs:annotation> <xs:union memberTypes="xs:nonNegativeInteger"> <xs:simpleType> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="unbounded"/> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> <xs:attributeGroup name="occurs"> <xs:annotation> <xs:documentation> for all particles</xs:documentation> </xs:annotation> <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" default="1" use="optional"/> <xs:attribute name="maxOccurs" type="xs:allNNI" default="1" use="optional"/> </xs:attributeGroup> <xs:attributeGroup name="defRef"> <xs:annotation> <xs:documentation> for element, group and attributeGroup, which both define and reference</xs:documentation> </xs:annotation> <xs:attribute name="name" type="xs:NCName"/> <xs:attribute name="ref" type="xs:QName"/> </xs:attributeGroup> <xs:group name="typeDefParticle"> <xs:annotation> <xs:documentation> 'complexType' uses this</xs:documentation> </xs:annotation> <xs:choice> <xs:element name="group" type="xs:groupRef"/> <xs:element ref="xs:all"/> <xs:element ref="xs:choice"/> <xs:element ref="xs:sequence"/> </xs:choice> </xs:group> <xs:group name="nestedParticle"> <xs:choice> <xs:element name="element" type="xs:localElement"/> <xs:element name="group" type="xs:groupRef"/> <xs:element ref="xs:choice"/> <xs:element ref="xs:sequence"/> <xs:element ref="xs:any"/> </xs:choice> </xs:group> <xs:group name="particle"> <xs:choice> <xs:element name="element" type="xs:localElement"/> <xs:element name="group" type="xs:groupRef"/> <xs:element ref="xs:all"/> <xs:element ref="xs:choice"/> <xs:element ref="xs:sequence"/> <xs:element ref="xs:any"/> </xs:choice> </xs:group> <xs:complexType name="attribute"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:sequence> <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/> </xs:sequence> <xs:attributeGroup ref="xs:defRef"/> <xs:attribute name="type" type="xs:QName"/> <xs:attribute name="use" default="optional" use="optional"> <xs:simpleType> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="prohibited"/> <xs:enumeration value="optional"/> <xs:enumeration value="required"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="default" type="xs:string"/> <xs:attribute name="fixed" type="xs:string"/> <xs:attribute name="form" type="xs:formChoice"/> <xs:attribute name="targetNamespace" type="xs:anyURI"/> <xs:attribute name="inheritable" type="xs:boolean"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="topLevelAttribute"> <xs:complexContent> <xs:restriction base="xs:attribute"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/> </xs:sequence> <xs:attribute name="ref" use="prohibited"/> <xs:attribute name="form" use="prohibited"/> <xs:attribute name="use" use="prohibited"/> <xs:attribute name="targetNamespace" use="prohibited"/> <xs:attribute name="name" type="xs:NCName" use="required"/> <xs:attribute name="inheritable" type="xs:boolean"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:group name="attrDecls"> <xs:sequence> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="attribute" type="xs:attribute"/> <xs:element name="attributeGroup" type="xs:attributeGroupRef"/> </xs:choice> <xs:element ref="xs:anyAttribute" minOccurs="0"/> </xs:sequence> </xs:group> <xs:element name="anyAttribute" > <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-anyAttribute"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:wildcard"> <xs:attribute name="notQName" type="xs:qnameListA" use="optional"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:group name="assertions"> <xs:sequence> <xs:element name="assert" type="xs:assertion" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:group> <xs:complexType name="assertion"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:attribute name="test" type="xs:string"/> <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:group name="complexTypeModel"> <xs:choice> <xs:element ref="xs:simpleContent"/> <xs:element ref="xs:complexContent"/> <xs:sequence> <xs:annotation> <xs:documentation> This branch is short for <complexContent> <restriction base="xs:anyType"> ... </restriction> </complexContent></xs:documentation> </xs:annotation> <xs:element ref="xs:openContent" minOccurs="0"/> <xs:group ref="xs:typeDefParticle" minOccurs="0"/> <xs:group ref="xs:attrDecls"/> <xs:group ref="xs:assertions"/> </xs:sequence> </xs:choice> </xs:group> <xs:complexType name="complexType" abstract="true"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:group ref="xs:complexTypeModel"/> <xs:attribute name="name" type="xs:NCName"> <xs:annotation> <xs:documentation> Will be restricted to required or prohibited</xs:documentation> </xs:annotation> </xs:attribute> <xs:attribute name="mixed" type="xs:boolean" use="optional"> <xs:annotation> <xs:documentation> Not allowed if simpleContent child is chosen. May be overridden by setting on complexContent child.</xs:documentation> </xs:annotation> </xs:attribute> <xs:attribute name="abstract" type="xs:boolean" default="false" use="optional"/> <xs:attribute name="final" type="xs:derivationSet"/> <xs:attribute name="block" type="xs:derivationSet"/> <xs:attribute name="defaultAttributesApply" type="xs:boolean" default="true" use="optional"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="topLevelComplexType"> <xs:complexContent> <xs:restriction base="xs:complexType"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:group ref="xs:complexTypeModel"/> </xs:sequence> <xs:attribute name="name" type="xs:NCName" use="required"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="localComplexType"> <xs:complexContent> <xs:restriction base="xs:complexType"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:group ref="xs:complexTypeModel"/> </xs:sequence> <xs:attribute name="name" use="prohibited"/> <xs:attribute name="abstract" use="prohibited"/> <xs:attribute name="final" use="prohibited"/> <xs:attribute name="block" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="restrictionType"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:sequence> <xs:choice minOccurs="0"> <xs:sequence> <xs:element ref="xs:openContent" minOccurs="0"/> <xs:group ref="xs:typeDefParticle"/> </xs:sequence> <xs:group ref="xs:simpleRestrictionModel"/> </xs:choice> <xs:group ref="xs:attrDecls"/> <xs:group ref="xs:assertions"/> </xs:sequence> <xs:attribute name="base" type="xs:QName" use="required"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="complexRestrictionType"> <xs:complexContent> <xs:restriction base="xs:restrictionType"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:choice minOccurs="0"> <xs:annotation> <xs:documentation>This choice is added simply to make this a valid restriction per the REC</xs:documentation> </xs:annotation> <xs:sequence> <xs:element ref="xs:openContent" minOccurs="0"/> <xs:group ref="xs:typeDefParticle"/> </xs:sequence> </xs:choice> <xs:group ref="xs:attrDecls"/> <xs:group ref="xs:assertions"/> </xs:sequence> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="extensionType"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:sequence> <xs:element ref="xs:openContent" minOccurs="0"/> <xs:group ref="xs:typeDefParticle" minOccurs="0"/> <xs:group ref="xs:attrDecls"/> <xs:group ref="xs:assertions"/> </xs:sequence> <xs:attribute name="base" type="xs:QName" use="required"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="complexContent"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-complexContent"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:choice> <xs:element name="restriction" type="xs:complexRestrictionType"/> <xs:element name="extension" type="xs:extensionType"/> </xs:choice> <xs:attribute name="mixed" type="xs:boolean"> <xs:annotation> <xs:documentation> Overrides any setting on complexType parent.</xs:documentation> </xs:annotation> </xs:attribute> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="openContent"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-openContent"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:sequence> <xs:element name="any" minOccurs="0" type="xs:wildcard"/> </xs:sequence> <xs:attribute name="mode" default="interleave" use="optional"> <xs:simpleType> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="none"/> <xs:enumeration value="interleave"/> <xs:enumeration value="suffix"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="defaultOpenContent"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-defaultOpenContent"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:sequence> <xs:element name="any" type="xs:wildcard"/> </xs:sequence> <xs:attribute name="appliesToEmpty" type="xs:boolean" default="false" use="optional"/> <xs:attribute name="mode" default="interleave" use="optional"> <xs:simpleType> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="interleave"/> <xs:enumeration value="suffix"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:complexType name="simpleRestrictionType"> <xs:complexContent> <xs:restriction base="xs:restrictionType"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:choice minOccurs="0"> <xs:annotation> <xs:documentation>This choice is added simply to make this a valid restriction per the REC</xs:documentation> </xs:annotation> <xs:group ref="xs:simpleRestrictionModel"/> </xs:choice> <xs:group ref="xs:attrDecls"/> <xs:group ref="xs:assertions"/> </xs:sequence> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="simpleExtensionType"> <xs:complexContent> <xs:restriction base="xs:extensionType"> <xs:sequence> <xs:annotation> <xs:documentation> No typeDefParticle group reference</xs:documentation> </xs:annotation> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:group ref="xs:attrDecls"/> <xs:group ref="xs:assertions"/> </xs:sequence> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:element name="simpleContent"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-simpleContent"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:choice> <xs:element name="restriction" type="xs:simpleRestrictionType"/> <xs:element name="extension" type="xs:simpleExtensionType"/> </xs:choice> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="complexType" type="xs:topLevelComplexType"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-complexType"/> </xs:annotation> </xs:element> <xs:simpleType name="blockSet"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> <xs:documentation> #all or (possibly empty) subset of {substitution, extension, restriction}</xs:documentation> </xs:annotation> <xs:union> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="#all"/> </xs:restriction> </xs:simpleType> <xs:simpleType> <xs:list> <xs:simpleType> <xs:restriction base="xs:derivationControl"> <xs:enumeration value="extension"/> <xs:enumeration value="restriction"/> <xs:enumeration value="substitution"/> </xs:restriction> </xs:simpleType> </xs:list> </xs:simpleType> </xs:union> </xs:simpleType> <xs:complexType name="element" abstract="true"> <xs:annotation> <xs:documentation> The element element can be used either at the top level to define an element-type binding globally, or within a content model to either reference a globally-defined element or type or declare an element-type binding locally. The ref form is not allowed at the top level.</xs:documentation> </xs:annotation> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:sequence> <xs:choice minOccurs="0"> <xs:element name="simpleType" type="xs:localSimpleType"/> <xs:element name="complexType" type="xs:localComplexType"/> </xs:choice> <xs:element name="alternative" type="xs:altType" minOccurs="0" maxOccurs="unbounded"/> <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attributeGroup ref="xs:defRef"/> <xs:attribute name="type" type="xs:QName"/> <xs:attribute name="substitutionGroup"> <xs:simpleType> <xs:list itemType="xs:QName"/> </xs:simpleType> </xs:attribute> <xs:attributeGroup ref="xs:occurs"/> <xs:attribute name="default" type="xs:string"/> <xs:attribute name="fixed" type="xs:string"/> <xs:attribute name="nillable" type="xs:boolean" use="optional"/> <xs:attribute name="abstract" type="xs:boolean" default="false" use="optional"/> <xs:attribute name="final" type="xs:derivationSet"/> <xs:attribute name="block" type="xs:blockSet"/> <xs:attribute name="form" type="xs:formChoice"/> <xs:attribute name="targetNamespace" type="xs:anyURI"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="topLevelElement"> <xs:complexContent> <xs:restriction base="xs:element"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:choice minOccurs="0"> <xs:element name="simpleType" type="xs:localSimpleType"/> <xs:element name="complexType" type="xs:localComplexType"/> </xs:choice> <xs:element name="alternative" type="xs:altType" minOccurs="0" maxOccurs="unbounded"/> <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="ref" use="prohibited"/> <xs:attribute name="form" use="prohibited"/> <xs:attribute name="targetNamespace" use="prohibited"/> <xs:attribute name="minOccurs" use="prohibited"/> <xs:attribute name="maxOccurs" use="prohibited"/> <xs:attribute name="name" type="xs:NCName" use="required"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="localElement"> <xs:complexContent> <xs:restriction base="xs:element"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:choice minOccurs="0"> <xs:element name="simpleType" type="xs:localSimpleType"/> <xs:element name="complexType" type="xs:localComplexType"/> </xs:choice> <xs:element name="alternative" type="xs:altType" minOccurs="0" maxOccurs="unbounded"/> <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="substitutionGroup" use="prohibited"/> <xs:attribute name="final" use="prohibited"/> <xs:attribute name="abstract" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:element name="element" type="xs:topLevelElement"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-element"/> </xs:annotation> </xs:element> <xs:complexType name="altType"> <xs:annotation> <xs:documentation> This type is used for 'alternative' elements. </xs:documentation> </xs:annotation> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:choice minOccurs="0"> <xs:element name="simpleType" type="xs:localSimpleType"/> <xs:element name="complexType" type="xs:localComplexType"/> </xs:choice> <xs:attribute name="test" type="xs:string" use="optional"/> <xs:attribute name="type" type="xs:QName" use="optional"/> <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="group" abstract="true"> <xs:annotation> <xs:documentation> group type for explicit groups, named top-level groups and group references</xs:documentation> </xs:annotation> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/> <xs:attributeGroup ref="xs:defRef"/> <xs:attributeGroup ref="xs:occurs"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="realGroup"> <xs:complexContent> <xs:restriction base="xs:group"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:choice minOccurs="0" maxOccurs="1"> <xs:element ref="xs:all"/> <xs:element ref="xs:choice"/> <xs:element ref="xs:sequence"/> </xs:choice> </xs:sequence> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="namedGroup"> <xs:complexContent> <xs:restriction base="xs:realGroup"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:choice minOccurs="1" maxOccurs="1"> <xs:element name="all"> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:all"> <xs:group ref="xs:allModel"/> <xs:attribute name="minOccurs" use="prohibited"/> <xs:attribute name="maxOccurs" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="choice" type="xs:simpleExplicitGroup"/> <xs:element name="sequence" type="xs:simpleExplicitGroup"/> </xs:choice> </xs:sequence> <xs:attribute name="name" type="xs:NCName" use="required"/> <xs:attribute name="ref" use="prohibited"/> <xs:attribute name="minOccurs" use="prohibited"/> <xs:attribute name="maxOccurs" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="groupRef"> <xs:complexContent> <xs:restriction base="xs:realGroup"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="ref" type="xs:QName" use="required"/> <xs:attribute name="name" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="explicitGroup"> <xs:annotation> <xs:documentation> group type for the three kinds of group</xs:documentation> </xs:annotation> <xs:complexContent> <xs:restriction base="xs:group"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="name" use="prohibited"/> <xs:attribute name="ref" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="simpleExplicitGroup"> <xs:complexContent> <xs:restriction base="xs:explicitGroup"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="minOccurs" use="prohibited"/> <xs:attribute name="maxOccurs" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:group name="allModel"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:annotation> <xs:documentation>This choice with min/max is here to avoid a pblm with the Elt:All/Choice/Seq Particle derivation constraint</xs:documentation> </xs:annotation> <xs:element name="element" type="xs:localElement"/> <xs:element ref="xs:any"/> <xs:element name="group"> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:groupRef"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="minOccurs" fixed="1" type="xs:nonNegativeInteger"/> <xs:attribute name="maxOccurs" fixed="1" type="xs:nonNegativeInteger"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element> </xs:choice> </xs:sequence> </xs:group> <xs:complexType name="all"> <xs:annotation> <xs:documentation> Only elements allowed inside</xs:documentation> </xs:annotation> <xs:complexContent> <xs:restriction base="xs:explicitGroup"> <xs:group ref="xs:allModel"/> <xs:attribute name="minOccurs" default="1" use="optional"> <xs:simpleType> <xs:restriction base="xs:nonNegativeInteger"> <xs:enumeration value="0"/> <xs:enumeration value="1"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="maxOccurs" default="1" use="optional"> <xs:simpleType> <xs:restriction base="xs:allNNI"> <xs:enumeration value="0"/> <xs:enumeration value="1"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:element name="all" type="xs:all"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-all"/> </xs:annotation> </xs:element> <xs:element name="choice" type="xs:explicitGroup"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-choice"/> </xs:annotation> </xs:element> <xs:element name="sequence" type="xs:explicitGroup"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-sequence"/> </xs:annotation> </xs:element> <xs:element name="group" type="xs:namedGroup"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-group"/> </xs:annotation> </xs:element> <xs:attributeGroup name="anyAttrGroup"> <xs:attribute name="namespace" type="xs:namespaceList" use="optional"/> <xs:attribute name="notNamespace" use="optional"> <xs:simpleType> <xs:restriction base="xs:basicNamespaceList"> <xs:minLength value="1"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="processContents" default="strict" use="optional"> <xs:simpleType> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="skip"/> <xs:enumeration value="lax"/> <xs:enumeration value="strict"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:attributeGroup> <xs:complexType name="wildcard"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:attributeGroup ref="xs:anyAttrGroup"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="any"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-any"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:wildcard"> <xs:attribute name="notQName" type="xs:qnameList" use="optional"/> <xs:attributeGroup ref="xs:occurs"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:annotation> <xs:documentation> simple type for the value of the 'namespace' attr of 'any' and 'anyAttribute'</xs:documentation> </xs:annotation> <xs:annotation> <xs:documentation> Value is ##any - - any non-conflicting WFXML/attribute at all ##other - - any non-conflicting WFXML/attribute from namespace other than targetNS ##local - - any unqualified non-conflicting WFXML/attribute one or - - any non-conflicting WFXML/attribute from more URI the listed namespaces references (space separated) ##targetNamespace or ##local may appear in the above list, to refer to the targetNamespace of the enclosing schema or an absent targetNamespace respectively</xs:documentation> </xs:annotation> <xs:simpleType name="namespaceList"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> </xs:annotation> <xs:union memberTypes="xs:specialNamespaceList xs:basicNamespaceList" /> </xs:simpleType> <xs:simpleType name="basicNamespaceList"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> </xs:annotation> <xs:list> <xs:simpleType> <xs:union memberTypes="xs:anyURI"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="##targetNamespace"/> <xs:enumeration value="##local"/> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> </xs:list> </xs:simpleType> <xs:simpleType name="specialNamespaceList"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> </xs:annotation> <xs:restriction base="xs:token"> <xs:enumeration value="##any"/> <xs:enumeration value="##other"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="qnameList"> <xs:annotation> <xs:documentation> A utility type, not for public use </xs:documentation> </xs:annotation> <xs:list> <xs:simpleType> <xs:union memberTypes="xs:QName"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="##defined"/> <xs:enumeration value="##definedSibling"/> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> </xs:list> </xs:simpleType> <xs:simpleType name="qnameListA"> <xs:annotation> <xs:documentation> A utility type, not for public use </xs:documentation> </xs:annotation> <xs:list> <xs:simpleType> <xs:union memberTypes="xs:QName"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="##defined"/> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> </xs:list> </xs:simpleType> <xs:simpleType name="xpathDefaultNamespace"> <xs:union memberTypes="xs:anyURI"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="##defaultNamespace"/> <xs:enumeration value="##targetNamespace"/> <xs:enumeration value="##local"/> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> <xs:element name="attribute" type="xs:topLevelAttribute"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-attribute"/> </xs:annotation> </xs:element> <xs:complexType name="attributeGroup" abstract="true"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:group ref="xs:attrDecls"/> <xs:attributeGroup ref="xs:defRef"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="namedAttributeGroup"> <xs:complexContent> <xs:restriction base="xs:attributeGroup"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:group ref="xs:attrDecls"/> </xs:sequence> <xs:attribute name="name" type="xs:NCName" use="required"/> <xs:attribute name="ref" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:complexType name="attributeGroupRef"> <xs:complexContent> <xs:restriction base="xs:attributeGroup"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> </xs:sequence> <xs:attribute name="ref" type="xs:QName" use="required"/> <xs:attribute name="name" use="prohibited"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:element name="attributeGroup" type="xs:namedAttributeGroup" > <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-attributeGroup"/> </xs:annotation> </xs:element> <xs:element name="include"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-include"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="redefine"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-redefine"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:openAttrs"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="xs:annotation"/> <xs:group ref="xs:redefinable"/> </xs:choice> <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/> <xs:attribute name="id" type="xs:ID"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="override"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-override"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:openAttrs"> <xs:sequence> <xs:element ref="xs:annotation" minOccurs="0"/> <xs:group ref="xs:schemaTop" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/> <xs:attribute name="id" type="xs:ID"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="import"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-import"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:attribute name="namespace" type="xs:anyURI"/> <xs:attribute name="schemaLocation" type="xs:anyURI"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="selector"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-selector"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:attribute name="xpath" use="required"> <xs:simpleType> <xs:annotation> <xs:documentation>A subset of XPath expressions for usein selectors</xs:documentation> <xs:documentation>A utility type, not for publicuse</xs:documentation> </xs:annotation> <xs:restriction base="xs:token"/> </xs:simpleType> </xs:attribute> <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="field"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-field"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:attribute name="xpath" use="required"> <xs:simpleType> <xs:annotation> <xs:documentation>A subset of XPath expressions for usein fields</xs:documentation> <xs:documentation>A utility type, not for publicuse</xs:documentation> </xs:annotation> <xs:restriction base="xs:token"/> </xs:simpleType> </xs:attribute> <xs:attribute name="xpathDefaultNamespace" type="xs:xpathDefaultNamespace"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:complexType name="keybase"> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:sequence minOccurs="0"> <xs:element ref="xs:selector"/> <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="name" type="xs:NCName"/> <xs:attribute name="ref" type="xs:QName"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:group name="identityConstraint"> <xs:annotation> <xs:documentation>The three kinds of identity constraints, all with type of or derived from 'keybase'. </xs:documentation> </xs:annotation> <xs:choice> <xs:element ref="xs:unique"/> <xs:element ref="xs:key"/> <xs:element ref="xs:keyref"/> </xs:choice> </xs:group> <xs:element name="unique" type="xs:keybase"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-unique"/> </xs:annotation> </xs:element> <xs:element name="key" type="xs:keybase"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-key"/> </xs:annotation> </xs:element> <xs:element name="keyref"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-keyref"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:keybase"> <xs:attribute name="refer" type="xs:QName"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:element name="notation"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-notation"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:annotated"> <xs:attribute name="name" type="xs:NCName" use="required"/> <xs:attribute name="public" type="xs:public"/> <xs:attribute name="system" type="xs:anyURI"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:simpleType name="public"> <xs:annotation> <xs:documentation> A utility type, not for public use</xs:documentation> <xs:documentation> A public identifier, per ISO 8879</xs:documentation> </xs:annotation> <xs:restriction base="xs:token"/> </xs:simpleType> <xs:element name="appinfo"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-appinfo"/> </xs:annotation> <xs:complexType mixed="true"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:any processContents="lax"/> </xs:sequence> <xs:attribute name="source" type="xs:anyURI"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:complexType> </xs:element> <xs:element name="documentation"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-documentation"/> </xs:annotation> <xs:complexType mixed="true"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:any processContents="lax"/> </xs:sequence> <xs:attribute name="source" type="xs:anyURI"/> <xs:attribute ref="xml:lang"/> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:complexType> </xs:element> <xs:element name="annotation"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#element-annotation"/> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="xs:openAttrs"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="xs:appinfo"/> <xs:element ref="xs:documentation"/> </xs:choice> <xs:attribute name="id" type="xs:ID"/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> <xs:annotation> <xs:documentation> notations for use within schema documents</xs:documentation> </xs:annotation> <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/> <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/> <xs:complexType name="anyType" mixed="true"> <xs:annotation> <xs:documentation> Not the real urType, but as close an approximation as we can get in the XML representation</xs:documentation> </xs:annotation> <xs:sequence> <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/> </xs:sequence> <xs:anyAttribute processContents="lax"/> </xs:complexType> <xs:annotation> <xs:documentation> In keeping with the XML Schema WG's standard versioning policy, the material in this schema document will persist at the URI http://www.w3.org/2012/04/XMLSchema.xsd. At the date of issue it can also be found at the URI http://www.w3.org/2009/XMLSchema/XMLSchema.xsd. The schema document at that URI may however change in the future, in order to remain compatible with the latest version of XSD and its namespace. In other words, if XSD or the XML Schema namespace change, the version of this document at http://www.w3.org/2009/XMLSchema/XMLSchema.xsd will change accordingly; the version at http://www.w3.org/2012/04/XMLSchema.xsd will not change. Previous dated (and unchanging) versions of this schema document include: http://www.w3.org/2012/01/XMLSchema.xsd (XSD 1.1 Proposed Recommendation) http://www.w3.org/2011/07/XMLSchema.xsd (XSD 1.1 Candidate Recommendation) http://www.w3.org/2009/04/XMLSchema.xsd (XSD 1.1 Candidate Recommendation) http://www.w3.org/2004/10/XMLSchema.xsd (XSD 1.0 Recommendation, Second Edition) http://www.w3.org/2001/05/XMLSchema.xsd (XSD 1.0 Recommendation, First Edition) </xs:documentation> </xs:annotation></xs:schema>
To facilitate consistent reporting of schema errors and·validation·failures, this section tabulates and provides unique names for all theconstraints listed in this document. Wherever such constraints have numberedparts, reportsshould use the name given below plus the part number, separatedby a period ('.'). Thus for examplecos-ct-extends.1.2
should beused to report a violation of the clause1.2 ofDerivation Valid (Extension) (§3.4.6.2).
This section defines some terms for use in describingchoices made by implementations in areas where the effect of XSD features is explicitly·implementation-defined·.
Future versions of this specification are expected to usethe terminology defined here to specify conformance profiles.Conformance profiles may also be defined by other specificationswithout requiring any revision to this specification.
This specification defines a number of ways in which theinformation set taken as input is augmented in the courseof schema-validity assessment. Conforming processorsmayprovide access to some or all of this information; in theinterests of simplifying discussion and documentation, thissection defines names for several subsets of the PSVI, withthe intention of simplifying short-hand descriptions ofprocessors. These termsmay be used to describe what parts ofthe PSVI a particular schema processor provides access to, orto specify requirements for processors, or for other purposes.A processor provides access to a particular subsetof the PSVI if and only if it makes accessible some representationof the information in question, for information items to whichit is applicable. (The properties labeled "if applicable"or "where applicable" below are simply the most obviouscases of properties which do not apply to every information item;the same qualification implicitly applies to all properties listedbelow.)
If other subsets of the PSVI prove important in practice it isexpected that definitions of those subsetsmay be provided byother specifications or in later revisions of this one.
The definition in this section of a term denoting a particularsubset of the PSVI does not constitute a requirement thatconforming processors provide access to that subset.
Conforming processorsmay implement any combination of thefollowing strategies for locating schema components, in anyorder. Theymay also implement other strategies.
The terminology offered here is intended to be useful indiscussions of processor behavior, whether documentingexisting behavior or describing required behavior.
General-purpose processorsshould support multiplemethods for locating schema documents, and provide usercontrol over which methods are used and how to fall back incase of failure.
rddl:resource
elements with the well-known propertyxlink:role
= "http://www.w3.org/2001/XMLSchema
"and then attempt to dereference the location(s) indicated on thexlink:href
attribute of the link.import
element, the processor attempts to dereference thoselocations.This section defines terms intended to be useful in describing other implementation-defined choices.
This specification requires as a precondition for·assessment· an information set as defined in[XML Infoset] which contains at least the following information items and properties:
In addition, infosetsshould support the[unparsed entities] property of the Document Information Item. Failure to do so will mean all items of typeENTITY orENTITIES will fail to·validate·. If the[unparsed entities] property is supported, the following is also required:
This specification does not require any destructive alterations to the inputinformation set: all the information set contributions specified herein are additive.
This appendix is intended to satisfy the requirements forConformance to the[XML Infoset] specification.
[Definition:] Animplementation-defined feature or behaviormay vary among processors conforming to this specification; the precise behavior is not specified by this specification butmust be specified by the implementor for each particular conforming implementation. (In the latter respect,·implementation-defined· features differ from·implementation-dependent· features.)
This appendix provides a summary of XSDfeatures whose effect is explicitly·implementation-defined·. Any software which claims to conform to this specificationmust describe how these choices have been exercised, indocumentation which accompanies any conformance claim.
In describing the choices made for a given processor, it is hoped that the terminology defined inTerminology for implementation-defined features (normative) (§C)will be found useful.
[Definition:] Animplementation-dependent feature or behaviormay vary among processors conforming to this specification; the precise behavior is not specified by this or any other W3C specification and is not required to be specified by the implementor for any particular implementation. (In the latter respect,·implementation-dependent· features differ from·implementation-defined· features.)
This appendix provides a summary of XSD features whose effect is explicitly·implementation-dependent·. Choices made by processors in these areas arenot required to be documented.
The transformations specified in the following sections in the form of[XSLT 2.0] stylesheets are used when assembling schemas from multiple schema documents. Implementations do not have to perform[XSLT 2.0] transformation, or use the stylesheets given here, as long as the same result is produced.
targetNamespace
[attribute] is included (Assembling a schema for a single target namespace from multiple schema definition documents (<include>
) (§4.2.3)), redefined (Including modified component definitions (<redefine>
) (§4.2.4)), or overridden (Overriding component definitions (<override>
) (§4.2.5)) by another<schema>D1 with atargetNamespace
[attribute], the following transformation, specified here as an[XSLT 2.0] stylesheet, is applied toD2 before its contents are mapped to schema components. The transformation performs two tasks:targetNamespace
[attribute] toD2, whose valueis the same as that of thetargetNamespace
[attribute] ofD1.targetNamespace
[attribute].<?xml version="1.0" encoding="UTF-8"?><xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:f="http://www.w3.org/2008/05/XMLSchema-misc" version="2.0"> <xsl:param name="newTargetNamespace" as="xs:anyURI" required="yes"/> <xsl:param name="prefixForTargetNamespace" as="xs:NCName" select="f:generateUniquePrefix(., 0)"/> <xsl:template match="@*|node()"> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> </xsl:template> <xsl:template match="xs:schema"> <xsl:copy> <xsl:namespace name="{$prefixForTargetNamespace}" select="$newTargetNamespace"/> <xsl:apply-templates select="@*"/> <xsl:attribute name="targetNamespace" select="$newTargetNamespace"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="xs:*/@ref | xs:*/@base | xs:*/@type | xs:schema/@defaultAttributes | xs:keyref/@refer | xs:list/@itemType"> <xsl:choose> <xsl:when test="namespace-uri-from-QName(resolve-QName(string(.), ..))=''"> <xsl:attribute name="{name()}" select="concat($prefixForTargetNamespace, ':', local-name-from-QName(resolve-QName(string(.), ..)))"/> </xsl:when> <xsl:otherwise> <xsl:copy/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="@memberTypes | @substitutionGroup"> <xsl:variable name="context" select=".."/> <xsl:variable name="values" as="xs:string+"> <xsl:for-each select="tokenize(., '\s+')"> <xsl:variable name="oldValue" select="resolve-QName(., $context)" as="xs:QName"/> <xsl:sequence select="if (namespace-uri-from-QName($oldValue) eq '') then concat($prefixForTargetNamespace, ':', local-name-from-QName($oldValue)) else string(.)"/> </xsl:for-each> </xsl:variable> <xsl:attribute name="{name()}" select="string-join($values, ' ')"/> </xsl:template> <xsl:template match="@notQName"> <xsl:variable name="context" select=".."/> <xsl:variable name="values" as="xs:string+"> <xsl:for-each select="tokenize(., '\s+')"> <xsl:variable name="oldValue" select="if (starts-with(.,'##')) then () else resolve-QName(., $context)" as="xs:QName?"/> <xsl:sequence select="if (starts-with(.,'##')) then string(.) else if ((namespace-uri-from-QName($oldValue) eq '') or empty(namespace-uri-from-QName($oldValue))) then concat($prefixForTargetNamespace, ':', local-name-from-QName($oldValue)) else string(.)"/> </xsl:for-each> </xsl:variable> <xsl:attribute name="{name()}" select="string-join($values, ' ')"/> </xsl:template> <xsl:function name="f:generateUniquePrefix" as="xs:NCName"> <xsl:param name="xsd"/> <xsl:param name="try" as="xs:integer"/> <xsl:variable name="disallowed" select="distinct-values($xsd//*/in-scope-prefixes(.))"/> <xsl:variable name="candidate" select="xs:NCName(concat('p', $try))"/> <xsl:sequence select="if ($candidate = $disallowed) then f:generateUniquePrefix($xsd, $try+1) else $candidate"/> </xsl:function> </xsl:transform>
xs:override
When a<schema> information itemD1 contains<override> elements, the transformation specified in the following[XSLT 2.0] stylesheet is performed once for each such<override> element. It requires as parameters (a) the<override> element inD1 (call itO1) as theoverrideElement
parameter and (b) the<schema> element of the schema documentD2 identified by theschemaLocation
attribute ofO1 as theoverriddenSchema
parameter. The transformation produces another<schema> elementD2′, which is equivalent toD2 except that some elements inD2 are replaced or modified.
The normative description of the transformation is given by the stylesheet below; the transformation can also be described (non-normatively) in prose as in the following paragraphs.
The[attributes] ofD2′ (for example,targetNamespace
anddefaultAttributes
) are copies of the[attributes] ofD2.
name
attribute,thenD2′ has a copy ofE1 in the location corresponding toE2's place inD2.schemaLocation
=E2.schemaLocation
and[children] which are copies of those ofO1.schemaLocation
=E2.schemaLocation
and[children] which are drawn from among the[children] ofE2 andO1, as specified bythe appropriatecase among the following:The base URI ofD2′ is the same as that ofD2.
xs:override
<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:f="http://www.w3.org/2008/05/XMLSchema-misc" exclude-result-prefixes="f"> <xsl:template name="perform-override"> <xsl:param name="overrideElement" as="element(xs:override)"/> <xsl:param name="overriddenSchema" as="element(xs:schema)"/> <xsl:result-document> <xsl:apply-templates select="$overriddenSchema"> <xsl:with-param name="overrideElement" select="$overrideElement"/> </xsl:apply-templates> </xsl:result-document> </xsl:template> <xsl:template match="xs:schema | xs:redefine" priority="5"> <xsl:param name="overrideElement"/> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates> <xsl:with-param name="overrideElement" select="$overrideElement"/> </xsl:apply-templates> </xsl:copy> </xsl:template> <xsl:template match="xs:import" priority="5"> <xsl:copy-of select="."/> </xsl:template> <!--* replace children of xs:schema, xs:redefine, * and xs:override which match children of * $overrideElement. Retain others. *--> <xsl:template match="xs:schema/* | xs:redefine/* | xs:override/*" priority="3"> <xsl:param name="overrideElement"/> <xsl:variable name="original" select="."/> <xsl:variable name="replacement" select="$overrideElement/* [node-name(.) = node-name($original) and f:componentName(.) = f:componentName($original)]"/> <xsl:copy-of select="($replacement, $original)[1]"/> </xsl:template> <!--* replace xs:include elements with overrides *--> <xsl:template match="xs:include" priority="5"> <xsl:param name="overrideElement"/> <xsl:element name="xs:override"> <xsl:copy-of select="@schemaLocation, $overrideElement/*"/> </xsl:element> </xsl:template> <!--* change xs:override elements: children which match * children of $overrideElement are replaced, others * are kept, and at the end all children of * $overrideElement not already inserted are added. *--> <xsl:template match="xs:override" priority="5"> <xsl:param name="overrideElement"/> <xsl:element name="xs:override"> <xsl:attribute name="schemaLocation"> <xsl:value-of select="@schemaLocation"/> </xsl:attribute> <xsl:apply-templates> <xsl:with-param name="overrideElement" select="$overrideElement"/> </xsl:apply-templates> <xsl:apply-templates select="$overrideElement/*" mode="copy-unmatched"> <xsl:with-param name="overrideElement" select="$overrideElement"/> <xsl:with-param name="overriddenOverride" select="."/> </xsl:apply-templates> </xsl:element> </xsl:template> <xsl:template match="*" mode="copy-unmatched"> <xsl:param name="overriddenOverride"/> <xsl:variable name="overriding" select="."/> <xsl:variable name="overridden" select="$overriddenOverride/*[ node-name(.) = node-name($overriding) and f:componentName(.) = f:componentName($overriding) ]"/> <xsl:choose> <xsl:when test="count($overridden) > 0"> <!--* do nothing; this element already copied *--> </xsl:when> <xsl:when test="count($overridden) = 0"> <!--* copy this element, it isn't already there *--> <xsl:copy-of select="."/> </xsl:when> </xsl:choose> </xsl:template> <xsl:function name="f:componentName" as="xs:QName"> <xsl:param name="component" as="element()"/> <xsl:sequence select=" QName($component/ancestor::xs:schema/@targetNamespace, $component/@name)"/> </xsl:function></xsl:transform>
use-when
attribute or to the C preprocessor#ifdef
construct. By means of thevc:minVersion
andvc:maxVersion
attributes, a simple forward-processing mechanism is supplied, so that conforming XSD 1.1 processors can successfully ignore constructs introduced in future versions (if any) of XSD, and so that schema authors can define schemas which use newer constructs when available but can fall back on older constructs when the newer constructs are not available.maxOccurs
may now be greater than 1 on particles in anall group. The elements which match a particular particle need not be adjacent in the input.all
-groupscan now be extended; the result is anall
-group(usually a larger one).<xs:all>
model groups. Such referencesmust haveminOccurs=maxOccurs=1
andmust refer to other<xs:all>
groups. (This change resolves issue 7031 XSD 1.1 doesn't support conversion of xs:sequence to xs:all because xs:all can't contain groups references.)report
element described in earlier drafts has been removed. This involves no loss of functionality: the same effect can be obtained by wrapping the test expression on an<assert> element in a negation.fn
namespace and constructors for all built-in types. This resolves issue6541 Assertions and in-scope functions.xs:anyType
· (first a restriction step,then an extension step, then a restriction step). Amisleading note about the purpose of this rule has beendeleted.mixed
attribute.xs:ID
. Elements have always been able to havemultiple children of typexs:ID
, but XSD 1.0 forbadmultiple attributes of this type for compatibilitywith XML DTDs. (Schemas intended to be translatable into DTDform should still avoid the practice.) This change should makeit easier for XML vocabularies to support both existingID attributes andxml:ID
.xs:IDREF
,xs:ENTITY
, orxs:ENTITIES
are now enforced on default values.xs:ID
may now havedefault or fixed values. XSD 1.0 had forbidden this, forcompatibility with XML DTDs.xs:ID
,xs:IDREF
,xs:IDREFS
,xs:ENTITY
, andxs:ENTITIES
apply not only to the built-in types themselves but also to types derived from them by restriction, list construction, union, and extension. This resolves issue10662 Should IDREFS and ENTITIES be magic types?.anyAtomicType
has been introduced into the typehierarchy betweenanySimpleType
and all theatomic built-in type definitions. SeeBuilt-in Simple Type Definitions (§3.16.7).xsi:type
may no longer be used, as in XSD 1.0, to subvert restrictions of union types.xs:anySimpleType
· agree in alldetails with those of[XML Schema: Datatypes].xs:anyType
· is its own base typehas been clarified (addresses issue6204 anyType/ur-Type: inconsistent whether it has a base-type).xs:error
· type for use in identifying conditionally assigned types which violate restriction rulesxml:lang
attribute and thus to the language ofthe element's contents. This change was introduced to resolve issue5003 Applicability of <alternative> element to xml:lang,raised by theW3C Internationalization Core Working Group.xsi:type
and other attributes in thenamespacehttp://www.w3.org/2001/XMLSchema-instance
, since theywill not be applied.defaultAttributes
attribute, which identifies anamedAttribute Group Definition; each complex type defined inthe schema document then automatically includes thatattribute group, unless this is overridden by thedefaultAttributesApply
attribute on the<complexType> element. Default attribute groupsmake it easier to specify attributes which should be acceptedby every complex type in a schema (e.g.xml:id
andxml:lang
).xsi:type
attribute appears on an element and has a QName as its value, but the QName does not resolve to a known type definition, the element is assigned a "fallback"·governing type definition· for validation. The·governing type definition· will be the·selected type definition· or the declared{type definition}, if available, and·xs:anyType
· otherwise. The validation process is now explicitly defined as including the validation of the element and its descendants; processors no longer have the implicit option of skipping the element and its descendants.xsi:type
attribute which does not·resolve· to a type definition, then thexsi:type
attribute is invalid.ref
attributes are now retained in the·post-schema-validation infoset· form of the containing element declaration. This change resolves issue6144 annotation on IDC with a 'ref' attribute is lost.xsi:schemaLocation
attribute providesinformation about a schema document location for aparticular namespace, it is no longer an error for it to beencountered after the first occurrence of an element orattribute information item in that namespace.Note, however, that if processing such anxsi:schemaLocation
attribute causes new components to be added to the schema, then the new components cannot change the assessment outcome of anyinformation items already seen before the element bearing thexsi:schemaLocation
attribute.schemaLocation
attributes in the instance document being validated; this resolvesissue5476 xsi:schemaLocation should be a hint, should be MAY not SHOULD.schemaLocation
information inHow schema definitions are located on the Web (§4.3.2) has been revised to try to make clearer the motivation for recommending user control over whether schema locations specified in the document instance should or should not be dereferenced. The new text describes some circumstances in which such schema locations typically should be dereferenced and some in which they should not, and attempts to set useful expectations for users and for implementors. These changes are intended to resolve issue6655, raised by the W3C Web Accessibility Initiative's Protocols and Formats Working Group.xs:anyType
·) is now required; in earlier drafts of this document, fallback to lax validation was optional.blockDefault="#all"
has been removed from the schema for schema documents; this change resolves issue6120 Reconsider blockDefault=#all.inheritable
attribute of thexs:attribute
element (resolving issue11070 DTD for schema documents: inheritable declared as %URIref).xs:group
within the named model groupxs:allModel
has been corrected to make the type ofxs:all
a legal restriction of its base type and make the schema for schema documents conformant to this specification. This resolves issue11092 Error in S4SD: complexType name="all" is not a valid restriction.xsi:type
attributes and their effect has been clarified inElement Locally Valid (Element) (§3.3.4.3). In particular, the revisions attempt to make clearer just what happens in cases where thexsi:type
attribute in the document instance cannot be used (because the type named is unknown, or otherwise not usable). This resolves issue11219 Editorial revision of Element Locally Valid (Element).xs:override
element are handled using theelementFormDefault
and other schema-document-level defaults from the schema document being overridden, not the schema document containing thexs:override
element. This resolves issue10652 xs:override and document-level defaults.It may be useful to mention some points where possible changes to the specification have been discussed, but on which no changes have, in the end, been made. In some cases, this resulted from the XML Schema Working Group's determination that no change was desirable; in other cases, there was no consensus on the desirability of change, or no consensus on what change should be made.
ID
,IDREF
,IDREFS
, andNOTATION
do not have the same effect on the base infoset as they do if declared in a DTD. (An infoset-to-infoset transformation can be used to migrate the appropriate information into the base infoset.)xs:ID
uniquely identify themselves, instead of uniquely identifying their parent. This version of this specification reaffirms the existing rule, which is that elements and attributes of typexs:ID
uniquely identify the parent element of the ID attribute or element.The listing below is for the benefit of readers of a printed version of thisdocument: it collects together all the definitions which appear in thedocument above.
xs:anyType
·, every·type definition· is, by construction,either a·restriction· or an·extension· of someother type definition. The exception·xs:anyType
· is a·restriction· of itself.With the exception of the loop on·xs:anyType
·, the graph of these relationships formsa tree known as theType DefinitionHierarchy with·xs:anyType
· as itsrootxs:anySimpleType
·, which is the·base type definition·of all the primitive datatypes.xs:anyType
·, whose name isanySimpleType in the XSD namespace, is the root of the·Type Definition Hierarchy· for all simple type definitions.·xs:anySimpleType
· has a lexical space containing all sequences of characters in the Universal Character Set (UCS) and a value space containing allatomic values and all finite-length lists ofatomic values.xs:anyType
· as defined inElement Locally Valid (Type) (§3.3.4.4), and the schema-validity ofE's[attributes] and[children] is assessed as described in clause2 and clause3 ofSchema-Validity Assessment (Element) (§3.3.4.6).xsi:nil
=true.#x9
(tab),#xA
(line feed) and#xD
(carriage return) are replaced with#x20
(space).#x20
s are collapsed to a single#x20
, and initial and/or final#x20
s are deleted.xs:anyType
·.true
andA.{type definition} =T.schemaLocation
attribute ofE.schemaLocation
attribute of any<override> element information item in a schema document contained in the·target set· ofE.schemaLocation
attribute of any<include> element information item in a schema document contained in the·target set· ofE.error
typehas no valid instances. It can be used in any place whereother types are normally used; in particular, it can be usedin conditional type assignment to cause elements which satisfycertain conditions to be invalid.The DTD for schema documents is given below. Note there isnoimplication here thatschema
must be the root element of adocument.
Independent copies of this material areavailable in an undated (mutable) version athttp://www.w3.org/2009/XMLSchema/XMLSchema.dtdand in a dated (immutable) version athttp://www.w3.org/2012/04/XMLSchema.dtd— the mutable version will be updated with future revisions of this specification, and the immutable one will not.
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 XSD namespace, is almost certainly not a valid schema document, with the exception of documents with multiple namespace prefixes for the XSD namespace itself. Accordinglyauthoring·schema documents· using this DTD and DTD-based authoring tools, andspecifying it as the DOCTYPE of documents intended to be·schema documents· and validating them with a validating XML parser, aresensible development strategies which users are encouraged to adoptuntil XSD-based authoring tools and validators are more widely available.
<!-- DTD for XML Schema Definition Language Part 1: Structures Public Identifier: "-//W3C//DTD XSD 1.1//EN" Official Location: http://www.w3.org/2009/XMLSchema/XMLSchema.dtd --><!-- Id: structures.dtd,v 1.1 2003/08/28 13:30:52 ht Exp --><!-- With the exception of cases with multiple namespace prefixes for the XSD namespace, any XML document which is not valid per this DTD given redefinitions in its internal subset of the 'p' and 's' parameter entities below appropriate to its namespace declaration of the XSD namespace is almost certainly not a valid schema document. --><!-- See below (at the bottom of this document) for information about the revision and namespace-versioning policy governing this DTD. --><!-- The simpleType element and its constituent parts are defined in XML Schema Definition Language Part 2: Datatypes --><!ENTITY % xs-datatypes PUBLIC '-//W3C//DTD XSD 1.1 Datatypes//EN' 'datatypes.dtd' ><!ENTITY % p 'xs:'> <!-- can be overridden in the internal subset of a schema document to establish a different namespace prefix --><!ENTITY % s ':xs'> <!-- if %p is defined (e.g. as foo:) then you must also define %s as the suffix for the appropriate namespace declaration (e.g. :foo) --><!ENTITY % nds 'xmlns%s;'><!-- Define all the element names, with optional prefix --><!ENTITY % schema "%p;schema"><!ENTITY % defaultOpenContent "%p;defaultOpenContent"><!ENTITY % complexType "%p;complexType"><!ENTITY % complexContent "%p;complexContent"><!ENTITY % openContent "%p;openContent"><!ENTITY % simpleContent "%p;simpleContent"><!ENTITY % extension "%p;extension"><!ENTITY % element "%p;element"><!ENTITY % alternative "%p;alternative"><!ENTITY % unique "%p;unique"><!ENTITY % key "%p;key"><!ENTITY % keyref "%p;keyref"><!ENTITY % selector "%p;selector"><!ENTITY % field "%p;field"><!ENTITY % group "%p;group"><!ENTITY % all "%p;all"><!ENTITY % choice "%p;choice"><!ENTITY % sequence "%p;sequence"><!ENTITY % any "%p;any"><!ENTITY % anyAttribute "%p;anyAttribute"><!ENTITY % attribute "%p;attribute"><!ENTITY % attributeGroup "%p;attributeGroup"><!ENTITY % include "%p;include"><!ENTITY % import "%p;import"><!ENTITY % redefine "%p;redefine"><!ENTITY % override "%p;override"><!ENTITY % notation "%p;notation"><!ENTITY % assert "%p;assert"><!-- annotation elements --><!ENTITY % annotation "%p;annotation"><!ENTITY % appinfo "%p;appinfo"><!ENTITY % documentation "%p;documentation"><!-- Customisation entities for the ATTLIST of each element type. Define one of these if your schema takes advantage of the anyAttribute='##other' in the schema for schema documents --><!ENTITY % schemaAttrs ''><!ENTITY % defaultOpenContentAttrs ''><!ENTITY % complexTypeAttrs ''><!ENTITY % complexContentAttrs ''><!ENTITY % openContentAttrs ''><!ENTITY % simpleContentAttrs ''><!ENTITY % extensionAttrs ''><!ENTITY % elementAttrs ''><!ENTITY % groupAttrs ''><!ENTITY % allAttrs ''><!ENTITY % choiceAttrs ''><!ENTITY % sequenceAttrs ''><!ENTITY % anyAttrs ''><!ENTITY % anyAttributeAttrs ''><!ENTITY % attributeAttrs ''><!ENTITY % attributeGroupAttrs ''><!ENTITY % uniqueAttrs ''><!ENTITY % keyAttrs ''><!ENTITY % keyrefAttrs ''><!ENTITY % selectorAttrs ''><!ENTITY % fieldAttrs ''><!ENTITY % assertAttrs ''><!ENTITY % includeAttrs ''><!ENTITY % importAttrs ''><!ENTITY % redefineAttrs ''><!ENTITY % overrideAttrs ''><!ENTITY % notationAttrs ''><!ENTITY % annotationAttrs ''><!ENTITY % appinfoAttrs ''><!ENTITY % documentationAttrs ''><!ENTITY % complexDerivationSet "CDATA"> <!-- #all or space-separated list drawn from derivationChoice --><!ENTITY % blockSet "CDATA"> <!-- #all or space-separated list drawn from derivationChoice + 'substitution' --><!ENTITY % composition '%include; | %import; | %override; | %redefine;'><!ENTITY % mgs '%all; | %choice; | %sequence;'><!ENTITY % cs '%choice; | %sequence;'><!ENTITY % formValues '(qualified|unqualified)'><!ENTITY % attrDecls '((%attribute;| %attributeGroup;)*,(%anyAttribute;)?)'><!ENTITY % assertions '(%assert;)*'><!ENTITY % particleAndAttrs '(%openContent;?, (%mgs; | %group;)?, %attrDecls;, %assertions;)'><!-- This is used in part2 --><!ENTITY % restriction1 '(%openContent;?, (%mgs; | %group;)?)'>%xs-datatypes;<!-- the duplication below is to produce an unambiguous content model which allows annotation everywhere --><!ELEMENT %schema; ((%composition; | %annotation;)*, (%defaultOpenContent;, (%annotation;)*)?, ((%simpleType; | %complexType; | %element; | %attribute; | %attributeGroup; | %group; | %notation; ), (%annotation;)*)* )><!ATTLIST %schema; targetNamespace %URIref; #IMPLIED version CDATA #IMPLIED %nds; %URIref; #FIXED 'http://www.w3.org/2001/XMLSchema' xmlns CDATA #IMPLIED finalDefault %complexDerivationSet; '' blockDefault %blockSet; '' id ID #IMPLIED elementFormDefault %formValues; 'unqualified' attributeFormDefault %formValues; 'unqualified' defaultAttributes CDATA #IMPLIED xpathDefaultNamespace CDATA '##local' xml:lang CDATA #IMPLIED %schemaAttrs;><!-- Note the xmlns declaration is NOT in the schema for schema documents, because at the Infoset level where schemas operate, xmlns(:prefix) is NOT an attribute! --><!-- The declaration of xmlns is a convenience for schema authors --> <!-- The id attribute here and below is for use in external references from non-schemas using simple fragment identifiers. It is NOT used for schema-to-schema reference, internal or external. --><!ELEMENT %defaultOpenContent; ((%annotation;)?, %any;)><!ATTLIST %defaultOpenContent; appliesToEmpty (true|false) 'false' mode (interleave|suffix) 'interleave' id ID #IMPLIED %defaultOpenContentAttrs;><!-- a type is a named content type specification which allows attribute declarations--><!-- --><!ELEMENT %complexType; ((%annotation;)?, (%simpleContent;|%complexContent;| %particleAndAttrs;))><!ATTLIST %complexType; name %NCName; #IMPLIED id ID #IMPLIED abstract %boolean; #IMPLIED final %complexDerivationSet; #IMPLIED block %complexDerivationSet; #IMPLIED mixed (true|false) 'false' defaultAttributesApply %boolean; 'true' %complexTypeAttrs;><!-- particleAndAttrs is shorthand for a root type --><!-- mixed is disallowed if simpleContent, overridden if complexContent has one too. --><!-- If anyAttribute appears in one or more referenced attributeGroups and/or explicitly, the intersection of the permissions is used --><!ELEMENT %complexContent; ((%annotation;)?, (%restriction;|%extension;))><!ATTLIST %complexContent; mixed (true|false) #IMPLIED id ID #IMPLIED %complexContentAttrs;><!ELEMENT %openContent; ((%annotation;)?, (%any;)?)><!ATTLIST %openContent; mode (none|interleave|suffix) 'interleave' id ID #IMPLIED %openContentAttrs;><!-- restriction should use the branch defined above, not the simple one from part2; extension should use the full model --><!ELEMENT %simpleContent; ((%annotation;)?, (%restriction;|%extension;))><!ATTLIST %simpleContent; id ID #IMPLIED %simpleContentAttrs;><!-- restriction should use the simple branch from part2, not the one defined above; extension should have no particle --><!ELEMENT %extension; ((%annotation;)?, (%particleAndAttrs;))><!ATTLIST %extension; base %QName; #REQUIRED id ID #IMPLIED %extensionAttrs;><!-- an element is declared by either: a name and a type (either nested or referenced via the type attribute) or a ref to an existing element declaration --><!ELEMENT %element; ((%annotation;)?, (%complexType;| %simpleType;)?, (%alternative;)*, (%unique; | %key; | %keyref;)*)><!-- simpleType or complexType only if no type|ref attribute --><!-- ref not allowed at top level --><!ATTLIST %element; name %NCName; #IMPLIED id ID #IMPLIED ref %QName; #IMPLIED type %QName; #IMPLIED minOccurs %nonNegativeInteger; #IMPLIED maxOccurs CDATA #IMPLIED nillable %boolean; #IMPLIED substitutionGroup %QName; #IMPLIED abstract %boolean; #IMPLIED final %complexDerivationSet; #IMPLIED block %blockSet; #IMPLIED default CDATA #IMPLIED fixed CDATA #IMPLIED form %formValues; #IMPLIED targetNamespace %URIref; #IMPLIED %elementAttrs;><!-- type and ref are mutually exclusive. name and ref are mutually exclusive, one is required --><!-- In the absence of type AND ref, type defaults to type of substitutionGroup, if any, else xs:anyType, i.e. unconstrained --><!-- default and fixed are mutually exclusive --><!ELEMENT %alternative; ((%annotation;)?, (%simpleType; | %complexType;)?) ><!ATTLIST %alternative; test CDATA #IMPLIED type %QName; #IMPLIED xpathDefaultNamespace CDATA #IMPLIED id ID #IMPLIED ><!ELEMENT %group; ((%annotation;)?,(%mgs;)?)><!ATTLIST %group; name %NCName; #IMPLIED ref %QName; #IMPLIED minOccurs %nonNegativeInteger; #IMPLIED maxOccurs CDATA #IMPLIED id ID #IMPLIED %groupAttrs;><!ELEMENT %all; ((%annotation;)?, (%element;| %group;| %any;)*)><!ATTLIST %all; minOccurs (0 | 1) #IMPLIED maxOccurs (0 | 1) #IMPLIED id ID #IMPLIED %allAttrs;><!ELEMENT %choice; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)><!ATTLIST %choice; minOccurs %nonNegativeInteger; #IMPLIED maxOccurs CDATA #IMPLIED id ID #IMPLIED %choiceAttrs;><!ELEMENT %sequence; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)><!ATTLIST %sequence; minOccurs %nonNegativeInteger; #IMPLIED maxOccurs CDATA #IMPLIED id ID #IMPLIED %sequenceAttrs;><!-- an anonymous grouping in a model, or a top-level named group definition, or a reference to same --><!ELEMENT %any; (%annotation;)?><!ATTLIST %any; namespace CDATA #IMPLIED notNamespace CDATA #IMPLIED notQName CDATA '' processContents (skip|lax|strict) 'strict' minOccurs %nonNegativeInteger; '1' maxOccurs CDATA '1' id ID #IMPLIED %anyAttrs;><!-- namespace is interpreted as follows: ##any - - any non-conflicting WFXML at all ##other - - any non-conflicting WFXML from namespace other than targetNamespace ##local - - any unqualified non-conflicting WFXML/attribute one or - - any non-conflicting WFXML from more URI the listed namespaces references ##targetNamespace ##local may appear in the above list, with the obvious meaning --><!-- notNamespace is interpreted as follows: ##local - - any unqualified non-conflicting WFXML/attribute one or - - any non-conflicting WFXML from more URI the listed namespaces references ##targetNamespace ##local may appear in the above list, with the obvious meaning --><!ELEMENT %anyAttribute; (%annotation;)?><!ATTLIST %anyAttribute; namespace CDATA #IMPLIED notNamespace CDATA #IMPLIED notQName CDATA '' processContents (skip|lax|strict) 'strict' id ID #IMPLIED %anyAttributeAttrs;><!-- namespace and notNamespace are interpreted as for 'any' above --><!-- simpleType only if no type|ref attribute --><!-- ref not allowed at top level, name iff at top level --><!ELEMENT %attribute; ((%annotation;)?, (%simpleType;)?)><!ATTLIST %attribute; name %NCName; #IMPLIED id ID #IMPLIED ref %QName; #IMPLIED type %QName; #IMPLIED use (prohibited|optional|required) #IMPLIED default CDATA #IMPLIED fixed CDATA #IMPLIED form %formValues; #IMPLIED targetNamespace %URIref; #IMPLIED inheritable %boolean; #IMPLIED %attributeAttrs;><!-- type and ref are mutually exclusive. name and ref are mutually exclusive, one is required --><!-- default for use is optional when nested, none otherwise --><!-- default and fixed are mutually exclusive --><!-- type attr and simpleType content are mutually exclusive --><!-- an attributeGroup is a named collection of attribute decls, or a reference thereto --><!ELEMENT %attributeGroup; ((%annotation;)?, (%attribute; | %attributeGroup;)*, (%anyAttribute;)?) ><!ATTLIST %attributeGroup; name %NCName; #IMPLIED id ID #IMPLIED ref %QName; #IMPLIED %attributeGroupAttrs;><!-- ref iff no content, no name. ref iff not top level --><!-- better reference mechanisms --><!ELEMENT %unique; ((%annotation;)?, %selector;, (%field;)+)><!ATTLIST %unique; name %NCName; #IMPLIED ref %QName; #IMPLIED id ID #IMPLIED %uniqueAttrs;><!ELEMENT %key; ((%annotation;)?, %selector;, (%field;)+)><!ATTLIST %key; name %NCName; #IMPLIED ref %QName; #IMPLIED id ID #IMPLIED %keyAttrs;><!ELEMENT %keyref; ((%annotation;)?, %selector;, (%field;)+)><!ATTLIST %keyref; name %NCName; #IMPLIED ref %QName; #IMPLIED refer %QName; #IMPLIED id ID #IMPLIED %keyrefAttrs;><!ELEMENT %selector; ((%annotation;)?)><!ATTLIST %selector; xpath %XPathExpr; #REQUIRED xpathDefaultNamespace CDATA #IMPLIED id ID #IMPLIED %selectorAttrs;><!ELEMENT %field; ((%annotation;)?)><!ATTLIST %field; xpath %XPathExpr; #REQUIRED xpathDefaultNamespace CDATA #IMPLIED id ID #IMPLIED %fieldAttrs;><!-- co-constraint assertions --><!ELEMENT %assert; ((%annotation;)?)><!ATTLIST %assert; test %XPathExpr; #REQUIRED id ID #IMPLIED xpathDefaultNamespace CDATA #IMPLIED %assertAttrs;><!-- Schema combination mechanisms --><!ELEMENT %include; (%annotation;)?><!ATTLIST %include; schemaLocation %URIref; #REQUIRED id ID #IMPLIED %includeAttrs;><!ELEMENT %import; (%annotation;)?><!ATTLIST %import; namespace %URIref; #IMPLIED schemaLocation %URIref; #IMPLIED id ID #IMPLIED %importAttrs;><!ELEMENT %redefine; (%annotation; | %simpleType; | %complexType; | %attributeGroup; | %group;)*><!ATTLIST %redefine; schemaLocation %URIref; #REQUIRED id ID #IMPLIED %redefineAttrs;><!ELEMENT %override; ((%annotation;)?, ((%simpleType; | %complexType; | %group; | %attributeGroup;) | %element; | %attribute; | %notation;)*)><!ATTLIST %override; schemaLocation %URIref; #REQUIRED id ID #IMPLIED %overrideAttrs;><!ELEMENT %notation; (%annotation;)?><!ATTLIST %notation; name %NCName; #REQUIRED id ID #IMPLIED public CDATA #REQUIRED system %URIref; #IMPLIED %notationAttrs;><!-- Annotation is either application information or documentation --><!-- By having these here they are available for datatypes as well as all the structures elements --><!ELEMENT %annotation; (%appinfo; | %documentation;)*><!ATTLIST %annotation; %annotationAttrs;><!-- User must define annotation elements in internal subset for this to work --><!ELEMENT %appinfo; ANY> <!-- too restrictive --><!ATTLIST %appinfo; source %URIref; #IMPLIED id ID #IMPLIED %appinfoAttrs;><!ELEMENT %documentation; ANY> <!-- too restrictive --><!ATTLIST %documentation; source %URIref; #IMPLIED id ID #IMPLIED xml:lang CDATA #IMPLIED %documentationAttrs;><!NOTATION XMLSchemaStructures PUBLIC 'structures' 'http://www.w3.org/2001/XMLSchema.xsd' ><!NOTATION XML PUBLIC 'REC-xml-1998-0210' 'http://www.w3.org/TR/1998/REC-xml-19980210' ><!-- In keeping with the XML Schema WG's standard versioning policy, this DTD will persist at the URI http://www.w3.org/2012/04/XMLSchema.dtd. At the date of issue it can also be found at the URI http://www.w3.org/2009/XMLSchema/XMLSchema.dtd. The schema document at that URI may however change in the future, in order to remain compatible with the latest version of XSD and its namespace. In other words, if XSD or the XML Schema namespace change, the version of this document at http://www.w3.org/2009/XMLSchema/XMLSchema.dtd will change accordingly; the version at http://www.w3.org/2012/04/XMLSchema.dtd will not change. Previous dated (and unchanging) versions of this DTD include: http://www.w3.org/2012/01/XMLSchema.dtd (XSD 1.1 Proposed Recommendation) http://www.w3.org/2011/07/XMLSchema.dtd (XSD 1.1 Candidate Recommendation) http://www.w3.org/2009/04/XMLSchema.dtd (XSD 1.1 Candidate Recommendation) http://www.w3.org/2004/10/XMLSchema.dtd (XSD 1.0 Recommendation, Second Edition) http://www.w3.org/2001/05/XMLSchema.dtd (XSD 1.0 Recommendation, First Edition)-->
A specification of the import ofUnique Particle Attribution (§3.8.6.4) which doesnot appeal to a processing model is difficult. What follows is intended asguidance, without claiming to be complete.
Two particles may·validate· adjacent information items if they areseparated by at most epsilon transitions in the most obvious transcription of acontent model into a finite-state automaton.
A precise formulation of this constraint can also be offered in terms ofoperations on finite-state automaton: transcribe the content model into anautomaton in the usual way using epsilon transitions for optionality andunbounded maxOccurs, unfolding other numeric occurrence ranges and treating the heads of·substitution groups· as ifthey were choices over all elements in the group,but using notelement QNames as transition labels, but rather pairs of element QNames andpositions in the model. Determinize this automaton, treating wildcard transitions asifthey were distinct from all other edge labels for the purposes of thedeterminization. Now replace allQName+position transition labels with the element QNames alone. If the result has any stateswith two or more identical-QName-labeled transitions from it, or twowildcard transitions whose intentional intersection is non-empty, the model does notsatisfy the Unique Attribution constraint.
This section defines identifiers for various versions of XSD, including versions defined in superseded drafts, to enable precise reference to versions when such reference is necessary.
http://www.w3.org/XML/XMLSchema
http://www.w3.org/XML/XMLSchema/v1.0
http://www.w3.org/XML/XMLSchema/v1.1
http://www.w3.org/XML/XMLSchema/v1.0/1e
http://www.w3.org/XML/XMLSchema/v1.0/2e
http://www.w3.org/XML/XMLSchema/v1.1/1e
http://www.w3.org/XML/XMLSchema/v1.0/1e/19990506
http://www.w3.org/XML/XMLSchema/v1.0/1e/19990924
http://www.w3.org/XML/XMLSchema/v1.0/1e/19991105
http://www.w3.org/XML/XMLSchema/v1.0/1e/19991217
http://www.w3.org/XML/XMLSchema/v1.0/1e/20000225
http://www.w3.org/XML/XMLSchema/v1.0/1e/20000407
http://www.w3.org/XML/XMLSchema/v1.0/1e/20000922
http://www.w3.org/XML/XMLSchema/v1.0/1e/20001024
http://www.w3.org/XML/XMLSchema/v1.0/1e/20010316
http://www.w3.org/XML/XMLSchema/v1.0/1e/20010330
http://www.w3.org/XML/XMLSchema/v1.0/1e/20010502
http://www.w3.org/XML/XMLSchema/v1.0/2e/20040318
http://www.w3.org/XML/XMLSchema/v1.0/2e/20041028
http://www.w3.org/XML/XMLSchema/v1.1/1e/20040716
http://www.w3.org/XML/XMLSchema/v1.1/1e/20050224
http://www.w3.org/XML/XMLSchema/v1.1/1e/20060116
http://www.w3.org/XML/XMLSchema/v1.1/1e/20060217
http://www.w3.org/XML/XMLSchema/v1.1/1e/20060330
http://www.w3.org/XML/XMLSchema/v1.1/1e/20060831
http://www.w3.org/XML/XMLSchema/v1.1/1e/20070830
http://www.w3.org/XML/XMLSchema/v1.1/1e/20080620
http://www.w3.org/XML/XMLSchema/v1.1/1e/20090130
http://www.w3.org/XML/XMLSchema/v1.1/1e/20090430
http://www.w3.org/XML/XMLSchema/v1.1/1e/20091203
http://www.w3.org/XML/XMLSchema/v1.1/1e/20110721
http://www.w3.org/XML/XMLSchema/v1.1/1e/20120119
http://www.w3.org/XML/XMLSchema/v1.1/1e/20120405
The following documents, in whole or in part, contain provisions which must be consulted in order to understand fully or to implement some of the normative provisions of this specification.
The following contributed material to version 1.0 of this specification:
David Fallside, IBM
Scott Lawrence, Agranat Systems
Andrew Layman, Microsoft
Eve L. Maler, Sun Microsystems
Asir S. Vedamuthu, webMethods, Inc
The Working Group thanks the members of other W3C WorkingGroups and industry experts in other forums who have contributeddirectly or indirectly to the creation of this document and itspredecessor.
Since version 1.0 of thisspecification was completed, David Beech and Noah Mendelsohnhave retired from the corporations which supported theirwork as editors. The email addresses given for them arethose known at the time this document was published.
The work of C. M. Sperberg-McQueenas a co-editor of this specification was supported by the WorldWide Web Consortium through January 2009 and again from June 2010through May 2011, and from February 2009 to the present by Black Mesa Technologies LLC.
At the time this document is published, the members in good standing of the XML Schema Working Group are:
The XML Schema Working Group has benefited in its work from theparticipation and contributions of a number of people who are nolonger members of the Working Group in good standing at the time of publication of this Working Draft. Their names are given below. In particular we notewith sadness the accidental death of Mario Jeckle shortly beforepublication of the first Working Draft of XML Schema 1.1.Affiliations given are (among) those current at the time of theindividuals' work with the WG.