XML technologies / XML Schema / XML Schema element reference / xs:list
(Excerpt from “XML Schema” by Eric van der Vlist)
Derivation by list.
<xs:list
id = xs:ID
itemType = xs:QName
{beliebige Attribute mit einem Nicht-Schema-Namensraum}
>
Content: ((xs:annotation?), (xs:simpleType?))
</xs:list>May occur within: xs:simpleType (local definition), xs:simpleType (global definition)
Description
List derivation turns a simple data type, the item type, into a list of its values separated by whitespace.
The item type can be defined inline by adding a simpleType definition as a child of the list element, or by reference using attribute itemType. Using both is an error.
The item type’s semantics and facets are lost. The new type receives the facets shared by all list data types: xs:enumeration, xs:length, xs:maxLength, xs:minLength and xs:pattern. Whitespace is always collapsed.
After list derivation, the resulting variety is list, whatever the item type’s variety, atomic or union.
Lists of atomic types permitting whitespace can be defined, such as xs:string. Whitespace is then always a separator.
Restrictions
All list types share the same facets, constraining the whole list rather than individual items. Item constraints must therefore be applied before list derivation.
List separators cannot be chosen: separation always uses whitespace.
The recommendation explicitly forbids lists of lists. Lists of unions and unions of lists are allowed, so a dummy union of a list, used as an item type, should work around this. However, because all list types share the same separators, lists of lists are ultimately meaningless.
Example
<xs:simpleType name="integerList">
<xs:list itemType="xs:integer"/>
</xs:simpleType>Attributes
id
Element ID according to W3C XML Schema.
itemType
Reference to the item type if not defined inline by an xs:simpleType element.
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