XPointer
XPointer
is another XML linking technology, and in fact builds on
XLink’s capabilities. XLink, while useful in and of itself,
only allows you to refer to another document. However, there are many
times when you may want to refer to a specific
part of another document. This is a very common
task, and is somewhat analogous to using named anchors in HTML. It is
made possible by using XPointer on top of XLink; the specs build very
naturally on each other, and are intended to work together. First,
you want to take a look at the target document you are going to link
to. If you can, ensure that this document uses id
attributes in it. This will make the linking and pointing much
easier. Example 16-2 shows the listing of some of the
guitars that luthier Dana Bourgeois makes, and has IDs for each type.
Example 16-2. A listing of Bourgeois guitars
<?xml version="1.0"?> <guitarTypes xmlns="http://www.bourgeoisguitars.com"> <type model="OM" ID="OM"> <picture url="http://www.bourgeoisguitars.com/images/vvOM.jpg"/> <description>Small bodied orchestra model.</description> </type> <type model="D" ID="D"> <picture url="http://www.bourgeoisguitars.com/images/ricky%20skaggs%20model.jpg"/> <description>Bluegrass powerhouse in a standard dreadnought shape.</description> </type> <type model="slopeD" ID="slopeD"> <picture url="http://www.bourgeoisguitars.com/images/slope%20d,%20custom%20version.jpg"/> <description> Slope shouldered dreadnought, perfect for vocal accompaniment. </description> ...
Get Java and XML, Second 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.