XML technologies / XML Schema / XML Schema element reference / xs:all (outside a group)
(Excerpt from “XML Schema” by Eric van der Vlist)
Compositor describing an unordered group of elements.
<xs:all
id = xs:ID
maxOccurs = "1" : "1"
minOccurs = ( "0" | "1" ) : "1"
{beliebige Attribute mit einem Nicht-Schema-Namensraum}
>
Content: (xs:annotation?, xs:element*)
</xs:all>May occur within: xs:complexType (local definition), xs:complexType (global definition), xs:extension (complex content), xs:restriction (complex content)
Description
xs:all describes an unordered group of elements that may occur zero or one time.
Restrictions
xs:all is the only compositor that cannot be used as a particle and must stand alone to describe a complete content model. Unlike xs:choice and xs:sequence, xs:all cannot be embedded in another compositor. It can therefore appear only directly beneath xs:complex-Type, xs:restriction or xs:extension; its occurrence count must also be zero or one.
Particles appearing in xs:all are also restricted: only xs:element is allowed, with occurrence count zero or one.
Together, these restrictions mean that xs:all can only describe models whose only children form an unordered group of required or optional elements occurring at most once.
Unordered groups of optional elements with the same maximum occurrence count can be described using xs:choice or substitution groups, but other models, such as unordered elements with arbitrary and differing maximum occurrence counts, cannot be described with W3C XML Schema.
Complex types defined with an xs:all compositor cannot be derived by extension.
Example
<xs:element name="author">
<xs:complexType>
<xs:all>
<xs:element ref="name"/>
<xs:element ref="born"/>
<xs:element ref="dead" minOccurs="0"/>
</xs:all>
<xs:attribute ref="id"/>
</xs:complexType>
</xs:element>
<xs:element name="full-name" substitutionGroup="name">
<xs:complexType>
<xs:all>
<xs:element name="first" type="string32" minOccurs="0"/>
<xs:element name="middle" type="string32" minOccurs="0"/>
<xs:element name="last" type="string32"/>
</xs:all>
</xs:complexType>
</xs:element>Attributes
id Element ID according to W3C XML Schema.
maxOccurs
Maximum occurrence count, fixed at 1.
minOccurs
Minimum occurrence count, either 0 or 1.
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “XML Schema” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de