You already know how to link XML documents together with XLink, and isolate specific nodes or node collections with XPath. Now uncover the third and final piece of the XML linking jigsaw - XPointer, an experimental technology from the W3C, which allows you to create XML links to specific points or ranges within an XML document.
If you've been paying attention to this column over the past few weeks, you'll already be familiar with XPath and XLink, two important pieces of the XML jigsaw. XPath provides a standard way to access specific nodes (or sets of nodes) within an XML document, while XLink offers XML document authors the ability to link XML data together in a myriad of different ways.
While XLink is a very significant component of the effort to bring HTML-like linking capabilities to XML, it merely provides the constructs to link different documents together; it does not provide any mechanism for locating and referencing specific segments within a document. XPath, however, does - it provides the constructs and functions that make it possible to traverse an XML document tree and move from one node to another within it. Put the two together, and you have the ability to create links not merely between documents, but between specific nodes of documents.
That's where XPointer comes in. A critical part of the effort to improve XML's linking capabilities, it expands on XPath's basic functionality, making it possible to address specific nodes or ranges within an XML document in simpler and more efficient ways.
Over the course of this tutorial, I'll be taking a closer look at XPointer and its capabilities. Since XPointer relies heavily on XPath concepts, this tutorial also contains a brief discussion of how XPath expressions are constructed, with an explanation of location paths, axes and predicates.
Before we begin, a couple of important disclaimers:
First, XPointer is not yet a W3C recommendation; it's still in the process of getting there. Consequently, the material here may become invalid when the final recommendation emerges; you should always refer to the most current standard or recommendation for up-to-date information. This tutorial is based on the W3C's XPointer Candidate Recommendation dated 11 September 2001.
Second, since XPointer is not yet a standard, there aren't that many tools out there that know how to process XPointers accurately. As of this writing, the W3C's XPointer activity page listed three tools, each with its own limitations. Consequently, you will find it difficult to road-test much of the material in this tutorial, and will probably have to wait until the final recommendation emerges to actually begin using XPointers in your development activities.