XML technologies / XML Schema / Data type reference / xs:IDREFS
(Excerpt from “XML Schema” by Eric van der Vlist)
Defining lists of references to unique identifiers
Derived from: xs:IDREF
Primitive type: none
Known subtypes: none
Facets: xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:whiteSpace
Definition
<xs:simpleType name="IDREFS" id="IDREFS">
<xs:restriction>
<xs:simpleType>
<xs:list>
<xs:simpleType>
<xs:restriction base="xs:IDREF"/>
</xs:simpleType>
</xs:list>
</xs:simpleType>
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>Description
xs:IDREFS is derived as a list of xs:IDREF, representing a whitespace-separated list of references to identifiers defined with data type xs:ID.
The lexical space of xs:IDREFS is that of a list of values of type xs:NCName, containing at least one item; xs:IDREFS cannot denote an empty list.
xs:IDREFS emulates attribute type xs:IDREFS in XML DTDs, though it works for simple-content elements as well as attributes.
Restrictions
Applications requiring some compatibility with DTDs should reserve this data type for attributes rather than elements.
The lexical space, lists of xs:NCName, does not permit lists of numeric key references or references containing whitespace.
Although W3C XML Schema provides elements xs:unique, xs:key and xs:keyref as another mechanism for uniqueness, key and key-reference constraints, it provides no alternative to lists of key references, similar to xs:IDREFS, when more flexibility is needed.
Example
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="isbn" type="xs:int"/>
<xs:element name="title" type="xs:string"/>
<xs:element name="author-ref">
<xs:complexType>
<xs:attribute name="ref" type="xs:IDREF" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="character-refs" type="xs:IDREFS"/>
</xs:sequence>
<xs:attribute name="identifier" type="xs:ID" use="required"/>
</xs:complexType>
</xs: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