XPointer and XLink
The final pieces of XML we cover are XPointer and XLink. These are separate standards in the XML family dedicated to working with XML links. Before we delve into them, however, we should warn you that the standards described here are not final as of publication time.
It’s important to remember that an XML link is only an assertion of a relationship between pieces of documents; how the link is actually presented to a user depends on a number of factors, including the application processing the XML document.
To create a link, we must first have a labeling scheme for XML elements. One way to do this is to assign an identifier to specific elements we want to reference using an ID attribute:
<paragraph id="attack"> Suddenly the skies were filled with aircraft. </paragraph>
You can think of IDs in XML documents as street addresses: they provide a unique identifier for an element within a document. However, just as there might be an identical address in a different city, an element in a different document might have the same ID. Consequently, you can tie together an ID with the document’s URI, as shown here:
The combination of a document’s URI and an
element’s ID should uniquely identify that element
throughout the universe. Remember that an ID attribute does not need
to be named
id, as shown in the first example. You can name it anything you want, as long as you define it as an XML ID in the document’s ...