In HTML documents, the process of addressing a specific part of the document involves using anchors. This can be a useful mechanism, but it does have significant limitations.
Caution
Let’s suppose that you want to link to the HTML document shown in Listing 14.5. It includes many br tags to space out the anchors.
If you want to link from another HTML document to any of the specified anchors in Listing 14.5, writing a link is straightforward:
<a href="Anchors.html#anchorName" ...> LinkText</a>
If you don’t have write privileges on the target document, you have limited options. You can ask the Web page author to add an anchor at the point that you want to link to (often unrealistic in a rapidly growing Web), link to an anchor close to the real point of interest (if there is such an anchor), or accept that it isn’t possible to link to a desired fragment in that page.
XPointer is designed to provide improved functionality for linking to document fragments in XML documents. A correctly written XPointer should be capable of identifying any arbitrary part of an XML document. How that part of the document is processed after it is identified depends on the application with which the XPointer processor is associated.
For example, suppose you wanted to link to a long XML document, perhaps a lengthy report, and display it in a browser or similar software at exactly the point of interest. You could write an XPointer to access any part of the document that is of interest without having write access to the target document.
Note
At the time of this writing, no XPointer tools conform fully to the newly issued XPointer draft documents. |
To understand how to do that, you should look first at the relationship between XPath (discussed in Chapter 9, “The XML Path Language—XPath”), and XPointer.