Real World XML (2nd Edition)

Locating Resources with xlink:href

The xlink:href attribute is also called the locator attribute. This is the attribute that supplies the data that allows an XLink application to find a remote resource.

URI Definition

Although XLinks can be quite general, they commonly use URIs to locate resources. You usually use a URI in xlink:href . Now that we're examining the way linking works in XML, you might want to look up the formal definition of URIs, which you can find in its entirety at www.ics.uci.edu/pub/ietf/uri/rfc2396.txt.

We've seen that you can set the xlink:href attribute to specify a document and an XPointer:

<MOVIE_REVIEW xmlns:xlink = "http://www.w3.org/1999/xlink" xlink:type = "simple" xlink:show = "new" xlink:href="http://www.starpowdermovies.com/reviews.xml#xpointer(/child::*[position( )=126]/child::*[position()=first()])"> Mr. Blandings Builds His Dream House </MOVIE_REVIEW>

We'll see how the values you assign to this attribute can become fairly involved when we work with XPointers.

Категории