Skip to Main Content
XML Schema
book

XML Schema

by Eric van der Vlist
June 2002
Intermediate to advanced content levelIntermediate to advanced
396 pages
11h 8m
English
O'Reilly Media, Inc.
Content preview from XML Schema

Name

xs:IDREF — Definition of references to unique identifiers.

Derived from:

xs:NCName

Primary:

xs:string

Known subtypes:

xs:IDREFS

Facets:

xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace

<xs:simpleType name="IDREF" id="IDREF">
  <xs:restriction base="xs:NCName"/>
</xs:simpleType>

Description

The xs:IDREF datatype defines references to the identifiers defined by the ID datatype and, therefore, emulates the IDREF attribute type of the XML DTDs, even though it can be used for simple content elements as well as for attributes.

The lexical space of xs:IDREF is, like the lexical space of xs:ID, nonqualified XML names (NCName).

The constraint added by this datatype beyond the xs:NCName datatype from which it is derived is the values of all the attributes and elements that have a xs:IDREF datatype must match an ID defined within the same document.

Restrictions

Applications that need to maintain a level of compatibility with DTDs should not use this datatype for elements but should reserve it for attributes.

The lexical domain (NCName) of this datatype doesn’t allow definition of numerical key references or references containing whitespaces.

W3C XML Schema provides another mechanism to define key reference constraints using the xs:keyref elements 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> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XML in a Nutshell, 3rd Edition

XML in a Nutshell, 3rd Edition

Elliotte Rusty Harold, W. Scott Means
Beginning XML, 5th Edition

Beginning XML, 5th Edition

Danny Ayers, Liam R.E. Quin, Joe Fawcett
XML Schema Complete Reference, The

XML Schema Complete Reference, The

Cliff Binstock, Chris Galtenberg, Mike Wooding, Chris Dix, Mitchell Smith, Dave Peterson
Programming Web Services with SOAP

Programming Web Services with SOAP

James Snell, Doug Tidwell, Pavel Kulchenko

Publisher Resources

ISBN: 0596002521Supplemental ContentErrata Page