[This local archive copy is from the official and canonical URL, http://www.w3.org/1999/05/06-xmlschema-1/; please refer to the canonical source document if possible.]
http://www.w3.org/1999/05/06-xmlschema-1/
(in XML and
HTML, with accompanying
schema
and
DTD)
David Beech
(Oracle)
<dbeech@us.oracle.com>
Scott Lawrence
(Agranat Systems)
<lawrence@agranat.com>
Murray Maloney
(Commerce One)
<murray@muzmo.com>
Noah Mendelsohn
(Lotus)
<noah_mendelsohn@lotus.com>
Henry S. Thompson
(University of Edinburgh)
<ht@cogsci.ed.ac.uk>
Copyright © 1999 W3C (MIT, INRIA, Keio ), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply.
This is a W3C Working Draft for review by members of the W3C and other interested parties in the general public.
It has been reviewed by the XML Schema Working Group and the Working Group has agreed to its publication. Note that not that all sections of the draft represent the current consensus of the WG. Different sections of the specification may well command different levels of consensus in the WG. Public comments on this draft will be instrumental in the WG's deliberations.
Please review and send comments to www-xml-schema-comments@w3.org (archive)
The facilities described herein are in a preliminary state of design. The Working Group anticipates substantial changes, both in the mechanisms described herein, and in additional functions yet to be described. The present version should not be implemented except as a check on the design and to allow experimentation with alternative designs. The Schema WG will not allow early implementation to constrain its ability to make changes to this specification prior to final release.
A list of current W3C working drafts can be found at http://www.w3.org/TR. They may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress".
XML Schema: Structures is part one of a two part draft of the specification for the XML Schema definition language. This document proposes facilities for describing the structure and constraining the contents of XML 1.0 documents. The schema language, which is itself represented in XML 1.0, provides a superset of the capabilities found in XML 1.0 document type definitions (DTDs.)
This structural part (XML Schema: Structures) of the XML Schema definition language is a distillation of eight months of work by the W3C XML Schema Working Group, including four weeks of intensive work by a group of five editors. This Working Draft draws heavily on the work of [DCD], [DDML], [SOX], [XDR] and [XML-Data]. Requirements for XML Schema: Structures can be found in [XML Schema Requirements].
Chapter 2 presents a Conceptual Framework for XML Schema: Structures, including an introduction to schema constraints, types, schema composition, and symbol spaces. The abstract and concrete syntax of XML Schema: Structures are introduced, along with other terminology used throughout the specification.
Chapter 3 Schema Definitions and Declarations reconstructs the core functionality of XML 1.0, plus a number of extensions, in line with our stated requirements [XML Schema Requirements]. This chapter discusses the declaration and use of datatypes, archetypes, element types, content models, attributes, attribute groups, model groups, refinement, entities and notations.
Chapter 4 presents Schema Composition and Namespaces, including the validation of namespace qualified instance documents, import, inclusion and export of declarations and definitions, schema paths, access to schemas, and related rules for schema-based validity.
Chapter 5 is a placeholder for Documenting schemas, which will eventually provide a standardized means for including documentation in the definition of a schema.
Chapter 6 discusses Conformance, including the rules by which instance documents are validated, and responsibilities of schema-aware processors.
The normative addenda include a (normative) DTD for Schemas and a (normative) Schema for Schemas, which is an XML Schema schema for XML Schema: Structures, a Glossary (normative) and References (normative). Non-normative appendixes include a Sample Schema (non-normative) and acknowledgments [Grateful Acknowledgments (non-normative)].
This Working Draft document was produced using an [XML] DTD and an [XSLT] stylesheet.
The following highlighting is used to present technical material in this document:
[Definition: ] A term is something we use a lot.
Example A non-normative example illustrating use of the schema language, or a related instance. And an explanation of the example.
<schema name='http://www.muzmo.com/XMLSchema/1.0/mySchema.xsd' >
The following highlighting is used for non-normative commentary in this document:
Issue (dummy): A recorded issue.
Ed. Note: Notes shared among the editorial team.
NOTE: General comments directed to all readers.
The purpose of XML Schema: Structures is to provide an inventory of XML markup constructs with which to write schemas.
The purpose of an XML Schema: Structures schema is to define and describe a class of XML documents by using these constructs to constrain and document the meaning, usage and relationships of their constituent parts: datatypes, elements and their content, attributes and their values, entities and their contents and notations. Schema constructs may also provide for the specification of implicit information such as default values. Schemas are intended to document their own meaning, usage, and function through a common documentation vocabulary.
Thus, XML Schema: Structures can be used to define, describe and catalogue XML vocabularies for classes of XML documents.
Any application that consumes well-formed XML can use the XML Schema: Structures formalism to express syntactic, structural and value constraints applicable to its document instances. The XML Schema: Structures formalism will allow a useful level of constraint checking to be described and validated for a wide spectrum of XML applications.
The language defined by this specification does not attempt to provide all the facilities that might be needed by any application. Some applications may require constraint capabilities not expressible in this language, and so may need to perform their own additional validations.
The definition of XML Schema: Structures is a part of the W3C XML Activity. It is in various ways related to other ongoing parts of that Activity and other W3C WGs
XML Schema: Structures defines its own Information Set Contributions.
XML Schema: Structures will have requirements for subsequent Information Set Working Drafts .
The terminology used to describe XML Schema: Structures is defined in the body of this specification. The terms defined in the following list are used in building those definitions and in describing the actions of XML Schema: Structures processors:
This specification uses a number of terms that are common to many of the fields of endeavor that have influenced the development of XML Schema. Unfortunately, it is often the case that these terms do not have the same definitions in all of those fields. This section attempts to provide definitions of terms as they are used to describe the conceptual framework, and the remainder of the specification.
Since XML schemas are themselves specified as XML documents, it is useful to clarify the relationships between certain kinds of XML documents:
Note that it is possible to specify a schema definition to which schema definitions themselves must conform, and this is given in (normative) Schema for Schemas. An XML 1.0 DTD to which schema definitions must conform is also provided in (normative) DTD for Schemas.
Any schema definition is therefore also an instance. The editors will make an attempt to always use the most precise of these terms, but the reader should note that rules specified herein for instances do apply to all of the following kinds of XML document:
The [XML] specification describes two kinds of constraints on XML documents: well-formedness and validity constraints. Informally, the well-formedness constraints are those imposed by the definition of XML itself (such as the rules for the use of the < and > characters and the rules for proper nesting of elements), while validity constraints are the further constraints on document structure provided by a particular DTD.
Three kinds of normative statements about the impact of XML Schema: Structures components on instances are distinguished in this specification:
NOTE: Schema Information Set Contributions are not as new as might at first appear: XML 1.0 validation augments the XML 1.0 information set in similar ways, e.g. by providing values for attributes not present in instances, and by implicitly exploiting type information for normalization or access, e.g. consider the effect ofNMTOKENS
on attribute whitespace, and the semantics ofID
andIDREF
. By including Schema Information Set Contributions, we are trying to make explicit something XML 1.0 left implicit.
XML Schema: Structures not only reconstructs the DTD constraints of XML 1.0 using XML instance syntax, it also adds the ability to define new kinds of constraints. For example, although the author of an XML 1.0 DTD may declare an element type as containing character data, elements, or mixed content, there is no mechanism with which to constrain the contents of elements to only character data of a particular form, such as only integers in a specified range.
This specification supports the expression of just such constraints by including in the mechanism for the declaration of element types the option of specifying that its contents must consist of a valid string expression of a particular datatype. A number of other mechanisms are added which improve the expressive power, usability and maintainability of schemas as a means to defining the structure of XML documents.
The use of the word 'type' has caused confusion in earlier discussions of schema technologies. Here, the word is used in several different contexts for a constraint on the form of (parts of) an element or attribute in an instance document. So, there are types that are suitable for constraining individual attributes, others that apply to entire elements (of which attributes may be a part), and so on. We use the words 'define' and 'definition' when speaking of types, and the words 'declare' and 'declaration' when specifying for an attribute or element type the type which constrains its form in instance documents.
The next chapter Schema Definitions and Declarations sets out the XML Schema: Structures approach to schemas and formal definitions of their component parts. Here we informally summarize the key constructs used in defining schemas. An asterisk (*) in the 'Named?' column indicates that the name will appear in instances -- other names are for schema use only.
XML Schema: Structures Feature | Purpose | Named? |
---|---|---|
The Schema | A wrapper containing all the definitions and declarations comprising a schema document. | Yes |
Datatype Definition | A type (content constraint), such as 'integer', that applies to character data in an instance document, whether it appears as an attribute value or the contents of an element. The mechanisms for defining datatypes are set out elsewhere, in XML Schemas: Datatypes. | Yes |
Archetype Definition | A complete set of constraints for elements in instance documents, applying to both contents and attributes. | Yes |
Element Type Declaration | An
association between a name for an element and an archetype. An element type
declaration for 'A' is comparable to a DTD declaration
<!ELEMENT A .....> . |
Yes* (local or global) |
Attribute Declaration | An association between a a name for an attribute and a datatype, together with occurrence constraints such as 'required' or 'default'. The association is local to its surrounding archetype. | Yes* (local) |
Content type | Either a datatype or a content model. A content type applies to the contents of elements in an instance document (but not their attribute values). It provides a unifying abstraction for the constraints which apply to the contents of elements, but introduces no additional features. | No |
Element Content Model | A type (content constraint) that applies to the contents of elements in an instance document. Content models do not include attribute declarations. | No |
Element-Only Content | Components for constructing content models which allow only element content. Includes facilities for grouping, sequencing, as well as for declaration of and reference to element types. | No (but see below) |
Attribute Group Definition | An association between a name and a reusable collection of attribute declarations. | Yes |
Named Model Group | Model groups are part of the content model building block abstraction, but are unnamed and cannot be referenced for reuse. A named model group is an association between a name and a model group, allowing for reuse. | Yes |
Archetype Refinement | One archetype may be defined as refining one or more other archetypes, acquiring content type and/or attributes therefrom. | Yes |
Schema Import | Extends the current schema with definitions and/or declarations from an external schema, retaining the association with the original schema. | No |
Schema Inclusion | Integrates definitions and/or declarations from an external schema into the schema being defined, as if they had been defined locally. | No |
As indicated in the third column of the tables above, most of the components listed are given names, which provide for references within the schema, and sometimes from one schema to another. For example, an attribute definition can refer to a named datatype, such as 'integer'. A content model can refer to an element type, and so on.
If all such names were assigned from the same 'pool', then it would be impossible to have e.g. a datatype named 'integer' and an element type with the name 'integer' in the same schema. [Definition: ] Accordingly we introduce the idea of a symbol space (avoiding 'name space' to avoid confusion with 'Namespaces in XML' [XML-Namespaces]).
There is a single distinct symbol space within a given schema for each of the abstractions named above other than 'Attribute' and 'Element type': within a given symbol space, names are unique, but the same name may appear in more than one symbol space without conflict. In particular note that the same name can refer to both an archetype and an element type, without conflict or necessary relation between the two.
Attributes and local element type declarations are special, in that every archetype defines its own attribute and local element type symbol spaces.
XML Schema: Structures is presented here primarily in the form of an [Definition: ] abstract syntax, which provides a formal specification of the information provided for each declaration and definition in the schema language. The abstract syntax is presented using a simplified BNF. Defined terms are to the left. Their components are to the right, with a small amount of meta-syntax: ()s for grouping, | to separate alternatives, ? for optionality, * and + for iteration. Terms in italics are primitives, not expanded here, either because they are defined elsewhere (e.g. URI, defined by [URI]) or because they can only be grounded once a concrete syntax is decided on (e.g. choice).
An abstract syntax production prefixed with a number in brackets (e.g. [3]) is normative; other abstract syntax is either for purposes of explanation, or is a duplicate (for convenience) of a normative definition to be found elsewhere.
The abstract syntax illustrates the expressive power of the language, and the relationships among its component parts. The abstract syntax can be used to evaluate the expressive power of XML Schema: Structures, but not its look and feel. In particular, please note that neither ordering within or between productions or choice of names is significant, and that any particular concrete syntax is not constrained by these.
The [Definition: ] concrete syntax of XML Schema: Structures, the exact element and attribute names used in a schema, are a key feature of its proposed design. The concrete syntax is the form in which the schema language is used by schema authors. Though its elements and attributes are often different from the terms of the abstract syntax bnf, the features and expressive power of the two are congruent. The concrete syntax profoundly affects the convenience and usability of the schema language.
We include a preliminary concrete syntax in this draft, via examples and in (normative) Schema for Schemas and (normative) DTD for Schemas. The emphasis in this version has been to stay quite close to the abstract syntax.
The principal purpose of XML Schema: Structures is to provide a means for defining schemas that constrain the contents of instance documents and augment the information sets thereof.
A schema contains some preamble information and a set of definitions and declarations.
Schema top level | ||||||||||||||||||||||||||||
|
preamble consists of an xmlSchemaRef specifying the URI for XML Schema: Structures; the schemaIdentity specifying the URI by which this schema is to be identified; and a schemaVersion specification for private version documentation purposes and version management.
Example Note that the abstract syntax xmlSchemaRef is realised via a default namespace declaration in the concrete syntax.
<!DOCTYPE schema PUBLIC '-//W3C//DTD XML Schema Version 1.0//EN' SYSTEM 'http://www.w3.org/1999/05/06-xmlschema-1/structures.dtd' > <schema name='file:/usr/schemas/xmlschema/mySchema.xsd' version='M.n' xmlns='http://www.w3.org/1999/05/06-xmlschema-1/structures.xsd'> ... </schema>
The schema's model property is discussed in Archetype Refinement. The schema's export, import and include properties are discussed in Schema Composition and Namespaces.
The schema's declarations and definitions, discussed in detail in Schema Definitions and Declarations, provide for the creation of new schema components:
Summary of Definitions and Declarations | ||||||||||||||||||||||||||||
|
Example The following illustrates the basic model for declaring all XML Schema: Structures components: When creating a new component, we declare that its name is associated with the specification for that component. Each new component definition creates a new entry in the symbol space for that kind of component.
<datatype name='myDatatype'> ... </datatype> <archetype name='myArchetype'> ... </archetype> <elementType name='myElementType'> ... </elementType> <attrGroup name='myAttrGroup'> ... </attrGroup> <modelGroup name='myModelGroup'> ... </modelGroup> <notation name='myNotation' ... /> <textEntity name='myTextEntity'> ... </textEntity> <externalEntity name='myExternalEntity' ... /> <unparsedEntity name='myUnparsedEntity' ... /> </schema>
Constraint on Schemas: Unique Definition
The same NCName must not appear in
two definitions or declarations of the same type.
Issue (no-evolution): This draft does not deal with the requirement "for addressing the evolution of schemata" (see [XML Schema Requirements]).
NOTE: We have not so far seen any need to reconstruct the XML 1.0 notion of root. For the connection from document instances to schemas, see Schema Validity.
Uniform means are provided for reference to a broad variety of schema constructs, both within a single schema and to features imported (Schema Import) from external schemas. The name used to reference any component of XML Schema: Structures from within a schema consists of an NCName and an optional schemaRef, a reference to an external schema definition. In a few cases, some qualification may be added to a reference: this is made clear as the individual reference forms are introduced below.
Example: Component Names and References | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The BNF above illustrates the reference mechanisms used in this specification.
Example The first of these is a local reference, the other two refer to schemas elsewhere. The elementTypeRef example assumes the schemaAbbrev
<archetypeRef name='Address'/> <elementTypeRef name='BLOCKQUOTE' schemaAbbrev='HTML'/> <datatypeRef name='quantityi' schemaName='http://www.w3.org/xsl.xsd'/>HTML
has been declared for import; the datatypeRef example similarly assumes that the given (imaginary as of this writing) URL has been declared for import. See Schema Importfor a discussion of importing.
Constraint on Schemas: Consistent Import
A schemaAbbrev or schemaName in a schemaRef
must be declared in an Schema Import of the current
schema, and the NCName qualified by that
schemaRef must be an import (Import Restrictions) of the appropriate type per that
declaration.
Constraint on Schemas: One Reference Only
The concrete syntax uses schemaAbbrev
and
schemaName
attributes to realise schemaName. It is an error for both these attributes
to appear on the same element in a schema.
[Definition: ] A ...Ref identifies a ...Spec provided there is a definition or declaration of that ...Spec in the appropriate schema whose NCName matches the NCName of the ...Ref's ...Name. If there is no schemaRef in the ...Name, the appropriate schema is the current schema or a schema it eventually includes; if there is a schemaRef, the URI contained in or abbreviated by it must resolve successfully to a schema, which is then the appropriate schema. The Preorder Priority for Included Definitions Constraint on Schemas may also obtain.
Like XML 1.0 DTDs, XML Schema: Structures provides facilities for constraining the contents of elements and the values of attributes, and for augmenting the information set of instances, e.g. with defaulted values and type information. [Definition: ] We refer hereafter to the combination of schema constraints and information set contributions with the abbreviation SC. Compared to DTDs, XML Schema: Structures provides for a richer set of SCs, and improved capabilities for sharing SCs across sets of elements and attributes.
We start with [Definition: ] the simple datatypes whose expression in XML documents consists entirely of character data. As in the current draft of XML Schemas: Datatypes, wherever we speak of datatypes in this draft, we shall mean these simple datatypes. The treatment of aggregate datatypes (collections and structures) has not yet been resolved.
Datatypes | ||||||||||||||||||||||||||||||||||||||||||||
|
XML Schema: Structures incorporates the datatype definition mechanisms specified by [XML Schemas: Datatypes] in order to express SCs on attribute values and the character data contents of elements.
The first production above is for defining datatypes; datatypeSpec serves to indicate where this chapter connects with XML Schemas: Datatypes. exportControl is defined in Exporting Schema Constructs.
The other productions provide for using datatypes once they have been defined, see below under contentType and attrDecl.
We assume that it is appropriate to allow for some local specialization of datatypes at the point of use, and provide for that here (specialize).
As explained in References to Schema Constructs, a schemaRef, if included allows for the referenced definition to be located in some other schema.
Example The first example awaits the XML Schemas: Datatypes concrete syntax to be filled in. The first datatypeRef example references the definition above it. The second references a datatype pre-defined by XML Schemas: Datatypes. The third references a datatype in an (imaginary) XSL schema and fixes its value.
<datatype name='myDatatype'> <basetype name="..."/> [ ... TBD] </datatype> <datatypeRef name='myDatatype'/> <datatypeRef name='integer'/> <datatypeRef name='quantity' schemaName='http://www.w3.org/xsl.xsd'> <fixed>12pt</fixed> </datatypeRef>
Constraint on Schemas: Avoid Built-ins
The NCName must not be the same as
the name of any of the built-in datatypes (see [XML Schemas: Datatypes]).
[Definition: ] A string (possibly empty) dt-satisfies a datatypeSpec and an optional datatypeQual if
and
Schema Information Set Contribution: Datatype Info
When a string dt-satisfies a
datatypeSpec and an optional
datatypeQual, the containing attribute or
element information item will be augmented to indicate the
datatypeSpec and the specialize (if any) which it satisfied.
NOTE: Timing constraints were such that this text may not align completely with XML Schemas: Datatypes
[Definition: ] Archetype definitions gather together all SCs pertinent to elements in instance documents, their attributes and their contents. They are called archetypes because there may be more than one element type which shares the same SCs (see Element Type Declaration), and which therefore can be constrained by a common archetype.
Archetypes | ||||||||||||||||||||||||
|
The first three productions above provide the basic structure of the definition, the last two provide for reference to the things defined. But note that the name of an archetype is not ipso facto the name of elements whose appearance in instances will be associated with the SCs of that type. The connection between an element type name and an archetype is made by an elementTypeDecl, see below.
Alongside Attribute Declaration for permitted attributes, SCs for contents are defined in an archetype (contentType). For elements which may contain only character data, content type SCs are specified by reference to a Datatype Definition. Note that doing this by way of datatypeRef means that the character data SCs may provide for specialization and even defaulting in a manner similar to attribute values. For other kinds of elements, a Element Content Model is required.
Issue (elt-default): The extension of defaulting to element content is tentative.
Example A simple archetype with character data content constrained by reference to a datatype defined in the same schema and one attribute.
<archetype name='myArchetype'> <datatypeRef name='myDatatype'/> <attrDecl ...>. . .</attrDecl> </archetype>
Constraint on Schemas: AttrGroup Unique
The same attrGroupDefn must not be
referenced by two or more attrGroupRefs in the
same archetypeSpec.
Constraint on Schemas: AttrGroup Identified
Every attrGroupRef in a
archetypeSpec must identify an attrGroupSpec.
[Definition: ] The attribute declaration set of an archetypeSpec consists of all its effective attrDecls together with all the attrDecls contained in the attrGroupSpecs identified by any attrGroupRefs it contains.
[Definition: ] The full name of an attrDecl in an attribute declaration set is its NCName plus its schemaName, i.e. if it appeared directly in the archetypeSpec, the empty string, if it was acquired by refinement or if it came from an attrGroupSpec, then the schemaName from the schemaRef which identified the relevant archetypeSpec or attrGroupSpec respectively, if any, otherwise the empty string.
Constraint on Schemas: Attribute Locally Unique
The same full name must not
appear more than once in any archetypeSpec's
attribute declaration set.
[Definition: ] An element item a-satisfies an archetypeSpec if the element item's attribute items taken together as a set attrs-satisfy the archetypeSpec's attribute declaration set, and either
or
Issue (sic-elt-default): The above definitions do not provide for handling a default on an archetype's datatypeRef. Preferred solution: empty element items ipso facto satisfy datatypeRefs with defaults and are augmented with the default value. This would have the consequence that you cannot provide the empty string as the explicit value of an element item if it's governed by a datatypeRef with a default.
Schema Information Set Contribution: Archetype Info
When an element item a-satisfies a
archetypeSpec, that element information item
will be augmented to indicate the archetypeSpec
which it satisfied.
Example Why is the separation of element type and archetype provided for? In certain XML instance documents, the same attribute and content SCs are appropriate for more than one named element. Consider the following instance fragment: This fragment contains two elements,
<ShippingAddress id='a32' saleable='yes'> <Street>1 Main Street</Street> <City>New York</City> <Zip NineDigit='FALSE'>12345</Zip> </ShippingAddress> <BillingAddress id='a29' saleable='no'> <Street>2 Rose Lane</Street> <City>Anytown</City> <Zip NineDigit='TRUE'>12345-6789</Zip> </BillingAddress>ShippingAddress
andBillingAddress
, that have similar attributes and content. By defining a single appropriate archetype and declaring two element types which reference it, that commonality can be precisely expressed.
NOTE: This draft does not provide any mechanism for applying any SCs to element items whose namespace does not nominate a schema. This may be addressed in a later draft: in the meantime a workaround is possible as follows: Suppose we wish to use some Dublin Core terms in a schema, but all we know is the URI for the Dublin Core document. Perhaps we want to schema-validatewhere
<mybook><dc:creator xmlns:dc='...'>Rafael Sabattini</dc:creator></mybook>mybook
is already known to be covered by my schema. The workaround is to replace the real Dublin Core URI with a local URL for a tiny schema which simply definescreator
, and references the real URI for documentation.
Attribute declarations associate a name (which will appear as an attribute in start tags in instances) with SCs for the presence and value thereof.
Attributes | ||||||||||||||||||||||||
|
NOTE: Note that the datatypeRef productions are repeated here for easy reference.
Attribute declarations provide for:
Example Four attributes are declared: one with no explicit SCs at all; two defined by reference to a built-in type, one with a default and one required to be present in instances; and one with a fixed value.
<attrDecl name='myAttribute'/> <attrDecl name='anotherAttribute'> <datatypeRef name='integer'> <default>42</default> </datatypeRef> </attrDecl> <attrDecl name='yetAnotherAttribute' required='true'> <datatypeRef name='integer'/> </attrDecl> <attrDecl name='stillAnotherAttribute'> <datatypeRef name='string'> <fixed>Hello world!</fixed> </datatypeRef> </attrDecl>
When attribute declarations are used in an archetype specification, each
archetype provides its own symbol space for attribute names. E.g. an attribute
named title
within one archetype need not have the same
datatypeRef as one declared within another
archetype.
[Definition: ] An attribute item attr-satisfies an attrDecl if
or
where the attribute item's value consists of only character information items and by its "value string" is meant the string formed by concatenating the characters of each of those character information item children, if any, or else the empty string.
Issue (default-attr-datatype): What is the default attribute datatypeSpec?
[Definition: ] The attribute items of an element item attrs-satisfy an attribute declaration set if
and
Schema Information Set Contribution: Attribute Value Default
For every attrDecl in the
attribute declaration set
not used to attr-satisfy
an attribute item in the context of (1a) above which has a
datatypeRef which has a default, an
attribute item with the default value is added to the parent element item.
Issue (namespace-declare): We've got a problem with namespace declarations: they're not attributes at the infoset level, so they can appear without compromising validity, EXCEPT if there is a fixed or required declaration, and defaults should have the apparently desired effect.
XML Schema: Structures can name a group of attributes so that they may be incorporated as a whole into archetype definitions:
Attribute groups | ||||||||||||||||||||
|
Attribute group definitions:
Example Define and refer to an attribute group. The effect is as if the attribute declarations in the group were present in the archetype definition.
<attrGroup name='myAttrGroup'> <attrDecl .../> ... </attrGroup> <archetype name='myElementType'> <empty/> <attrGroupRef name='myAttrGroup'/> </archetype>
NOTE: There needs to be a Constraint on Schema which constrains the attrDecls which appear with an attrGroupRef: the name is the same as one of the attrDecls in the group, datatype and defaulting preserves substitutability, etc.
When content of elements is not constrained by reference to a datatype (Datatype Definition), it can have any, empty, element-only or mixed content. In the latter cases, the form of the content is specified in more detail.
A content model constrains the content of an archetype or an element type: it says nothing about attributes.
Example
<any/> <empty/> <mixed>...</mixed> [Element only content -- see element-only below]
Content models do not have names, but appear as a part of the definition of an archetype, which does have a name. Model groups can be named and used by name, see below.
[Definition: ] A sequence of character and element items (call this CESeq) model-satisfies an effective contentModel if
or
A content model for mixed content provides for mixing elements with character data in document instances. The allowed element types are named, but neither their order or their number of occurrences are constrainted.
Mixed content | ||||
|
The elementTypeRefs and elementTypeDecls determine the element types which may appear as children along with character data.
Example Allows character data mixed with any number of
<mixed> <elementTypeRef name='name1'/> <elementTypeRef name='name2'/> <elementTypeRef name='name3'/> </mixed>name1
,name2
andname3
elements.
NOTE: The fact that mixed allows for there to be no elementTypeRefs or elementTypeDecls makes it similar to XML 1.0's Mixed production. Indeed an empty mixed is the only way a schema can allow character data content with no datatype constraint at all.
Constraint on Schemas: Element Type Unique in Mixed
A given NCName must not appear two or
more times among the elementTypeDecls and
elementTypeRefs with no schemaRefs; a given elementTypeName must not appear two or more times
among the elementTypeRefs.
See Element Type Declaration for discussion and examples of the appearance of elementTypeDecl above.
[Definition: ] An element item mixed-satisfies a mixed if
or
or
Issue (mixed-change-current-schema): There's an implicit change in current schema in the definition of satisfy-mixed above which should be made explicit.
A content model for element-only content specifies only child elements (no immediate character data content other than white space is allowed). The content model consists of a simple grammar governing the allowed types of child elements and the order in which they must appear.
Element-only content | ||||||||||||||||||||||||
|
The grammar for element-only content is built on model elements and model groups (modelElt and modelGroup above). A model element provides for some number of occurrences in an instance of either a single element (via elementTypeRef or elementTypeDecl) or a group of elements (via modelGroup or modelGroupRef). A model group is two or more model elements plus a compositor.
A compositor for a model group specifies for a
given group whether it is a sequence of its model elements, a choice between
its model elements or a set of its model elements which must appear in
instances. These options reconstruct the XML 1.0 ,
connector, the
XML 1.0 |
connector and the SGML &
connector
respectively. In the first case (sequence) all the model elements must appear
in the order given in the group; in the second case (choice), exactly one of
the model elements must appear in the element content; and in the third case
(all), all the model elements must appear in the element content, but may
appear in any order.
The occur specification governs how many times the instance material allowed by a modelElt may occur at that point in the grammar. The absence of a max specification means that no upper bound is placed on the number of occurrences.
See Element Type Declaration for further discussion and examples of the appearance of elementTypeDecl within modelElt above.
Example A minimal model which simply requires a
<elementTypeRef name='paragraph'/> <sequence> <elementTypeRef name='name1'/> <elementTypeRef name='name2' prefix='HTML'/> </sequence> <choice minOccur='3' maxOccur='9'> <elementTypeRef name='name1'/> <elementTypeRef name='name2'/> </choice> <all minOccur='3'> <elementTypeRef name='name1'/> <elementTypeRef name='name2'/> </all> <choice> <all> <elementTypeRef name='name1'/> <elementTypeRef name='name2'/> </all> <all> <elementTypeRef name='name3'/> <elementTypeRef name='name4'/> </all> </choice>paragraph
(the default isminOccur=maxOccur=1
; a sequence of two elements (one from another schema); between 3 and 9 elements, each a choice between two; at least three pairs, in any order; one of two pairs, the elements in the chosen pair in any order.
[Definition: ] A sequence of element items eltOnly-satisfies an effective eltOnly if
NOTE: The above definition of eltOnly-satisfy does not explicitly incorporate the modifications required when the containing archetype is open, as set out at the end of Archetype Refinement, but it should be understood as doing so.
Constraint on Schemas: Element Consistency
A given NCName must not appear both
among the elementTypeDecls and among the
elementTypeRefs with no schemaRefs, or more than once among the
elementTypeDecls.
NOTE: Note that the above permits repeated use of the same elementTypeRef, analogous to DTD usage.
Constraint on Schemas: Unambiguous Content Model
For compatibility, it is an error if a content model is such that there
exist element item sequences within which some item can match more than one
occurrence of an elementTypeRef or
elementTypeDecl in the content model.
Issue (still-unambig): Should this compatibility constraint be preserved?
This reconstructs another common use of parameter entities.
Named model groups | ||||||||||||||||
|
Example A minimal model group is defined and used by reference, first as the whole content model, then as one alternative in a choice.
<modelGroup name='myModelGroup'> <elementTypeRef name='myElementType'/> </modelGroup> <elementType name='myElementType'> <modelGroupRef name='myModelGroup'/> <attrDecl ...>. . .</attrDecl> </elementType> <elementType name='anotherElementType'> <choice> <elementTypeRef name='yetAnotherElementType'/> <modelGroupRef name='myModelGroup'/> </choice> <attrDecl ...>. . .</attrDecl> </elementType>
An [Definition: ] element type declares the association of an element type name with an archetype, either by reference or by incorporation.
Element type declaration | ||||||||||||||||
|
An element type declaration associates a name with an
Archetype Definition. This name will appear in tags in instance
documents; the archetype definition provides SCs on
the form of elements tagged with the specified name. An element type
declaration is comparable to an <!ELEMENT ...>
declaration
in an XML 1.0 DTD.
The last two productions above provide for element types to be referenced by name from content models.
As noted above element type names are in a separate symbol space from the symbol space for the names of archetypes, so there can (but need not be) an archetype with the same name as a top-level element type.
[Definition: ] The full name of a top-level elementTypeDecl is its NCName plus its schemaName, i.e. if it appeared directly in the current schema or an include, the empty string, if it was imported, then the schemaName of that import, which must successfully resolved to its containing schema.
An elementTypeDecl may also appear within a modelElt. See above (Element-Only Content and Mixed Content) for where this is allowed. This declares a locally-scoped association between an element type name and an archetype. As with attribute names, locally-scoped element type names reside in symbol spaces local to the archetype that defines them. Note however that archetype names are always top-level names within a schema, even when associated with locally-scoped element type names.
NOTE: It is not yet clear whether an archetype defined implicitly by the appearance of an archetypeSpec directly within an elementTypeSpec will have an implicit name, or if so what that name would be, or if not how, if at all, it might be referred to.
Example A pretty complete set of alternatives. Note the last one is intended to be equivalent to the idea sometimes called WFXML, for Well-Formed XML: it allows any content at all, whether defined in the current schema or not, and any attributes.
<elementType name='myElementType'> <datatypeRef name='myDatatype'/> </elementType> <elementType name='et0'> <archetypeRef name='myArchetype'/> </elementType> <elementType name='et1'> <all>. . .</all> <attrDecl ...>. . .</attrDecl> </elementType> <elementType name='et2'> <any/> </elementType> <elementType name='et3'> <empty/> <attrDecl ...>. . .</attrDecl> </elementType> <elementType name='et4'> <choice>. . .</choice> <attrDecl ...>. . .</attrDecl> </elementType> <elementType name='et5'> <sequence>. . .</sequence> <attrDecl ...>. . .</attrDecl> </elementType> <elementType name='et6' model='open'> <mixed/> </elementType>Instances of
<elementType name='contextOne'> <sequence> <elementType name='myLocalElementType' <archetypeRef name='myFirstArchetype'/> </elementType> <elementTypeRef name='globalElementType'/> </sequence> </elementType> <elementType name='contextTwo' <sequence> <elementType name='myLocalElementType' <archetypeRef name='mySecondArchetype'/> </elementType> <elementTypeRef name='globalElementType'/> </sequence> </elementType>myLocalElementType
withincontextOne
will be constrained bymyFirstArchetype
, while those withincontextTwo
will be constrained bymySecondArchetype
.
NOTE: The possibility that differing attribute definitions and/or content models would apply to elements with the same name in different contexts is an extension beyond the expressive power of a DTD in XML 1.0.
Constraint on Schemas: Nested May Not Be Global
An elementTypeSpec in a nested
elementTypeDecl must not be global.
Constraint on Schemas: Cannot Shadow Global
If a top-level elementTypeSpec is
global, then the NCName of its
elementTypeDecl must not be redeclared by any
nested elementTypeDecl in the same schema or
any schema it eventually
includes.
[Definition: ] An element item e-satisfies an elementTypeDecl if the elementTypeDecl:
or
[Definition: ] An element item is independently valid if there is a top-level elementTypeDecl whose NCName matches its name in the schema its namespace item resolves to (or a schema that schema includes, in which case see the definition of identify for details on which declaration is used if there is more than one), and the element item must e-satisfy that elementTypeDecl.
[Definition: ] An element item ref-satisfies an elementTypeRef if
or
NOTE: The last clause above is much too complex, it needs to be split apart and built up in stages. It is this which allows elements based on refining archetypes to appear in place of those based on their ancestors.
NOTE: This section articulates what has only been hinted at above, namely a considerable increase in the power and expressiveness of schema declarations, by explaining what was provided for in the abstract syntax in the previous section, but not explained much if at all at that point.
We provide for the refinement of archetypes declared in a schema. An archetype definition may identify one or more other archetypes from which it specifies the creation of a (joint) refinement.
We provide for interpreting archetypes as imposing constraints on instance elements in either a closed, refinable or open fashion.
The relevant abstract syntax productions are as follows:
Refinement | ||||||||||||||||
|
Example An archetype which not only refines another by adding an attribute, but also is itself (further) refinable. The
<archetype name='chair' model='refinable'> <refines> <archetypeRef name='furniture'/> </refines> <attrDecl name='noOfSeats'>. . .</attrDecl> </archetype>furniture
archetype must have been declared refinable(or open).
We distinguish between explicit, acquired and effective validation constraints for any archetype. [Definition: ] Explicit constraints are those explicitly present, via attrDecls or contentType, in the definition of the archetype. [Definition: ] Acquired constraints come from the ancestors of an archetype, if it has any refinements. [Definition: ] The effective constraints are the union of the explicit and the acquired. The effective constraints are what actually constrain any element type declared with reference to a refining archetype.
Constraint on Schemas: Allowed Refinements
An archetype must not refine one or more other archetypes unless all of the
latter have been declared with either open or refinable
(explicitly or by default: the default for model on any
archetype which does not explicitly specify one is provided by the
model of the schema itself,
which in turn defaults to closed for compatibility). The same archetype
must not be referenced more than once in the refinements list.
Issue (default-model): Should the default model be open, refinable or closed?
For the present, the permitted refinements and the resulting effective constraints are as follows:
[Definition: ] A refinable or open mixed content model is called vacuous if it has no declared elementTypeRefs or elementTypeDecls within it. This is because any archetype is substitutable for an archetype with a vacuous content model and no declared attributes.
[Definition: ] An archetype AT1 is said to refine an archetype AT2 if and only if AT1 is declared to refine either AT2 or (recursively) some archetype that refines AT2. [Definition: ] AT2 is then said to be an ancestor of AT1.
NOTE: Refinements are by definition substitutable for any of their ancestors.
[Definition: ] We define a substitutability relation between two archetypes as follows:
One archetype is substitutable for another if any schema-valid instance of the former is necessarily a schema-valid instance of the latter.
Some simple cases:
Example Refinement by definition creates substitutable archetypes:
<archetype name='Address' model='refinable'> <sequence> <elementTypeRef name='street'/> <elementTypeRef name='city'/> </sequence> </archetype> <archetype name='USAddress'> <refines> <archetypeRef name='Address'/> </refines> <sequence> <elementTypeRef name='state'/> <elementTypeRef name='zip'/> </sequence> </archetype>USAddress
is substitutable forAddress
: the effective content model (simplifying in the obviously legitmate way) isHere is a richer example:
<sequence> <elementTypeRef name='street'/> <elementTypeRef name='city'/> <elementTypeRef name='state'/> <elementTypeRef name='zip'/> </sequence>The final instance element satisfies all the effective constraints associated with the
<archetype name='transclude' model='refinable'> <mixed/> <attrDecl name='xml:link'> <fixed>simple</fixed> </attrDecl> <attrDecl name='actuate'> <fixed>auto</fixed> </attrDecl> <attrDecl name='href' required='true'> <datatypeRef name='uri'/> </attrDecl> </archetype> <archetype name='anchor' interp='open'> <mixed/> <attrDecl name='id'> <datatypeRef name='ID'/> </attrDecl> </archetype> <archetype name='nestHere'> <refines> <archetypeRef name='transclude'/> <archetypeRef name='anchor'/> </refines> <empty/> <attrDecl name='show'> <fixed>embed</fixed> </attrDecl> </archetype> <elementType name='nestHere' archetype='nestHere'/> <nestHere href='http://www.ltg.ed.ac.uk/~ht/password.xml' id='mpw'/>nestHere
archetype: itsxml:link
,actuate
andhref
attributes are constrained by constraints acquired fromtransclude
, itsid
attribute is constrained by a constraint acquired fromanchor
and itsshow
attribute is constrained by its own explicit constraint. The effective content model fornestHere
is empty, under the second clause of the discussion above: only the explicit content model is there at all, so it gets to be the effective one. Note that because they are refinable and open respectively, bothtransclude
andanchor
are satisfied by thenestHere
instance, i.e. the substitutability requirement on refining archetypes is satisfied.
Example Here's a case which merges content models and specializes an attribute definition: Here we see not only the merging of two content models, with the two elementTypeRefs being concatenated to produce the effective sequence model for the refined archetype, but also the provision in an explicit constraint of a fixed value for an attribute consistent with its acquired constraint. (Strictly speaking, this goes beyond the constraints on refinement set out above, but it obviously preserves substitutability, and will be allowed as soon as more detailed constraints are drafted.)
<archetype name='polygon' model='refinable'> <elementTypeRef name='bbox'/> <attrDecl name='n' required='yes'/> <attrDecl name='regular'> <datatypeRef name='enumeratedSymbol'> <enumeration> <literal>yes</literal> <literal>no</literal> </enumeration> </datatypeRef> </attrDecl> </archetype> <elementType name='regularPolygon'> <refines> <archetypeRef name='polygon'/> </refines> <elementTypeRef name='side'/> <attrDecl name='regular'> <fixed>yes</fixed> </attrDecl> </elementType>
<regularPolygon n='3'> <bbox>...</bbox> <side length='3cm'/> </regularPolygon>
NOTE: The intention of the formal validity definition ref-satisfies is that element item should be valid with respect to an archetypeSpec that is refinable if it is valid with respect to that archetypeSpec itself or any archetypeSpec that refines it. It might them be possible for validating parser to begin by checking daughters with respect to the declared archetypeSpec if it is element only, since any refinement can only add to the end of a sequence of daughters.
There follows a semi-formal definition of validity with respect to an open content model.
To parse against an open content model:
Call the set of all transition labels anywhere in the FSM (i.e. the tags mentioned anywhere anywhere in the model) T.
For each state s in the FSM, call the set of tags which label transitions from that state T[s].
Then to turn the FSM into one which interprets the content model as open, for each state s
Issue (formal-refinement-FSM): Does refinement need this, or is it covered already?
Entities and notations | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Internal parsed entities are a feature of XML that enables reuse of text fragments by direct reference in an instance document.
In XML Schema: Structures documents, internal parsed entities are declared by using the textEntitySpec production.
Example
<textEntity name='flavor'>Fresh mint</textEntity'>flavor
can now be used in an entity reference in instances of the containing schema.
See Schema Validity for SCs covering entities and entity references.
External parsed entities are a feature of XML that offers a method for including well-formed XML document fragments, including text and markup, by direct reference to the storage object of the parsed entity.
In schemas, external parsed entities are declared by using the externalEntitySpec production.
Example These four external entities represent the supposed contents of a book:
<externalEntity name='FrontMatter' system='FrontMatter.xml' /> <externalEntity name='Chapter1' system='chapter1.xml' /> <externalEntity name='Chapter2' system='Chapter2.xml' /> <externalEntity name='BackMatter' system='BackMatter.xml' />In an instance, the external entities take their familiar XML form. The processor expands the entities for their content.
<book> &FrontMatter; &Chapter1; &Chapter2; &BackMatter; </book>
Again, See Schema Validity for SCs covering entities and entity references.
External unparsed entities are a feature of XML that offers a baroque method for including binary data by indirect reference to both the storage object and the the notation type of the unparsed entity. In schemas, external parsed entities may be declared by using the unparsedEntitySpec production.
Example
<unparsedEntity name='SKU-5782-pic' system='http://www.vendor.com/SKU-5782.jpg' notation='JPEG' />The picture element carries an attribute which is (presumably) governed by the unparsed entity declaration.
<picture location='SKU-5782-pic'/>
Schema-validity Constraint: Attribute is Entity
When an attribute value is interpreted as a reference to an unparsed entity
[How?!], the attribute value must identifies an unparsedEntitySpec (note that no
schemaRef can be specified in this case); the
NCName of the notationRef of that unparsedEntitySpec must
identify a notationSpec; the resource specified by the
systemID and publicID
attribute must be available.
Issue (unparsed-entity-gaps): There are lots of gaps and little problems in this design for unparsed entities.
A notation may be declared by specifying a name and an identifier for the notation. A notation may be referenced by name in a schema as part of an external entity declaration.
Example
<notation name='jpeg' public='image/jpeg' system='viewer.exe' /> <elementType name='picture> <attrDecl name='entity'> <datatypeRef name='NOTATION'/> </attrDecl> </elementtype>The notation need not ever be mentioned in the instance document.
<picture entity='SKU-5782-pic'/>
Issue (unparsed-entity-attributes): We need to synchronise with XML Schemas: Datatypes regarding how we declare attributes as unparsed entities!
This chapter describes facilities to provide for validation of namespace-qualified instance document elements and attributes, and potentially (subject to enhancements to the Namespaces recommendation), entities and notations.
NOTE: 'Namespaces in XML' [XML-Namespaces] provides an enabling framework for modular composition of schemas. From that document:
We envision applications of Extensible Markup Language (XML) where a single XML document may contain elements and attributes (here referred to as a 'markup vocabulary') that are defined for and used by multiple software modules. One motivation for this is modularity; if such a markup vocabulary exists which is well-understood and for which there is useful software available, it is better to re-use this markup rather than re-invent it.
Such documents, containing multiple markup vocabularies, pose problems of recognition and collision. Software modules need to be able to recognize the tags and attributes which they are designed to process, even in the face of 'collisions' occurring when markup intended for some other software package uses the same element type or attribute name.
These considerations require that document constructs should have universal names, whose scope extends beyond their containing document. This specification describes a mechanism, XML Schema namespaces, which accomplishes this.
XML Schema: Structures provides facilities to enable declaration and modular composition of schemas.
As described in Conformance, full validation is supported in the case where the transitive closure of all schemas referenced by an instance document is available to the validating processor. Furthermore, the schema language is compatible with partial validation, in which validation is done only with respect to a subset of the schemas applicable to a document, or in which a well formed document (I.e. one for which no overall schema is provided) makes selective use of features imported from schemas which are available.
During validation, the standard mechanisms of [XML-Namespaces] are interpreted to create associations between instance document prefixes and schema definitions. Thus, there is in each valid instance document a namespace associated with each schema to which the instance conforms. Each namespace qualified element (or eventually entity or notation), its attributes and its content, is validated against its declaration in the corresponding URI-named schema. In that sense, each schema defines and is coextensive with a namespace. The means by which schemas are located during processing is discussed below in Access to Schemata. Comprehensive rules for validation are discussed in Conformance.
Example For example (refer to schema definitions in the previous example): 'somelement' and 'name1' (which happens to be empty) are validated against their definitions in 'http://coolbits.com/someschema.xsd'. Similarly, 'name2' is validated against its definition in 'http://xyzcorp.com/otherschema.xsd'. The existence of 'name1' and 'name2' as content of 'somelement', and specifically their URI qualification, is validated against the corresponding content model declaration for 'someelement' in 'http://coolbits.com/someschema.xsd'. Validation definition attrs-satisfy determines whether 'p:someattr' is correctly namespace qualified according to the content model definition for 'name2'.
<SomeDocument xmlns='http://coolbits.com/someschema.xsd' xmlns:o='http://xyzcorp.com/otherschema.xsd' xmlns:p='http://xyzcorp.com/yetanotherschema.xsd'> <someelement> <name1/> <o:name2 p:someattr='123'/> </someelement> </SomeDocument>
NOTE: Experience with programming languages and similar schema definition systems suggests that there is value in distinguishing the internal implementation of a module from the features or interfaces that it provides for reuse by others. For example, a schema defined to describe an automobile might intend that its definitions for 'automobile' and 'engine' be building blocks for use in other schemas, but that other constructs such as 'screw' or 'bolt' be reserved for internal use.
XML Schema: Structures constructs must be exported for external use. By default, all datatypes, archetypes, elementTypes, attribute definitions, model groups, attribute groups, entities and notations are exported. The export declaration can be used within a schema declaration to override the default behavior for each such class of declaration or definition:
Export | ||||||||||||||||||||||||||||||||
|
Example This declaration restricts export of datatypes and archetypes and explicitly, although redundantly, enables export of element types.
<schema name='http://coolbits.com/someschema.xsd'> <export datatypes='false' archetypes='false' elementTypes='true' <!-- redundant: default is 'true'> ... /> [...schema body here...] </schema>
The default for all attributes of the export declaration is 'true'. Therefore, all constructions are exported by default if 'export' is not specified, and only the constructions that are not specifically disabled are exported if 'export' is specified. If a schema A imports some other schema B, then by default, all definitions imported from B are exported from A. See Schema Import below.
Export can also be controlled individually for each particular elementType, archetype, model group, attribute group, datatype, entity or notation. Attribute definitions are implicitly exported (or not) along with the elementTypes in which they appear. An export declaration appearing on an individual elementType, archetype, or other declaration or definition overrides any default export behavior established at the schema level.
The following abstract syntax is repeated from elsewhere in this document:
Export control | ||||||||||||||||||||||||||||||||
|
Example This element type declares that export is enabled.
<elementType name='myElementType' export='true'> <sequence> <elementTypeRef name='e1'/> <elementTypeRef name='e2'/> </sequence> <attrGroupRef name='attrgrpname'/> </elementType>
As with any other construct, an elementType or attribute which is not exported cannot be imported for use in the declaration of a content model in an importing schema. However, an instance document providing a namespace qualified element is required to conform with the full archetype of that element, including attributes and elements which might not have been explicitly exported or imported; validating processors are required to check for conformance with the full archetype as declared in the exporting schema.
Similarly, an exported archetype applied to an elementType definition in an importing schema confers its full content type and attribute definitions, including references to elements, content models and attributes which may not have been explicitly exported.
NOTE: For example, if schema B exports 'myElement', which relies on unexported constructs from schema B, instances of myElement must conform to its declared content model, including to elements and attributes which might themselves not be overtly exported.
Section Exporting Schema Constructs describes the means by which one schema can offer constructs for use in other schemas. Here we contrast two facilities which are provided for combining two or more schemas into a single schema definition. These facilities are referred to as Schema Import and Schema Inclusion respectively.
Schema import provides for schema validation of content models for instance documents that refer to two or more namespaces. Schema inclusion supports modular development and composition of a schema that is ultimately indistinguishable from an equivalent schema developed as a monolithic unit. Stated another way, imported schema components retain their original URI schema name association; included components are effectively re-declared in the including schema, and are thus indistinguishable from similar constructions declared locally.
NOTE: As described below, import and include operations are effected by declarations at the head of the schema. Therefore, it is possible to discover all of a schema's external dependencies by inspection of its import and include declarations.
An external schema must be explicitly imported for use via a declaration at the head of the importing schema document.
Import | ||||
|
As explained in References to Schema Constructs, imported features can be accessed through an explict schemaName URI or through a shorthand abbreviation (schemaAbbrev).
Example A valid instance would look like the following, delta any namespace prefix changes:
<schema name='http://coolbits.com/someschema.xsd'> <!-- Establish 'other' abbrev for use in schema --> <import schemaAbbrev='other' schemaName='http://coolbits.com/otherschema.xsd'/> <!-- can use 'other' anywhere in schema body --> <elementType name='myNewElement'> <choice> <elementTypeRef schemaAbbrev='other' name='myElement'/> <elementTypeRef schemaAbbrev='other' name='otherElement'/> </choice> </elementType> </schema>The default namespace establishes that
<myNewElement xmlns='http://coolbits.com/someschema.xsd' xmlns:pref1='http://coolbits.com/otherschema.xsd'> <pref1:myElement/> <pref1:otherElement/> </myNewElement>myNewElement
is an element name in the default namespace, and the two subordinate elements are from the namespace associated with thepref1
prefix.
Use of schema abbreviations is explained in detail below.
As described in The Schema, the schema's schemaName property supplies a [URI] to name the schema being declared. When multiple schemas are composed, a schemaRef (which is either the full schemaName URI or the shorthand schemaAbbrev) is used to reference definitions and declarations from imported schemas. schemaAbbrevs are introduced via the Schema Import mechanism.
Example The following example illustrates the general role of abbreviations in qualifying references to composed schemas: The example illustrates the use of references, in a single content model, to an unqualified and a abbreviation-qualified element type. A schema named with the URI 'http://coolbits.com/someschema.xsd' is shown importing features from another schema named 'http://coolbits.com/otherschema.xsd'. No abbreviation is used in the content model for element 'someelement', to indicate that 'name1' is a reference to an element defined locally. In contrast, 'name2' is qualified by the 'schema2' abbreviation and is therefore defined in 'otherschema.xsd'.
<schema name='http://coolbits.com/someschema.xsd'> <import schemaAbbrev='schema2' schemaName='http://coolbits.com/otherschema.xsd'/> <elementType name='someelement'> <sequence> <elementTypeRef name='name1'/> <elementTypeRef name='name2' schemaAbbrev='schema2' /> </sequence> </elementType> </schema>
Further details of schema composition are spelled out formally in the sections below.
Import can be restricted to categories such as datatypes, archetypes, element types, and so on:
Import restrictions | ||||||||||||||||||||||||||||||||
|
Example The following example illustrates control of schema import by category: In the example, all datatypes and achetypes that are exported from 'otherschema', as well as the elements named 'myElement' and 'otherElement' are imported.
<schema name='http://coolbits.com/someschema.xsd'> <!-- Establish abbrev1 abbrev for use in schema --> <import schemaAbbrev='abbrev1' schemaName='http://coolbits.com/otherschema.xsd' archetypes='true' datatypes='true' > <elementTypeRef name='myElement'/> <elementTypeRef name='otherElement'/> <import> <choice> <elementRef schemaAbbrev='abbrev1' name='myElement'/> <elementRef schemaAbbrev='abbrev1' name='otherElement'/> </choice> </schema>
Constraint on Schemas: Refer to Schema
The URI associated with a schemaRef in any of
the productions above must successfully
resolve to a schema.
Constraint on Schemas: Name Consistently Defined
The NCName in each of the above
productions must identify a declaration or definition of the corresponding
class (elementType, archetype, etc.)
Schema-validity Constraint: Use Only Exported Defns
It is not an error for a schema to explicitly import a construct which has
not been exported. However, it is an error for a schema to attempt to use such
construct.
NOTE: A question arises as to whether imported definitions are re-exported for use by yet a third schema. Because of the difficulties in managing abbrev associations, the answer is 'no', at least in this draft of the specification.
Imported constructs are not implicitly and cannot explicitly be re-exported. However, any element or archetype is imported with its full content model, even when that content model depends on recursively imported elements or attributes. Similarly, an attribute definition can carry a datatype from an external schema, and so on. In other words, myElement in the example above might have a content model that draws on many schemas. Element1 itself is usable as shown above, but its constituent components are only available for use in new content models if explicitly imported.
Furthermore, if some schema B includes features of schema A, and if schema C includes features of B, then C can also explicitly include the same features of schema A directly.
Although the declarations for schema inclusion resemble those for importation, the purpose is quite different. Element types, attributes, model groups, etc. are effectively redeclared when included in a schema. Specifically, the resulting construct is named in a symbol space of the including schema. As seen by authors of instance documents and other schemas, the result is indistinguishable from a definition or declaration made in the including schema.
Include | ||||
|
An include specification is equivalent to a local definition of the corresponding elementTypes, archetypes, datatypes, attributes, model groups, entities, notations, and attribute groups.
Example The following example illustrates inclusion: The two elements, myElement and otherElement, are deemed to part of the overall schema's namespace. Barring accidental name collision, these two foreign element types can be treated just as though they were defined in the current schema. The definitions of their datatypes, achetypes, elements and attributes, are also implicitly included.
<schema name='http://coolbits.com/someschema.xsd'> <include schemaName='http://coolbits.com/otherschema.xsd'> <elementRef name='myElement'/> <elementRef name='otherElement'/> <include> <!-- Note unqualified references below --> <choice> <elementTypeRef name='myElement'/> <elementTypeRef name='otherElement'/> </choice> </schema>
Because the intention is to hide the inclusion hierarchy from users, any declarations or definitions on which the inclusion depends, and which are themselves declared locally in or included by the included schema, are similarly redeclared in the including schema. Conversely, definitions or declarations imported by an included schema are effectively imported when used in an including schema.
NOTE: There is some question as to whether all such features should be implicitly imported, or whether features should be imported only when needed to complete the specification of some explicitly included feature (e.g. an imported attribute needed on an included element type.)
An inclusion is treated as a local definition, so naming collisions are possible with other locally defined or included constructs. [Definition: ] All include declarations encountered in a schema form a schema path in the order encountered. When two or more includes would cause the definition or declaration of identically named elements (I.e. the same NCName in the same symbol space), the first one encountered in the schema path (I.e. the first included) is used and any others are ignored. A local definition or declaration in an including schema supersedes any definition or declaration from any included schema.
[Definition: ] A schema directly includes another schema if the first schema has an include and the URI contained in or abbreviated by the schemaRef of that include resolves successfully to the second schema.
[Definition: ] A schema eventually includes another schema if the first schema directly includes the second, or if the first schema directly includes some other schema which itself eventually includes the second.
Constraint on Schemas: Preorder Priority for Included Definitions
When using a ...Ref to identify
a ...Spec, if there is no appropriate matching declaration or definition
in the current schema, but there is more than one
eventually included schema
which contains an appropriate matching declaration or definition, the
...Spec whose declaration or definition occurs first in a preorder
traversal of the eventually
included schemas is the one identified.
Validation requires that one or more schemas be available to the validating processor. As specified above, schemas are named by URI's, which can but need not resemble in form a [URL].
The means used by some particular processor to access a schema, based on its URI, are beyond the scope of this specification, and are expected to vary from processor to processor. Whether a URI that resembles a URL is indeed usable as a URL during validation is application- and processor-dependent. This specification requires that the transitive closure of all schemas required for validation must be accessible to the processor, through whatever means, based on the URI name of each schema.
NOTE: Why this choice? Several reasons, including:
NOTE: Documentation facilities have purposely been left out of this draft of the XML Schema Definition Language specification. The editors chose to concentrate on other topics. It is anticipated that explanation elements will be provided for within any of the Schema elements. Their purpose is to encapsulate documentation for the elements within which they are contained. Elements for narrative exposition at the top level of a schema have also been proposed.
Proposals for XML Schema documentation include defining a custom set of elements, allowing any content at all, allowing all or part of [HTML-4], DocBook or TEI. There are good arguments for each of these proposals.
The Working Group must identify its requirements and constraints.
Issue (error-behavior): This draft includes extensive discussion of conformance and validity checking, but rules for dealing with errors are missing. In future, we must distinguish errors from fatal errors, and clarify rules for dealing with both.
We approach the definition of schema validity one step at a time. In the definitions below we deal primarily in terms of information sets, rather than the documents which give rise to them: see [XML-Infoset] for definitions of item, RUE and information set.) Please note that the formal definitions below are explicitly not couched in processing terms: they describe properties of an information set, but do not tell you how to check an information set to see if it has those properties.
First we have to get to the schema(s) involved. This is slightly tricky, as not all namespace declarations will resolve to schemas, and not everything that purports to be a schema will be one.
[Definition: ] A URI is said to
nominate a schema if it resolves to an element item in the
information set of a well-formed XML 1.0 document whose local name is
schema
and whose namespace item's URI identifies either
[Definition: ] A URI is said to resolve successfully to a schema if it nominates a schema, and the element item it resolves to represents an XML schema, that is:
[Definition: ] An element item is schema-ready if the URI of any of its namespace declaration items which nominates a schema resolves successfully to a schema.
Issue (namespace-declaration-items): Namespace items associated with namespace declarations have disappeared from the most recent version [XML-Infoset]. Several WGs need them, we expect they'll be back, otherwise we can reconstruct what we need from element and attribute namespace items alone with some effort.
[Definition: ] A document is schema-ready if every element item anywhere in its information set is schema-ready.
Note that this means that documents with no namespace declarations, or only namespace declarations which do not nominate schemas are none-the-less schema-ready.
[Definition: ] We say an element item is schema-governed if its name is in a namespace, and the URI of the information item for that namespace resolves successfully to a schema.
[Definition: ] We use the name schema root for any element item which is schema-governed and which is either
The provision within XML Schema: Structures of a mechanism for defining
parsed entities presents problems
for the relationship between schema-validity and XML 1.0 well-formedness, since
references to entities defined only in a schema are undefined from the XML 1.0
perspective. Strictly speaking, a well-formed XML document may contain
references to undefined entities only if it is declared as
standalone='no'
and contains either an external subset
or one or more references to external parameter entities in their internal
subset. We get around this by [Definition: ] defining a nearly well-formed XML
document to be one which either is well-formed per XML 1.0, or which fails to
be well-formed only because of undefined general entity references, but which
would be well-formed if it were standalone='no'
and
identified an external subset. We consider this justified on the
grounds that the use of a namespace declaration which refers to a schema
functions rather as an external subset, and from the XML 1.0 perspective such a
reference almost of necessity renders the document non-standalone when
schema-validation is applied.
[Definition: ] We use the name string-infoset-in-context for the XML 1.0 information set items arising from the interpretation of a string in the context of a particular point in an XML 1.0 information set.
[Definition: ] The effective element item of an element item (call this OEI) is an element item whose
Schema-validity Constraint: Expansions Schema-Ready
Any element item anywhere within the string-infoset-in-context replacing an RUE child per
the above must be schema-ready.
Schema-validity Constraint: Ungoverned RUE
RUEs must not appear in element items
which are not schema-governed,
that is in the values of attributes of or as children of such elements.
Schema-validity Constraint: RUE Entity Declared
For every RUE appearing in a
schema-governed element, there
must be a parsed entity declaration in the referenced schema whose name matches
the name of the RUE.
Note that the above constraints and definition mean that in error-free documents, all element items, even ones which are not schema-governed, have well-defined effective element items.
[Definition: ] A document is schema-valid if and only if:
NOTE: The validity of all other schema-governed element items follows from (3) above by the recursive nature of the Schema-validity Constraint referenced there.
NOTE: It is intentional that the above definition labels as schema-valid a document with no namespace declarations or with only namespace declarations which do not nominate schemas.
Note that there is no requirement that the schema root mentioned above be the root of its document, or that schemas be the roots of their documents, or that schema and schema root be in different documents. Accordingly, it is possible for a single schema-valid document to contain both a schema and the material which it validates.
The interaction between XML 1.0 DTDs and XML Schemas is complex but clear:
NOTE: The above is silent on whether schema-valid documents must be Namespace-conforming.
[Definition: ] The augmented information set of a schema-valid document is the information set rooted in the effective element item of its document element, augmented by all the information items described in any Schema Information Set Contributions which apply to any information items anywhere within it.
NOTE: This section has fallen out of alignment with the rest of the specification, but is included none-the-less to give a feeling for how this section will eventually look: the details should not be taken too seriously.
Each step in the following presupposes the successful outcome of the previous step.
A conforming XML Schema processor must:
NOTE: Note that the schema contribution to the information set above is meant to be suggestive only at this point, until we've articulated all the Schema Information Set Contributions in the preceding sections.
The XML Schema definition for XML Schema: Structures itself is presented here as normative part of the specification, and as an illustrative example of the XML Schema in defining itself with the very constructs that it defines. The names of XML Schema language archetypes, element types, attributes and groups defined here are evocative of their purpose, but are occasionally verbose.
There is some annotation in comments, but a fuller annotation will require the use of embedded documentation facilities or a hyperlinked external annotation for which tools are not yet readily available.
<?xml version='1.0'?> <!DOCTYPE schema PUBLIC '-//W3C//DTD XMLSCHEMA 19990506//EN' 'http://www.w3.org/1999/05/06-xmlschema-1/structures.dtd'> <schema xmlns='http://www.w3.org/1999/05/06-xmlschema-1/structures.xsd' name='http://www.w3.org/1999/05/06-xmlschema-1/structures.xsd' version='0.4' > |
Since an XML Schema: Structures is an XML document, it has optional XML and doctype
declarations that are provided here for completeness. The root
schema
element defines a new schema. Since this is a schema for
XML Schema: Structures, the xmlSchemaRef references the schema name itself. and specifies that this
is version "0.4".
In the following definition of the schema
element type, the
preamble is reproduced with attributes corresponding
to schemaName, schemaVersion and model,
and a sequence of nested elements for import,
export and include. The
xmlns attribute corresponds to xmlSchemaRef. The
schema
's definitions and declarations are represented by
datatype
, archetype
, elementType
,
attrDecl
, attrGroup
, modelGroup
,
textEntity
, externalEntity
,
unParsedEntity
and notation
.
<!-- ################################################ --> <!-- ################################################ --> <!-- The datatype element type, and all of its members are defined in XML Schema: Part 2: Datatypes --> <include schemaName="http://www.w3.org/1999/05/06-xmlschema-2/datatypes.xsd"> <!-- The NCName datatype is widely used for names of components --> <datatype name="NCName"><basetype name="NMTOKEN"/></datatype> <!-- The public datatype is used for entities and notations --> <datatype name="public"><basetype name="string"/></datatype> <!-- ################################################ --> <!-- ################################################ --> <!-- schema element type --> <elementType name="schema"> <sequence> <elementTypeRef name="import" minOccur="0"/> <elementTypeRef name="export" minOccur="0"/> <elementTypeRef name="include" minOccur="0"/> <choice minOccur="0"> <elementTypeRef name="datatype"/> <elementTypeRef name="archetype"/> <elementTypeRef name="elementType"/> <elementTypeRef name="attrDecl"/> <elementTypeRef name="attrGroup"/> <elementTypeRef name="modelGroup"/> <elementTypeRef name="textEntity"/> <elementTypeRef name="externalEntity"/> <elementTypeRef name="unparsedEntity"/> <elementTypeRef name="notation"/> </choice> </sequence> <attrDecl name="name"> <datatypeRef name="uri"> </datatypeRef> </attrDecl> <attrDecl name="version"> <datatypeRef name="string"> </datatypeRef> </attrDecl> <attrDecl name="xmlns"> <datatypeRef name="uri"> <default>http://www.w3.org/1999/05/06-xmlschema-1/structures.xsd </default> </datatypeRef> </attrDecl> <attrGroupRef name="model"/> </elementType> <attrGroup name="model"> <attrDecl name="model"> <datatypeRef name="NCName"> <default>closed</default> </datatypeRef> </attrDecl> </attrGroup> <!-- ################################################ --> <!-- import, export and include --> <!-- The import, export and include elements all include the restrictions attribute group, whose attributes can be used to enable or disable import and export restrictions. Within import and include elements, references to the components of foreign schemas control their importation or inclusion, respectively. --> <!-- ################################################ --> <!-- import element type --> <elementType name="import"> <choice> <elementTypeRef name="datatypeRef"/> <elementTypeRef name="archetypeRef"/> <elementTypeRef name="elementTypeRef"/> <elementTypeRef name="attrGroupRef"/> <elementTypeRef name="modelGroupRef"/> <elementTypeRef name="entityRef"/> <elementTypeRef name="notationRef"/> </choice> <attrDecl name="schemaAbbrev" required="true"> <datatypeRef name="NCName"> </datatypeRef> </attrDecl> <attrDecl name="schemaName" required="true"> <datatypeRef name="uri"> </datatypeRef> </attrDecl> <attrGroupRef name="restrictions"/> </elementType> <!-- export element type --> <elementType name="export"> <empty/> <attrGroupRef name="restrictions"/> </elementType> <!-- include element type --> <elementType name="include"> <choice> <elementTypeRef name="datatypeRef"/> <elementTypeRef name="archetypeRef"/> <elementTypeRef name="elementTypeRef"/> <elementTypeRef name="attrGroupRef"/> <elementTypeRef name="modelGroupRef"/> <elementTypeRef name="entityRef"/> <elementTypeRef name="notationRef"/> </choice> <attrGroupRef name="restrictions"/> </elementType> <attrGroup name="restrictions"> <attrDecl name="datatypes"> <datatypeRef name="boolean"> <default>true</default> </datatypeRef> </attrDecl> <attrDecl name="archetypes"> <datatypeRef name="boolean"> <default>true</default> </datatypeRef> </attrDecl> <attrDecl name="elementTypes"> <datatypeRef name="boolean"> <default>true</default> </datatypeRef> </attrDecl> <attrDecl name="attrGroups"> <datatypeRef name="boolean"> <default>true</default> </datatypeRef> </attrDecl> <attrDecl name="modelGroups"> <datatypeRef name="boolean"> <default>true</default> </datatypeRef> </attrDecl> <attrDecl name="entities"> <datatypeRef name="boolean"> <default>true</default> </datatypeRef> </attrDecl> <attrDecl name="notations"> <datatypeRef name="boolean"> <default>true</default> </datatypeRef> </attrDecl> </attrGroup> <!-- ################################################ --> <!-- Fundamental archetypes needed to build the schema --> <!-- Two fundamental archetypes (components and references) are used hereafter to build the schema. --> <!-- A component specifies its own name and its export control. --> <!-- ################################################ --> <!-- component archetype --> <archetype name="component" model="refinable"> <empty/> <attrDecl name="name"> <datatypeRef name="NCName"> </datatypeRef> </attrDecl> <attrDecl name="export"> <datatypeRef name="boolean"> </datatypeRef> </attrDecl> </archetype> <!-- A reference specifies the name of a component, and optionally a schemaAbbrev or schemaName attribute. --> <!-- reference archetype --> <archetype name="reference" model="refinable"> <empty/> <attrDecl name="name" required="true"> <datatypeRef name="NCName"> </datatypeRef> </attrDecl> <attrDecl name="schemaAbbrev"> <datatypeRef name="NCName"> </datatypeRef> </attrDecl> <attrDecl name="schemaName"> <datatypeRef name="uri"> </datatypeRef> </attrDecl> </archetype> <!-- ################################################ --> <!-- ######### COMPONENTS ########################### --> <!-- ################################################ --> <!-- A datatypeRef element type is based on the reference archetype. It provides for specification of datatype qualification through the ordered and unordered facets and through the optional default and fixed elements. The content model is tentative, pending future coordination work between the is tentative, pending further coordination between the schema definition and datatype definition specifications. --> <!-- datatypeRef element type --> <archetype name="datatypeRef"> <refines> <archetypeRef name="reference"/> </refines> <all> <all> <modelGroupRef name="ordered"/> <modelGroupRef name="unordered"/> </all> <choice minOccur="0" maxOccur="1"> <elementTypeRef name="default"/> <elementTypeRef name="fixed"/> </choice> </all> </archetype> <!-- datatypeRef element type --> <elementType name="datatypeRef"> <archetypeRef name="datatypeRef"/> </elementType> <!-- default element type --> <elementType name="default"> <datatypeRef name="string"> </datatypeRef> </elementType> <!-- fixed element type --> <elementType name="fixed"> <datatypeRef name="string"> </datatypeRef> </elementType> <!-- The archetype element type is based on the component archetype. It may include a refines element that specifies the archetype that is is based on, and either a datatypeRef or a model, followed by any number of attrDecl and attrGroupRef elements. --> <!-- ################################################ --> <!-- ################################################ --> <!-- archetype element type --> <elementType name="archetype"> <refines> <archetypeRef name="component"/> </refines> <sequence> <elementTypeRef name="refines"/> <choice> <elementTypeRef name="datatypeRef"/> <modelGroupRef name="model"/> </choice> <elementTypeRef name="attrDecl"/> <elementTypeRef name="attrGroupRef"/> </sequence> <attrGroupRef name="model"/> </elementType> <!-- The model model group, and the modelElt model group that it references, are reusable content model fragments. The model model group is used in the definition of the archetype, elementType and modelGroup element types. Its members are defined later. --> <modelGroup name="model"> <choice> <elementTypeRef name="any"/> <elementTypeRef name="empty"/> <elementTypeRef name="mixed"/> <modelGroupRef name="modelElt"/> </choice> </modelGroup> <modelGroup name="modelElt"> <choice> <elementTypeRef name="all"/> <elementTypeRef name="choice"/> <elementTypeRef name="elementType"/> <elementTypeRef name="elementTypeRef"/> <elementTypeRef name="sequence"/> <elementTypeRef name="modelGroupRef"/> </choice> </modelGroup> <!-- The archetypeRef element type is based on the reference archetype. --> <!-- archetypeRef element type --> <elementType name="archetypeRef"> <archetypeRef name="reference"/> </elementType> <!-- The elementType element type is based in the component archetype. It is almost identical to the archetype element type except that it additionally provides for immediate specification of an archetypeRef upon which its definition is based. --> <!-- The elementTypeRef is based upon the reference archetype. It additionally provides for specification of minOccurs and maxOccurs attributes used when defining a content model. --> <!-- ################################################ --> <!-- ################################################ --> <!-- elementType element type --> <elementType name="elementType"> <refines> <archetypeRef name="component"/> </refines> <sequence> <elementTypeRef name="refines"/> <choice> <elementTypeRef name="datatypeRef"/> <elementTypeRef name="archetypeRef"/> <modelGroupRef name="model"/> </choice> <elementTypeRef name="attrDecl"/> <elementTypeRef name="attrGroupRef"/> </sequence> <attrGroupRef name="model"/> </elementType> <!-- elementTypeRef element type --> <elementType name="elementTypeRef"> <archetypeRef name="reference"/> <attrGroupRef name="occurrence"/> </elementType> <attrGroup name="occurrence"> <attrDecl name="minOccur"> <datatypeRef name="integer"> <default>1</default> </datatypeRef> </attrDecl> <attrDecl name="maxOccur"> <datatypeRef name="integer"> <default>1</default> </datatypeRef> </attrDecl> </attrGroup> <!-- The modelGroup element type is based on the component archetype. It must contain elements of the model model group, and it may specify its model and occurrence attributes. --> <!-- The modelGroupRef element type is based on the reference archetype. --> <!-- ################################################ --> <!-- ################################################ --> <!-- modelGroup element type --> <elementType name="modelGroup"> <refines> <archetypeRef name="component"/> </refines> <modelGroupRef name="model"/> <attrGroupRef name="model"/> <attrGroupRef name="occurrence"/> </elementType> <!-- modelGroupRef element type --> <elementType name="modelGroupRef"> <archetypeRef name="reference"/> <attrGroupRef name="occurrence"/> </elementType> <!-- The modelGroup element type is based in the component archetype. It provides for one or more attrDecl and attrGroupRef elements. --> <!-- The attrGroupRef element type is based on the reference archetype. --> <!-- ################################################ --> <!-- ################################################ --> <!-- attrGroup element type --> <elementType name="attrGroup"> <refines> <archetypeRef name="component"/> </refines> <choice minOccur="1" maxOccur="*"> <elementTypeRef name="attrDecl"/> <elementTypeRef name="attrGroupRef"/> </choice> <attrGroupRef name="model"/> </elementType> <!-- attrGroupRef element type --> <elementType name="attrGroupRef"> <archetypeRef name="reference"/> </elementType> <!-- The textEntity element type is based on the component archetype. It provides for string content to specify the entity value. --> <!-- ################################################ --> <!-- ################################################ --> <!-- entities --> <!-- textEntity element type --> <elementType name="textEntity"> <datatypeRef name="string"> </datatypeRef> </elementType> <!-- The externalEntity and unparsedEntity element types are based on the component archetype. They provide for specification of a URI, an optional public identifier, and a notation attribute. --> <!-- externalEntity element type --> <elementType name="externalEntity"> <refines> <archetypeRef name="component"/> </refines> <empty/> <attrGroupRef name="external"/> </elementType> <!-- unparsedEntity element type --> <elementType name="unparsedEntity"> <refines> <archetypeRef name="component"/> </refines> <empty/> <attrGroupRef name="external"/> </elementType> <attrGroup name="external"> <attrDecl name="system" required="true"> <datatypeRef name="uri"> </datatypeRef> </attrDecl> <attrDecl name="public"> <datatypeRef name="public"> </datatypeRef> </attrDecl> <attrDecl name="notation" required="true"> <datatypeRef name="notation"> <default>XML</default> </datatypeRef> </attrDecl> </attrGroup> <!-- The entityRef elementType is based on the reference archetype. --> <!-- entityRef element type --> <elementType name="entityRef"> <archetypeRef name="reference"/> </elementType> <!-- The notation element type is based on the component archetype. The notationRef element type is based in the reference archetype. --> <!-- notation element type --> <elementType name="notation"> <refines> <archetypeRef name="component"/> </refines> <empty/> <attrGroupRef name="external"/> </elementType> <!-- notationRef element type --> <elementType name="notationRef"> <archetypeRef name="reference"/> </elementType> <!-- ################################################ --> <!-- ################################################ --> <!-- Content model atoms --> <elementType name="any"> <empty/> </elementType> <elementType name="empty"> <empty/> </elementType> <elementType name="mixed"> <choice minOccur="0" maxOccur="*"> <elementTypeRef name="elementTypeRef"/> <elementTypeRef name="elementType"/> </choice> </elementType> <!-- ################################################ --> <!-- ################################################ --> <!-- Element groups --> <archetype name="compositor"> <choice minOccur="2" maxOccur="*"> <modelGroupRef name="modelElt"/> <elementTypeRef name="elementType"/> </choice> <attrGroupRef name="occurrence"/> </archetype> <elementType name="all"> <archetypeRef name="compositor"/> </elementType> <elementType name="choice"> <archetypeRef name="compositor"/> </elementType> <elementType name="sequence"> <archetypeRef name="compositor"/> </elementType> <!-- ################################################ --> <!-- ################################################ --> <!-- notations for use within XML Schema: Structures --> <notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/1999/05/06-xmlschema-1/structures.xsd"/> <notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/> </schema> |
NOTE: And that is the end of the schema for XML Schema: Structures.
The following is the DTD for XML Schema: Structures:
<!ELEMENT schema ((import*, include*, export?, (comment | datatype | archetype | elementType | attrGroup | modelGroup | notation | textEntity | externalEntity | unparsedEntity)* ))> <!ATTLIST schema name CDATA #IMPLIED version CDATA #IMPLIED xmlns CDATA "http://www.w3.org/1999/05/06-xmlschema-1/structures.xsd" model (open|refinable|closed) "closed" > <!ELEMENT import (( elementTypeRef | archetypeRef | datatypeRef | modelGroupRef | attrGroupRef | entityRef | notationRef )* ) > <!ATTLIST import schemaAbbrev NMTOKEN #REQUIRED schemaName CDATA #REQUIRED datatypes (true|false) "true" archetypes (true|false) "true" elementTypes (true|false) "true" attrGroups (true|false) "true" modelGroups (true|false) "true" entities (true|false) "true" notations (true|false) "true" > <!ELEMENT export EMPTY > <!ATTLIST export datatypes (true|false) "true" archetypes (true|false) "true" elementTypes (true|false) "true" attrGroups (true|false) "true" modelGroups (true|false) "true" entities (true|false) "true" notations (true|false) "true" > <!ELEMENT include (( elementTypeRef | archetypeRef | datatypeRef | modelGroupRef | attrGroupRef | entityRef | notationRef )* ) > <!ATTLIST include schemaName CDATA #REQUIRED datatypes (true|false) "true" archetypes (true|false) "true" elementTypes (true|false) "true" attrGroups (true|false) "true" modelGroups (true|false) "true" entities (true|false) "true" notations (true|false) "true" > <!-- --> <!-- comments contain text --> <!-- --> <!ELEMENT comment (#PCDATA) > <!-- --> <!-- The datatype element is defined in XML Schema: Part 2: Datatypes --> <!-- --> <!ENTITY % xs-datatypes PUBLIC "datatypes" "http://www.w3.org/1999/05/06-xmlschema-2/datatypes.dtd" > %xs-datatypes; <!ELEMENT datatypeRef ((%ordered; | %unordered)*, (default|fixed)*) > <!ATTLIST datatypeRef name NMTOKEN #REQUIRED schemaAbbrev NMTOKEN #IMPLIED schemaName CDATA #IMPLIED > <!ELEMENT default (#PCDATA) > <!ELEMENT fixed (#PCDATA) > <!ENTITY % modelElt "all|choice|elementTypeRef|elementType|sequence" > <!ENTITY % model "any|empty|%modelElt;|mixed" > <!-- --> <!-- an archetype is a named content type specification --> <!-- --> <!ELEMENT archetype ( refines?, ( datatypeRef | (%model; | modelGroupRef) )?, (attrDecl | attrGroupRef)* ) > <!ATTLIST archetype name NMTOKEN #REQUIRED export (true|false) "true" model (open|refinable|closed) #IMPLIED > <!ELEMENT refines (archetypeRef)* > <!ELEMENT archetypeRef EMPTY > <!ATTLIST archetypeRef name NMTOKEN #REQUIRED schemaAbbrev NMTOKEN #IMPLIED schemaName CDATA #IMPLIED > <!-- --> <!-- an elementType is a named element and its content type --> <!-- --> <!ELEMENT elementType ( refines?, ( datatypeRef | archetypeRef | (%model; | modelGroupRef) )?, (attrDecl | attrGroupRef)* ) > <!ATTLIST elementType name NMTOKEN #REQUIRED export (true|false) "true" model (open|refinable|closed) #IMPLIED > <!ELEMENT elementTypeRef EMPTY > <!ATTLIST elementTypeRef name NMTOKEN #REQUIRED schemaAbbrev NMTOKEN #IMPLIED schemaName CDATA #IMPLIED minOccur CDATA "1" maxOccur CDATA #IMPLIED > <!-- --> <!-- a model is a named content model (without attributes) --> <!-- --> <!ELEMENT modelGroup (%modelElt;) > <!ATTLIST modelGroup name NMTOKEN #REQUIRED export (true|false) "true" > <!ELEMENT modelGroupRef EMPTY > <!ATTLIST modelGroupRef name NMTOKEN #REQUIRED schemaAbbrev NMTOKEN #IMPLIED schemaName CDATA #IMPLIED minOccur CDATA "1" maxOccur CDATA #IMPLIED > <!ELEMENT any EMPTY > <!ELEMENT empty EMPTY > <!ELEMENT mixed (elementTypeRef|elementType)* > <!ELEMENT sequence (modelGroupRef | sequence | choice | all | elementType | elementTypeRef)+ > <!ATTLIST sequence minOccur CDATA "1" maxOccur CDATA #IMPLIED > <!ELEMENT choice (modelGroupRef | sequence | choice | all | elementType | elementTypeRef)+ > <!ATTLIST choice minOccur CDATA "1" maxOccur CDATA #IMPLIED > <!ELEMENT all (modelGroupRef | sequence | choice | all | elementType | elementTypeRef)+ > <!ATTLIST all minOccur CDATA "1" maxOccur CDATA #IMPLIED > <!-- --> <!-- an attrDecl names an attribute specification --> <!-- the datatypeRef default is "string" --> <!-- the attrValue allows * for NMTOKEN lists --> <!-- --> <!ELEMENT attrDecl (datatypeRef?) > <!ATTLIST attrDecl name NMTOKEN #REQUIRED required (true|false) "false" > <!-- an attrGroup is a named collection of attrDecls --> <!ELEMENT attrGroup (attrDecl | attrGroupRef)+ > <!ATTLIST attrGroup name NMTOKEN #REQUIRED export (true|false) "true" > <!ELEMENT attrGroupRef EMPTY > <!ATTLIST attrGroupRef name NMTOKEN #REQUIRED schemaAbbrev NMTOKEN #IMPLIED schemaName CDATA #IMPLIED > <!-- --> <!-- Entities and notations in XML Schema --> <!-- --> <!-- the three kinds of entities share a symbol space --> <!ELEMENT entityRef EMPTY > <!ATTLIST entityRef name NMTOKEN #REQUIRED schemaAbbrev NMTOKEN #IMPLIED schemaName CDATA #IMPLIED > <!-- a textEntity can be referenced in documents of this type --> <!ELEMENT textEntity (#PCDATA) > <!ATTLIST textEntity name NMTOKEN #REQUIRED export (true|false) #FIXED "true" > <!-- an externalEntity can be referenced in documents of this type --> <!ELEMENT externalEntity EMPTY > <!ATTLIST externalEntity name NMTOKEN #REQUIRED export (true|false) #FIXED "true" public CDATA #IMPLIED system CDATA #REQUIRED notation NMTOKEN #FIXED "XML"> <!-- declares notation to be a 1st class element or entity content types --> <!ELEMENT notation EMPTY > <!ATTLIST notation name NMTOKEN #REQUIRED export (true|false) #FIXED "true" public CDATA #REQUIRED system CDATA #IMPLIED> <!ELEMENT notationRef EMPTY > <!ATTLIST notationRef name NMTOKEN #REQUIRED schemaAbbrev NMTOKEN #IMPLIED schemaName CDATA #IMPLIED > <!-- an unparsedEntity can be referenced in documents of this type --> <!ELEMENT unparsedEntity EMPTY > <!ATTLIST unparsedEntity name NMTOKEN #REQUIRED export (true|false) #FIXED "true" public CDATA #IMPLIED system CDATA #REQUIRED notation NMTOKEN #REQUIRED > <!NOTATION XMLSchemaStructures PUBLIC "structures" "http://www.w3.org/1999/05/06-xmlschema-1/structures.xsd" > <!NOTATION XML PUBLIC "REC-xml" "http://www.w3.org/TR/1998/REC-xml-19980210" > |
Ed. Note: The Glossary has barely been started. An XSL macro will be used to collect definitions from throughout the spec and gather them here for easy reference.
Fourth
Meeting of the W3C XML Schema Working Group. See http://www.w3.org/XML/Group/1999/04/xml-schema-ftf.html
|
Document
Content Description for XML (DCD), Tim Bray et al. W3C, 10 August 1998.
See http://www.w3.org/TR/NOTE-dcd
|
Document
Definition Markup Language. See
http://www.w3.org/TR/NOTE-ddml
|
HTML 4.0
Specification, Dave Raggett et al. W3C, 1998. See
http://www.w3.org/TR/REC-html40
|
ISO 11404 -- Information Technology -- Programming Languages, their environments and system software interfaces -- Language-independent datatypes, ISO/IEC 11404:1996(E). |
RFC
1808,Relative Uniform Resource Locators. Internet Engineering Task
Force. See http://ds.internic.net/rfc/rfc1808.txt
|
Schema for
Object-oriented XML, Matt Fuchs, et al. W3C, 1998. See
http://www.w3.org/Submission/1998/15/
|
Schema for Object-oriented XML, Version 1.1, Matt Fuchs, et al. W3C, 1999. See ??? |
Uniform
Resource Identifiers (URI): Generic Syntax and Semantics. See
http://www.ics.uci.edu/pub/ietf/uri/draft-fielding-uri-syntax-01.txt
|
RFC
1738,Uniform Resource Locators (URL). Internet Engineering Task
Force. See http://ds.internic.net/rfc/rfc1738.txt
|
RFC 2141,URN
Syntax. Internet Engineering Task Force. See
http://ds.internic.net/rfc/rfc2141.txt
|
WAI Accessibility Guidelines: Page Authoring, Gregg Vanderheiden
et al. W3C, 14-Apr-1998. See http://www.w3.org/TR/WD-WAI-PAGEAUTH
|
Web Architecture: Extensible Languages, Tim
Berners-Lee and Dan Connolly. W3C, 10 Feb 1998. See
http://www.w3.org/TR/NOTE-webarch-extlang
|
Proposed TC for WebSGML Adaptations for SGML, C. F. Goldfarb, ed.,
14 June 1997. See http://www.sgmlsource.com/8879rev/n1929.htm
|
XML-Data
Reduced, Frankston, Charles, and Henry S. Thompson, ed. See
http://www.ltg.ed.ac.uk/~ht/XMLData-Reduced.htm
|
XML Linking
Language (XLink), Eve Maler and Steve DeRose, W3C, 3 March 1998. See
http://www.w3.org/TR/WD-xlink
|
XML Schema Requirements , Ashok Malhotra and Murray Maloney, ed.,
W3C, 15 February 1999. See http://www.w3.org/TR/NOTE-xml-schema-req
|
XML Schema Part 2: Datatypes, Paul V. Biron and Ashok
Malhotra, eds. See http://www.w3.org/1999/05/06-xmlschema-2/datatypes
|
Extensible
Markup Language (XML) 1.0, Tim Bray, et al. W3C, 10 February 1998. See
http://www.w3.org/TR/REC-xml
|
XML-Data, Andrew Layman, et al. W3C, 05 January 1998. See
http://www.w3.org/TR/1998/NOTE-XML-data-0105
|
XML Information Set (first public WD),
David Megginson et al., W3C, 1999. See
http://www.w3.org/XML/Group/1999/04/WD-xml-infoset-19990428.html
|
Namespaces in XML, Tim Bray et al., W3C, 1998. See
http://www.w3.org/TR/WD-xml-names
|
XML
Pointer Language (XPointer), Eve Maler and Steve DeRose, W3C, 3 March
1998. See http://www.w3.org/TR/WD-xptr
|
XSchema
Specification, Simon St. Laurent, Ronald Bourret, John Cowan, et al.,
Version 1.0, Draft, 18 October 1998. See
http://www.simonstl.com/xschema/spec/xscspecv4.htm
For more general information, consult http://purl.oclc.org/NET/xschema |
Extensible
Stylesheet Language Transformations, James Clark, W3C, 21 April 1999.
See http://www.w3.org/TR/1999/WD-xslt-19990421
|
The editors the acknowledge the members of the W3C XML Schema Working Group, the members of other W3C Working Groups, and industry experts in other forums who have contributed directly or indirectly to the process or content of creating this document. The editors are particularly grateful to Lotus Development Corp. for providing teleconferencing facilities.