Copyright © 2006 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
This specification provides a set of basic [XML Schema 1.0] patterns known to be interoperable between state of the art databinding implementations. The patterns may be used to describe [XML 1.0] representations of commonly used data structures. The data structures described are intended to be independent of any particular programming language, database or modelling environment.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This document has been produced by the XML Schema Patterns for Databinding Working Group, which is part of the W3C Web Services Activity.
Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document is a W3C Last Call Public Working Draft published to solicit comments from interested parties. Please submit comments on this document to the public public-xsd-databinding-comments@w3.org mailing list (public archive). The Last Call period ends 12th January 2007.
The Working Group is also producing an accompanying [Advanced Patterns] document, which will include [XML Schema 1.0] patterns in common use, but which are not well supported by state of the art databinding implementations.
All of the [XML Schema 1.0] patterns presented in this specification are considered to be "features at risk". The Working Group may elect to move a pattern from the specification into the [Advanced Patterns] document during the Last Call period subject to a demonstable lack of support in state of the art databinding implementations.
Patterns for [XML Schema 1.0]
attributes which explicitly provide the default value, such as
@minOccurs="1" may be added to this specification
during Last Call as a result of the resolution to ISSUE-92,
otherwise the Working Group does not expect to add patterns to this
specification which introduce additional [XML
Schema 1.0] elements or attributes.
The publication of this document signifies a call for implementations of this specification. The Working Group solicits contributions to the test suite in the form of implementation reports and additional test cases.
The Working Group plans to submit a subsequent version of this specification to the W3C Director for consideration as a W3C Proposed Recommendation following a demonstration of the interoperability of a significant number of state of the art databinding implementations using the test suite and a collection of implementation reports.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
1. Introduction
1.1 Notational
Conventions
1.2 Namespaces
1.3 Document Conformance
1.4 Implementation Conformance
2. Schema Patterns
2.1 Schema
Element
2.2 Annotations
2.3 Properties
2.4 Import and
Include
2.5 Global
Element Declarations
2.6 Global
Attribute Declarations
2.7 Element
Declarations
2.8 Attribute
Declarations
2.9 Global SimpleType Declarations
2.10 Global ComplexType
Declarations
2.11 SimpleType
Declarations
2.12 ComplexType Declarations
2.13 Sequences
2.14 Element Predefined Types
2.15 Attribute Predefined
Types
3. References
3.1 Normative
References
3.2 Informative
References
A. Detecting Patterns
(Non-Normative)
B. Data Types & Structures
(Non-Normative)
B.1 Null
Value
B.2 Default
Value
B.3 Enumeration
B.4 Collection
B.5 Inherited
Collection
B.6 Vector
C. Relationship with the WS-I Basic Profile
(Non-Normative)
D. Pattern Summary
(Non-Normative)
E. Assertion Summary
(Non-Normative)
F. Acknowledgements
(Non-Normative)
A databinding tool generates a mapping between [XML 1.0] documents which conform to an [XML Schema 1.0] schema and an internal data representation. For example, a Web services databinding tool may use [XML Schema 1.0] descriptions inside a [WSDL 2.0] or [WSDL 1.1] document to produce and consume [XML 1.0], [SOAP 1.2] and [SOAP 1.1] messages in terms of data structures in a programming language or data held inside a database.
[XML Schema 1.0] provides a wide variety of methods for describing the same [XML 1.0] structure. Conversely an abstract concept such as "null" may be represented in a wide variety of different ways using [XML Schema 1.0].
A representative collection of databinding implementations in common use has been used to provide an indication of the "state of the art". State of the art databinding implementations have displayed uneven and inconsistent support of the W3C [XML Schema 1.0] Recommendation resulting in impaired interoperability and a poor user experience of databinding tools:
This specification provides a basic set of example [XML Schema 1.0] constructs and types in the form of concrete [XPath 2.0] expressions. These patterns are known to work well with state of the art databinding implementations.
Authors of [XML Schema 1.0] documents may find these patterns useful in providing a better user experience for consumers of their schemata using databinding tools. Whilst it is not possible to guarantee that schemata produced using these patterns will give a good user experience with the universal set of databinding tools, the patterns contained in this specification have been all been tested with a number of different tools covering a variety of different programming languages and environments.
Implementers of databinding tools may find these patterns useful to represent simple and common place data structures. Ensuring tools recognize at least these simple [XML Schema 1.0] patterns and present them in terms most appropriate to the specific language, database or environment will provide an improved user experience when using databinding tools. It is inappropriate to use this specification to constrain implementation of the [XML Schema 1.0] Recommendation.
All parts of this specification are normative, with the EXCEPTION of notes, examples, and sections explicitly marked as Non-Normative.
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this specification are to be interpreted as described in [RFC 2119].
Each [XML Schema 1.0] pattern is defined using a single [XPath 2.0] expression constraining one or more [XML Schema 1.0] items.
Each [XML Schema 1.0] pattern is identified using a unique and stable URI [RFC 3986].
Assertions about documents and implementations that are not enforced by the normative patterns are marked by a dagger symbol (†) at the end of a sentence. Each assertion has been assigned a unique and stable identifier. The assertion identifiers may be used by implementations of this specification for any purpose, such as error reporting. The assertions and their identifiers are summarized in section E. Assertion Summary.
This specification uses a number of namespace prefixes throughout; they are listed in Table 1-1. Note that the choice of any namespace prefix is arbitrary and not semantically significant (see [XML Namespaces]).
| Prefix | Namespace |
|---|---|
| xs | http://www.w3.org/2001/XMLSchema |
| xsi | http://www.w3.org/2001/XMLSchema-instance |
| soap11 | http://schemas.xmlsoap.org/soap/envelope/ |
| soap12 | http://www.w3.org/2003/05/soap-envelope |
| wsdl11 | http://schemas.xmlsoap.org/wsdl/ |
| wsdl20 | http://www.w3.org/2005/08/wsdl |
| pat | http://www.w3.org/2002/ws/databinding/patterns/6/09/ |
| ex | http://www.w3.org/2002/ws/databinding/examples/6/09/ |
A document claiming conformance to this specification:
An implementation that claims conformance to this specification:
Describing the form of the data model provided by a
databinding implementation is beyond the scope of this
specification. For example, the unconstrained built-in numeric
primitive types, xs:decimal, xs:integer,
xs:negativeInteger, xs:positiveInteger,
xs:nonNegativeInteger and
xs:nonPositiveInteger, do not map directly to native
types in many programming languages and are likely to be presented
as a toolkit specific construct or more generalised ways, such as a
'string'.
Note that although the patterns contained in this document are defined using [XPath 2.0], there is no requirement for a conformant implementation to support [XPath 2.0].
This section defines the set of concrete [XML Schema 1.0] patterns which may appear inside a conformant document. A pattern definition includes the following information:
A URI [RFC 3986] is provided to identify the pattern. The URI can be dereferenced to return informal documentation for the pattern including a list of examples and public schemas which exhibit the pattern.
A normative [XPath 2.0] expression returning a set of one or more XML element and attribute nodes. The [XPath 2.0] expression is located from an [XML Schema 1.0] element node which may be the document element, or an element contained inside an [XML 1.0] document such as [WSDL 2.0] description.
Optionally one or more non-normative [XML Schema 1.0] documents or fragments, followed by one or more valid instance document fragments.
A collection of patterns, including patterns beyond the scope of this specification, are available from http://www.w3.org/2002/ws/databinding/patterns/6/09/.
This document offers no additional semantics for the schema patterns presented beyond those specified by the [XML Schema 1.0] Recommendation.
The
xs:schema element MAY be the document element, but MAY
also appear within other descriptions such as a [WSDL 2.0] or [WSDL 1.1]
document. †
An [XML 1.0] document exhibits the
TargetNamespace pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/TargetNamespace
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.[@targetNamespace]/ (., @targetNamespace)An [XML Schema 1.0]
document conforming to this specification MUST define a
targetNamespace whose value is an absolute URI.
†
The following example [XML Schema 1.0] document TargetNamespace illustrates the use of the TargetNamespace pattern:
<xs:schema targetNamespace="http://www.w3.org/2002/ws/databinding/examples/6/09/" elementFormDefault="qualified">
<xs:element name="targetNamespace" type="xs:string" />
</xs:schema>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document TargetNamespace01:
<ex:targetNamespace>foo</ex:targetNamespace>
An [XML 1.0] document exhibits the
QualifiedLocalElements pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/QualifiedLocalElements
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.[@elementFormDefault = 'qualified']/
(@elementFormDefault)An [XML Schema 1.0]
document conforming to this specification MUST namespace qualify
all locally declared elements using a schema element
elementFormDefault attribute value of
qualified. †
The following example [XML Schema 1.0] document QualifiedLocalElements illustrates the use of the QualifiedLocalElements pattern:
<xs:schema targetNamespace="http://www.w3.org/2002/ws/databinding/examples/6/09/" elementFormDefault="qualified">
<xs:element name="qualifiedLocalElements" type="xs:string" />
</xs:schema>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document QualifiedLocalElements01:
<qualifiedLocalElements>bar</qualifiedLocalElements>
An [XML 1.0] document exhibits the
UnqualifiedLocalAttributes pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/UnqualifiedLocalAttributes
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.[not(@attributeFormDefault) or @attributeFormDefault =
'unqualified']/ (., @attributeFormDefault)The following example [XML Schema 1.0] document UnqualifiedLocalAttributes illustrates the use of the UnqualifiedLocalAttributes pattern:
<xs:schema targetNamespace="http://www.w3.org/2002/ws/databinding/examples/6/09/" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xs:element name="unqualifiedLocalAttributes" type="xs:string" />
</xs:schema>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document UnqualifiedLocalAttributes01:
<ex:unqualifiedLocalAttributes>foo</ex:unqualifiedLocalAttributes>
An [XML 1.0] document exhibits the
SchemaVersion pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/SchemaVersion
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./@versionThe following example [XML Schema 1.0] document SchemaVersion illustrates the use of the SchemaVersion pattern:
<xs:schema targetNamespace="http://www.w3.org/2002/ws/databinding/examples/6/09/" elementFormDefault="qualified" version="this is version 42">
<xs:element name="schemaVersion" type="xs:string" />
</xs:schema>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document SchemaVersion01:
<ex:schemaVersion>foo</ex:schemaVersion>
An [XML 1.0] document exhibits the FinalDefault
pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/FinalDefault
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./@finalDefaultThe following example [XML Schema 1.0] document FinalDefault illustrates the use of the FinalDefault pattern:
<xs:schema targetNamespace="http://www.w3.org/2002/ws/databinding/examples/6/09/" elementFormDefault="qualified" finalDefault="#all">
<xs:element name="finalDefault" type="xs:string" />
</xs:schema>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document FinalDefault01:
<ex:finalDefault>foo</ex:finalDefault>
An [XML 1.0] document exhibits the BlockDefault
pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/BlockDefault
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./@blockDefaultThe following example [XML Schema 1.0] document BlockDefault illustrates the use of the BlockDefault pattern:
<xs:schema targetNamespace="http://www.w3.org/2002/ws/databinding/examples/6/09/" elementFormDefault="qualified" blockDefault="#all">
<xs:element name="blockDefault" type="xs:string" />
</xs:schema>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document BlockDefault01:
<ex:blockDefault>foo</ex:blockDefault>
An [XML 1.0] document exhibits the
DocumentationElement pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/DocumentationElement
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:annotation/xs:documentation/ (.., ., .//*,
.//@*)The following example [XML Schema 1.0] extract illustrates the use of the DocumentationElement pattern within an [XML Schema 1.0] document DocumentationElement:
<xs:annotation>
<xs:documentation xml:lang="en" />
</xs:annotation>
<xs:element name="documentationElement" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en" />
</xs:annotation>
</xs:element>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document DocumentationElement01:
<ex:documentationElement>hello world</ex:documentationElement>
An [XML 1.0] document exhibits the
IdentifierName pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/IdentifierName
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//.[matches(@name, "^[A-Za-z_]([A-Za-z0-9_]{0,31})$")]/
(@name)Note, this pattern represents a subset of the native identifier formats supported by many, but not all, implementations and is therefore most likely to be supported by a databinding tools which directly maps an [XML 1.0] NCName to an native identifier.
The NCName used to declare an [XML 1.0] attribute MUST NOT be used as the declared NCName of a child element. †
The following example [XML Schema 1.0] extract illustrates the use of the IdentifierName pattern within an [XML Schema 1.0] document IdentifierName:
<xs:element name="identifierName" type="xs:string" />
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document IdentifierName02:
<ex:identifierName>Hello</ex:identifierName>
An [XML 1.0] document exhibits the
NonIdentifierName pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/NonIdentifierName
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//.[@name
and not(matches(@name, "^[A-Za-z_]([A-Za-z0-9_]{0,31})$"))]/
(@name)The following example [XML Schema 1.0] extract illustrates the use of the NonIdentifierName pattern within an [XML Schema 1.0] document NonIdentifierName:
<xs:element name="non-Identifier-Name" type="xs:string" />
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document NonIdentifierName02:
<ex:non-Identifier-Name>Hello</ex:non-Identifier-Name>
An [XML 1.0] document exhibits the NotMixed
pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/NotMixed
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//.[@mixed =
'false']/ (@mixed)An [XML 1.0] document exhibits the MinOccurs1
pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/MinOccurs1
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//.[@minOccurs =
'1']/ (@minOccurs)An [XML 1.0] document exhibits the MaxOccurs1
pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/MaxOccurs1
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//.[@maxOccurs =
'1']/ (@maxOccurs)An [XML 1.0] document exhibits the Id
pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/Id
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//@idThe following example [XML Schema 1.0] extract illustrates the use of the Id pattern within an [XML Schema 1.0] document IdExample:
<xs:element name="idExample" type="ex:IdExample" id="node1" />
<xs:complexType name="IdExample" id="node2">
<xs:sequence id="node3">
<xs:element name="text" type="xs:string" minOccurs="0" id="node4" />
</xs:sequence>
<xs:attribute name="string" type="xs:string" id="node5" />
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document IdExample01:
<ex:idExample string="hello"/>
An [XML 1.0] document exhibits the
ComplexTypeConcrete pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ComplexTypeConcrete
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:complexType[@abstract='false']/
(@abstract)An [XML 1.0] document exhibits the
GlobalElementConcrete pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/GlobalElementConcrete
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:element[@abstract='false']/ (@abstract)An [XML 1.0] document exhibits the ElementFinal
pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementFinal
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element/
(@final)An [XML 1.0] document exhibits the
ImportTypesNamespace pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ImportTypesNamespace
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:import[@namespace and not(@schemaLocation) and
(@namespace = ../xs:schema/@targetNamespace)]/ (.,
@namespace)This pattern is designed to capture a reference to a namespace defined within a WSDL document types section.
An [XML 1.0] document exhibits the
ImportNamespace pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ImportNamespace
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:import[@namespace and not(@schemaLocation) and
not(@namespace = 'http://www.w3.org/2001/XMLSchema')]/ (.,
@namespace)An [XML 1.0] document exhibits the ImportSchema
pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ImportSchema
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:import[@namespace and @schemaLocation]/ (., @namespace,
@schemaLocation)An [XML 1.0] document exhibits the Include
pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/Include
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:include[@schemaLocation]/ (.,
@schemaLocation)The following example [XML Schema 1.0] extract illustrates the use of the Include pattern within an [XML Schema 1.0] document Include:
<xs:include schemaLocation="http://www.w3.org/2002/ws/databinding/examples/6/09/Include/Include.xsd" />
<xs:element name="include" type="ex:SequenceElementList" />
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document Include01:
<ex:include>
<ex:item>cornflakes</ex:item>
<ex:item>teabags</ex:item>
<ex:item>milk</ex:item>
<ex:item>bacon</ex:item>
<ex:item>eggs</ex:item>
</ex:include>
An [XML 1.0] document exhibits the
GlobalElement pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/GlobalElement
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:element[@name and @type and contains(@type, ':')]/ (.,
@name, @type)An [XML 1.0] document exhibits the
GlobalElementBlock pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/GlobalElementBlock
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:element/ (@block)An [XML 1.0] document exhibits the
GlobalElementFinal pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/GlobalElementFinal
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:element/ (@final)An [XML 1.0] document exhibits the
GlobalElementSequence pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/GlobalElementSequence
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:element[@name]/xs:complexType/xs:sequence[xs:element]/
(../../(., @name), .., ., xs:element/(., @name))The following example [XML Schema 1.0] extract illustrates the use of the GlobalElementSequence pattern within an [XML Schema 1.0] document GlobalElementSequence:
<xs:element name="globalElementSequence">
<xs:complexType>
<xs:sequence>
<xs:element name="foo" type="xs:string" />
<xs:element name="bar" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document GlobalElementSequence01:
<ex:globalElementSequence>
<ex:foo>one</ex:foo>
<ex:bar>two</ex:bar>
</ex:globalElementSequence>
An [XML 1.0] document exhibits the
GlobalAttribute pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/GlobalAttribute
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:attribute[@name and @type and contains(@type, ":")]/ (.,
@name, @type)An [XML 1.0] document exhibits the
ElementMinOccurs0 pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementMinOccurs0
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@minOccurs = '0' and (not(@maxOccurs) or
@maxOccurs = '1')]/ (@minOccurs, @maxOccurs)The following example [XML Schema 1.0] extract illustrates the use of the ElementMinOccurs0 pattern within an [XML Schema 1.0] document ElementMinOccurs0:
<xs:element name="elementMinOccurs0" type="ex:ElementMinOccurs0" />
<xs:complexType name="ElementMinOccurs0">
<xs:sequence>
<xs:element name="firstName" type="xs:string" />
<xs:element name="middleName" type="xs:string" minOccurs="0" />
<xs:element name="lastName" type="xs:string" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementMinOccurs001:
<ex:elementMinOccurs0>
<ex:firstName>Paul</ex:firstName>
<ex:lastName>Downey</ex:lastName>
</ex:elementMinOccurs0>
as is the following element when included in an instance document ElementMinOccurs002:
<ex:elementMinOccurs0>
<ex:firstName>Paul</ex:firstName>
<ex:middleName>Sumner</ex:middleName>
<ex:lastName>Downey</ex:lastName>
</ex:elementMinOccurs0>
An [XML 1.0] document exhibits the
ElementMinOccurs1 pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementMinOccurs1
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@minOccurs = '1' and (not(@maxOccurs) or
@maxOccurs = '1')]/ (@minOccurs, @maxOccurs)The following example [XML Schema 1.0] extract illustrates the use of the ElementMinOccurs1 pattern within an [XML Schema 1.0] document ElementMinOccurs1:
<xs:element name="elementMinOccurs1" type="ex:ElementMinOccurs1" />
<xs:complexType name="ElementMinOccurs1">
<xs:sequence>
<xs:element name="elementMinOccurs1item" type="xs:string" minOccurs="1" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementMinOccurs101:
<ex:elementMinOccurs1>
<ex:elementMinOccurs1item>item1</ex:elementMinOccurs1item>
</ex:elementMinOccurs1>
An [XML 1.0] document exhibits the
ElementMaxOccurs1 pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementMaxOccurs1
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[(not(@minOccurs) or @minOccurs = '1') and
@maxOccurs = '1']/ (@minOccurs, @maxOccurs)The following example [XML Schema 1.0] extract illustrates the use of the ElementMaxOccurs1 pattern within an [XML Schema 1.0] document ElementMaxOccurs1:
<xs:element name="ageDetails" type="ex:AgeDetails" />
<xs:complexType name="AgeDetails">
<xs:sequence>
<xs:element name="age" type="xs:short" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementMaxOccurs101:
<ex:ageDetails>
<ex:age>44</ex:age>
</ex:ageDetails>
as is the following element when included in an instance document ElementMaxOccurs102:
<ex:ageDetails>
<ex:age>4</ex:age>
</ex:ageDetails>
An [XML 1.0] document exhibits the
ElementMinOccurs0MaxOccursUnbounded pattern identified using
the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementMinOccurs0MaxOccursUnbounded
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@minOccurs = '0' and @maxOccurs = 'unbounded']/
(@minOccurs, @maxOccurs)The following example [XML Schema 1.0] extract illustrates the use of the ElementMinOccurs0MaxOccursUnbounded pattern within an [XML Schema 1.0] document ElementMinOccurs0MaxOccursUnbounded:
<xs:element name="durationList" type="ex:DurationList" />
<xs:complexType name="DurationList">
<xs:sequence>
<xs:element name="durationValue" type="xs:short" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementMinOccurs0MaxOccursUnbounded101:
<ex:durationList/>
as is the following element when included in an instance document ElementMinOccurs0MaxOccursUnbounded102:
<ex:durationList>
<ex:durationValue>24</ex:durationValue>
<ex:durationValue>34</ex:durationValue>
<ex:durationValue>44</ex:durationValue>
</ex:durationList>
An [XML 1.0] document exhibits the
ElementMinOccurs1MaxOccursUnbounded pattern identified using
the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementMinOccurs1MaxOccursUnbounded
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[(not(@minOccurs) or @minOccurs = '1') and
@maxOccurs = 'unbounded']/ (@minOccurs, @maxOccurs)The following example [XML Schema 1.0] extract illustrates the use of the ElementMinOccurs1MaxOccursUnbounded pattern within an [XML Schema 1.0] document ElementMinOccurs1MaxOccursUnbounded:
<xs:element name="ageList" type="ex:AgeList" />
<xs:complexType name="AgeList">
<xs:sequence>
<xs:element name="ageValue" type="xs:short" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementMinOccurs1MaxOccursUnbounded101:
<ex:ageList>
<ex:ageValue>44</ex:ageValue>
</ex:ageList>
as is the following element when included in an instance document ElementMinOccurs1MaxOccursUnbounded102:
<ex:ageList>
<ex:ageValue>24</ex:ageValue>
<ex:ageValue>34</ex:ageValue>
<ex:ageValue>44</ex:ageValue>
</ex:ageList>
An [XML 1.0] document exhibits the
ElementMaxOccursFinite pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementMaxOccursFinite
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@maxOccurs and not(@maxOccurs = '0' or
@maxOccurs = '1' or @maxOccurs = 'unbounded')]/
(@maxOccurs)The following example [XML Schema 1.0] extract illustrates the use of the ElementMaxOccursFinite pattern within an [XML Schema 1.0] document ElementMinOccurs2MaxOccurs2:
<xs:element name="itemColors2" type="ex:ItemColors2" />
<xs:complexType name="ItemColors2">
<xs:sequence>
<xs:element name="itemColor" type="xs:string" minOccurs="2" maxOccurs="2" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementMinOccurs2MaxOccurs201:
<ex:itemColors2>
<ex:itemColor>Red</ex:itemColor>
<ex:itemColor>Yellow</ex:itemColor>
</ex:itemColors2>
The following example [XML Schema 1.0] extract illustrates the use of the ElementMaxOccursFinite pattern within an [XML Schema 1.0] document ElementMaxOccursFinite:
<xs:element name="summer" type="ex:Summer" />
<xs:complexType name="Summer">
<xs:sequence>
<xs:element name="mnth" type="xs:string" maxOccurs="4" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementMaxOccursFinite01:
<ex:summer>
<ex:mnth>May</ex:mnth>
<ex:mnth>June</ex:mnth>
<ex:mnth>July</ex:mnth>
<ex:mnth>August</ex:mnth>
</ex:summer>
as is the following element when included in an instance document ElementMaxOccursFinite02:
<ex:summer>
<ex:mnth>August</ex:mnth>
<ex:mnth>September</ex:mnth>
</ex:summer>
An [XML 1.0] document exhibits the
ElementFormQualified pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementFormQualified
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@form='qualified']/ (@form)An [XML 1.0] document exhibits the
SequenceSingleRepeatedElement pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/SequenceSingleRepeatedElement
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:sequence[count(xs:element) = 1]/xs:element[@maxOccurs =
'unbounded']/ (., @maxOccurs)The following example [XML Schema 1.0] extract illustrates the use of the SequenceSingleRepeatedElement pattern within an [XML Schema 1.0] document SequenceElementList:
<xs:element name="sequenceElementList" type="ex:SequenceElementList" />
<xs:complexType name="SequenceElementList">
<xs:sequence>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded" type="xs:string" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document SequenceElementList01:
<ex:sequenceElementList>
<ex:item>item one</ex:item>
<ex:item>item two</ex:item>
<ex:item>item three</ex:item>
<ex:item>item four</ex:item>
</ex:sequenceElementList>
as is the following element when included in an instance document SequenceElementList02:
<ex:sequenceElementList>
<ex:item>item one</ex:item>
</ex:sequenceElementList>
and the following element when included in an instance document SequenceElementList03:
<ex:sequenceElementList/>
An [XML 1.0] document exhibits the
ElementEmptySequence pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementEmptySequence
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@name]/xs:complexType/xs:sequence[not(node())]/
(., .., ../.., ../../@name)The following example [XML Schema 1.0] extract illustrates the use of the ElementEmptySequence pattern within an [XML Schema 1.0] document ElementEmptySequence:
<xs:element name="elementEmptySequence">
<xs:complexType>
<xs:sequence />
</xs:complexType>
</xs:element>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementEmptySequence01:
<ex:elementEmptySequence/>
An [XML 1.0] document exhibits the
ElementEmptyComplexType pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementEmptyComplexType
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@name]/xs:complexType[not(node())]/ (., ..,
../@name)The following example [XML Schema 1.0] extract illustrates the use of the ElementEmptyComplexType pattern within an [XML Schema 1.0] document ElementEmptyComplexType:
<xs:element name="elementEmptyComplexType">
<xs:complexType />
</xs:element>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementEmptyComplexType01:
<ex:elementEmptyComplexType/>
An [XML 1.0] document exhibits the
NillableElement pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/NillableElement
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@nillable = 'true' and not(@minOccurs = '0')]/
(@nillable)The following example [XML Schema 1.0] extract illustrates the use of the NillableElement pattern within an [XML Schema 1.0] document NillableElement:
<xs:element name="nillableMiddleName" type="ex:NillableMiddleName" />
<xs:complexType name="NillableMiddleName">
<xs:sequence>
<xs:element name="firstName" type="xs:string" />
<xs:element name="middleName" type="xs:string" nillable="true" />
<xs:element name="lastName" type="xs:string" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document NillableElement01:
<ex:nillableMiddleName>
<ex:firstName>Paul</ex:firstName>
<ex:middleName xsi:nil="true"/>
<ex:lastName>Downey</ex:lastName>
</ex:nillableMiddleName>
as is the following element when included in an instance document NillableElement02:
<ex:nillableMiddleName>
<ex:firstName>Paul</ex:firstName>
<ex:middleName>Sumner</ex:middleName>
<ex:lastName>Downey</ex:lastName>
</ex:nillableMiddleName>
An [XML 1.0] document exhibits the
NillableOptionalElement pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/NillableOptionalElement
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@nillable = 'true' and @minOccurs = '0']/
(@nillable, @minOccurs)Note, this specification places no particular
semantics on the difference between annotating an element with
xsi:nil and the absence of an element.
The following example [XML Schema 1.0] extract illustrates the use of the NillableOptionalElement pattern within an [XML Schema 1.0] document NillableOptionalElement:
<xs:element name="nillableOptionalMiddleName" type="ex:NillableOptionalMiddleName" />
<xs:complexType name="NillableOptionalMiddleName">
<xs:sequence>
<xs:element name="firstName" type="xs:string" />
<xs:element name="middleName" type="xs:string" minOccurs="0" nillable="true" />
<xs:element name="lastName" type="xs:string" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document NillableOptionalElement01:
<ex:nillableOptionalMiddleName>
<ex:firstName>Paul</ex:firstName>
<ex:lastName>Downey</ex:lastName>
</ex:nillableOptionalMiddleName>
as is the following element when included in an instance document NillableOptionalElement02:
<ex:nillableOptionalMiddleName>
<ex:firstName>Paul</ex:firstName>
<ex:middleName>Sumner</ex:middleName>
<ex:lastName>Downey</ex:lastName>
</ex:nillableOptionalMiddleName>
and the following element when included in an instance document NillableOptionalElement03:
<ex:nillableOptionalMiddleName>
<ex:firstName>Paul</ex:firstName>
<ex:middleName xsi:nil="true"/>
<ex:lastName>Downey</ex:lastName>
</ex:nillableOptionalMiddleName>
An [XML 1.0] document exhibits the
NotNillableElement pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/NotNillableElement
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@nillable = 'false']/ (@nillable)An [XML 1.0] document exhibits the
ElementTypeReference pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementTypeReference
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@name and @type and
namespace-uri-from-QName(resolve-QName(@type,.)) !=
'http://www.w3.org/2001/XMLSchema' and contains(@type, ':')]/ (.,
@name, @type)The following example [XML Schema 1.0] extract illustrates the use of the ElementTypeReference pattern within an [XML Schema 1.0] document ElementTypeReference:
<xs:element name="elementTypeReference" type="ex:ElementTypeReference" />
<xs:complexType name="ElementTypeReferenced">
<xs:sequence>
<xs:element name="referenced" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ElementTypeReference">
<xs:sequence>
<xs:element name="text" type="ex:ElementTypeReferenced" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementTypeReference01:
<ex:elementTypeReference>
<ex:referenced>foo</ex:referenced>
</ex:elementTypeReference>
An [XML 1.0] document exhibits the
ElementReference pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementReference
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[@ref and contains(@ref, ':')]/ (.,
@ref)The following example [XML Schema 1.0] extract illustrates the use of the ElementReference pattern within an [XML Schema 1.0] document ElementReference:
<xs:element name="customerName" type="ex:CustomerName" />
<xs:element name="firstName" type="xs:string" />
<xs:element name="lastName" type="xs:string" />
<xs:complexType name="CustomerName">
<xs:sequence>
<xs:element ref="ex:firstName" />
<xs:element ref="ex:lastName" />
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document ElementReference01:
<ex:customerName>
<ex:firstName>Bobby</ex:firstName>
<ex:lastName>Sox</ex:lastName>
</ex:customerName>
An [XML 1.0] document exhibits the
LocalElementComplexType pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/LocalElementComplexType
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:element[not(parent::xs:schema)]/xs:complexTypeThe following example [XML Schema 1.0] extract illustrates the use of the LocalElementComplexType pattern within an [XML Schema 1.0] document LocalElementComplexType:
<xs:element name="localElementComplexType" type="ex:LocalElementComplexType" />
<xs:complexType name="LocalElementComplexType">
<xs:sequence>
<xs:element name="name">
<xs:complexType>
<xs:sequence>
<xs:element name="firstName" type="xs:string" />
<xs:element name="lastName" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document LocalElementComplexType01:
<ex:localElementComplexType>
<ex:name>
<ex:firstName>Paul</ex:firstName>
<ex:lastName>Paul</ex:lastName>
</ex:name>
</ex:localElementComplexType>
An [XML 1.0] document exhibits the
AttributeFormUnqualified pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/AttributeFormUnqualified
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:attribute[@form='unqualified']/ (@form)An [XML 1.0] document exhibits the
AttributeOptional pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/AttributeOptional
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:attribute[@use = 'optional']/ (@use)The following example [XML Schema 1.0] extract illustrates the use of the AttributeOptional pattern within an [XML Schema 1.0] document AttributeOptional:
<xs:element name="premium" type="ex:Premium" />
<xs:complexType name="Premium">
<xs:sequence>
<xs:element name="amount" type="xs:int" />
</xs:sequence>
<xs:attribute name="id" type="xs:string" />
<xs:attribute name="currency" type="xs:string" use="optional" />
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document AttributeOptional01:
<ex:premium id="1711" currency="EUR">
<ex:amount>1250</ex:amount>
</ex:premium>
as is the following element when included in an instance document AttributeOptional02:
<ex:premium id="1712">
<ex:amount>1250</ex:amount>
</ex:premium>
An [XML 1.0] document exhibits the
AttributeRequired pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/AttributeRequired
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:attribute[@use = 'required']/ (@use)The following example [XML Schema 1.0] extract illustrates the use of the AttributeRequired pattern within an [XML Schema 1.0] document AttributeRequired:
<xs:element name="discount" type="ex:Discount" />
<xs:complexType name="Discount">
<xs:sequence>
<xs:element name="percentage" type="xs:int" />
</xs:sequence>
<xs:attribute name="id" type="xs:string" />
<xs:attribute name="seasonal" type="xs:boolean" use="required" />
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document AttributeRequired01:
<ex:discount id="1611" seasonal="true">
<ex:percentage>5</ex:percentage>
</ex:discount>
as is the following element when included in an instance document AttributeRequired02:
<ex:discount id="1612" seasonal="false">
<ex:percentage>2</ex:percentage>
</ex:discount>
An [XML 1.0] document exhibits the
AttributeFixed pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/AttributeFixed
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:attribute[@fixed] / (@fixed)The following example [XML Schema 1.0] extract illustrates the use of the AttributeFixed pattern within an [XML Schema 1.0] document AttributeFixed:
<xs:element name="survey" type="ex:Survey" />
<xs:complexType name="Survey">
<xs:sequence>
<xs:element name="fee" type="xs:int" />
</xs:sequence>
<xs:attribute name="id" type="xs:string" />
<xs:attribute name="currency" type="xs:string" fixed="GBP" />
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document AttributeFixed01:
<ex:survey id="1511" currency="GBP">
<ex:fee>500</ex:fee>
</ex:survey>
An [XML 1.0] document exhibits the
AttributeReference pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/AttributeReference
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:attribute[@ref and contains(@ref, ":")]/ (.,
@ref)The following example [XML Schema 1.0] extract illustrates the use of the AttributeReference pattern within an [XML Schema 1.0] document AttributeReference:
<xs:element name="clientName" type="ex:ClientName" />
<xs:attribute name="phoneNumber" type="xs:string" />
<xs:complexType name="ClientName">
<xs:sequence>
<xs:element name="firstName" type="xs:string" />
<xs:element name="lastName" type="xs:string" />
</xs:sequence>
<xs:attribute ref="ex:phoneNumber" />
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document AttributeReference01:
<ex:clientName ex:phoneNumber="01211345678">
<ex:firstName>Bobby</ex:firstName>
<ex:lastName>Sox</ex:lastName>
</ex:clientName>
An [XML 1.0] document exhibits the
AttributeTypeReference pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/AttributeTypeReference
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:attribute[@name and @type and
namespace-uri-from-QName(resolve-QName(@type,.)) !=
'http://www.w3.org/2001/XMLSchema' and contains(@type, ':')]/ (.,
@name, @type)The following example [XML Schema 1.0] extract illustrates the use of the AttributeTypeReference pattern within an [XML Schema 1.0] document AttributeTypeReference:
<xs:element name="attributeTypeReference" type="ex:AttributeTypeReference" />
<xs:simpleType name="ThreeDigits">
<xs:restriction base="xs:decimal">
<xs:totalDigits value="3" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="AttributeTypeReference">
<xs:sequence>
<xs:element name="text" type="xs:string" minOccurs="0" />
</xs:sequence>
<xs:attribute name="number" type="ex:ThreeDigits" />
</xs:complexType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document AttributeTypeReference01:
<ex:attributeTypeReference number="123"/>
An [XML 1.0] document exhibits the
GlobalSimpleType pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/GlobalSimpleType
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:simpleType[@name]/ (., @name)The following example [XML Schema 1.0] extract illustrates the use of the GlobalSimpleType pattern within an [XML Schema 1.0] document GlobalSimpleType:
<xs:element name="globalSimpleType" type="ex:GlobalSimpleType" />
<xs:simpleType name="GlobalSimpleType">
<xs:restriction base="xs:string">
<xs:enumeration value="foo" />
</xs:restriction>
</xs:simpleType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document GlobalSimpleType01:
<ex:beatle>foo</ex:beatle>
An [XML 1.0] document exhibits the
GlobalComplexType pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/GlobalComplexType
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:complexType[@name]/ (., @name)An [XML 1.0] document exhibits the
GlobalComplexTypeAbstract pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/GlobalComplexTypeAbstract
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:complexType[@abstract='true']/ (@abstract)An [XML 1.0] document exhibits the
GlobalComplexTypeBlock pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/GlobalComplexTypeBlock
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
./xs:complexType/ (@block)An [XML 1.0] document exhibits the
StringEnumerationType pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/StringEnumerationType
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:simpleType/xs:restriction[@base/resolve-QName(.,..) =
xs:QName('xs:string') and xs:enumeration]/ (., @base,
xs:enumeration/(., @value))Note, this pattern may be further constrained by
the regular expression used by the 2.3.1 IdentifierName pattern
to support databinding tools which directly map an
xs:enumeration value to an native identifier.
The following example [XML Schema 1.0] extract illustrates the use of the StringEnumerationType pattern within an [XML Schema 1.0] document StringEnumerationType:
<xs:element name="beatle" type="ex:Beatle" />
<xs:simpleType name="Beatle">
<xs:restriction base="xs:string">
<xs:enumeration value="John" />
<xs:enumeration value="Paul" />
<xs:enumeration value="George" />
<xs:enumeration value="Stuart" />
<xs:enumeration value="Pete" />
<xs:enumeration value="Ringo" />
</xs:restriction>
</xs:simpleType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document StringEnumerationType01:
<ex:beatle>John</ex:beatle>
as is the following element when included in an instance document StringEnumerationType02:
<ex:beatle>Paul</ex:beatle>
and the following element when included in an instance document StringEnumerationType03:
<ex:beatle>Ringo</ex:beatle>
An [XML 1.0] document exhibits the
NMTOKENEnumerationType pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/NMTOKENEnumerationType
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:simpleType/xs:restriction[@base/resolve-QName(.,..) =
xs:QName('xs:NMTOKEN') and xs:enumeration]/ (., @base,
xs:enumeration/(., @value))The following example [XML Schema 1.0] extract illustrates the use of the NMTOKENEnumerationType pattern within an [XML Schema 1.0] document NMTOKENEnumerationType:
<xs:element name="nMTOKENEnumerationType" type="ex:NMTOKENEnumerationType" />
<xs:simpleType name="NMTOKENEnumerationType">
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="token1" />
<xs:enumeration value="token2" />
<xs:enumeration value="token3" />
</xs:restriction>
</xs:simpleType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document NMTOKENEnumerationType01:
<ex:nMTOKENEnumerationType>token1</ex:nMTOKENEnumerationType>
An [XML 1.0] document exhibits the
NullEnumerationType pattern identified using the URI [RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/NullEnumerationType
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an [XPath
2.0] node-set containing at least one node:
.//xs:simpleType/xs:restriction[@base/resolve-QName(.,..) =
xs:QName('xs:string') and count(xs:enumeration) le 1 and
xs:enumeration = '']/ (@base, xs:enumeration/(.,
@value))The following example [XML Schema 1.0] extract illustrates the use of the NullEnumerationType pattern within an [XML Schema 1.0] document NullEnumerationType:
<xs:element name="nullEnumerationType" type="ex:NullEnumerationType" />
<xs:simpleType name="NullEnumerationType">
<xs:restriction base="xs:string">
<xs:enumeration value="" />
</xs:restriction>
</xs:simpleType>
The following example [XML 1.0] element is valid against the above example [XML Schema 1.0] when included inside an instance document NullEnumerationType01:
<ex:nullEnumerationType/>
An [XML 1.0] document exhibits the
DecimalSimpleTypeTotalDigits pattern identified using the URI
[RFC 3986]
http://www.w3.org/2002/ws/databinding/patterns/6/09/DecimalSimpleTypeTotalDigits
when the following [XPath 2.0] expression
applied to a document or element node located by
//xs:schema results in an