ID/IDREF

The XML standard relies upon the two special attribute types, 'ID' and 'IDREF', to identify attributes that serve as the target and source of a link. Using this technique, the target object must be enclosed by an element that has an attribute defined to be of type ID. A unique value must be placed in this attribute:

<!ELEMENT section (...) >
<!ATTLIST section target
					ID #REQUIRED>
   <section target="S6">
     <title>This is Section 6</title>
     ...
     ...
     ...
   </section>

Every reference must be contained within an element that has an attribute defined to be of type IDREF. For example, a referencing element called 'XRef' may use an attribute called 'Link' to point to the required element:

<!ELEMENT xref (...) >
<!ATTLIST xref link IDREF #REQUIRED> ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.