by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)


Name

xsd:IDREF — Definition of references to unique identifiers

Synopsis

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

Derived from

xsd:NCName

Primary

xsd:string

Known subtypes

xsd:IDREFS

Data parameters (facets)

enumeration, length, maxLength, minLength, pattern

Description

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

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

RELAX NG implementations supporting the DTD compatibility feature add a constraint for this datatype beyond the xsd:NCName datatype from which it is derived; the values of all the attributes and elements that have a xsd:IDREF datatype must match an ID defined within the same document.

Restrictions

Applications that need to maintain compatibility with DTDs shouldn't use this datatype for elements, but should instead reserve it for attributes.

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

Example

<element name="book">
  <element name="isbn">
    <data type="xsd:int"/>
  </element>
  <element name="title">
    <data type="xsd:string"/>
  </element>
  <element name="author-ref">
    <attribute name="ref">
      <data type="xsd:IDREF"/>
    </attribute>
  </element>
  <element name="character-refs">
    <data type="xsd:IDREFS"/>
  </element>
  <attribute name="identifier">
    <data type="xsd:ID"/>
  </attribute>
</element>

This text is released under the Free Software Foundation GFDL.