The XML Linking Language

The XML Linking Language (XLink)—and the associated XML Pointer Language (XPointer) specification, discussed later in this chapter—are intended to provide linking functionality for XML on the Web. This will provide XML-based linking functionality equivalent to HTML, but with significant enhancements. Relevant parts of XLink and XPointer have already been implemented in Scalable Vector Graphics (see Chapter 15, “Presenting XML Graphically—SVG”) and likely will be implemented in at least some other XML specifications.

The original vision for XML was that it should be used on the Web. However, in practice it has displaced HTML much more slowly than was originally envisioned. Perhaps a contributing factor to that was the lengthy delay in finishing development of the XLink and the (still unfinished) XPointer specifications.

XLink became a full W3C Recommendation in June 2001 (see www.w3.org/TR/2001/REC-xlink-20010627/). At the time of this writing, four new XPointer Working Drafts have just been issued.

XLink provides simple links, which are similar to HTML hyperlinks, and extended links that introduce functionality beyond that provided in HTML. XPointer is a much more powerful fragment-identifier mechanism than HTML anchors.

First let’s look at HTML hyperlinks and their strengths and limitations. XPointer is discussed later in the chapter.

XLink and HTML Hyperlinks

HTML hyperlinking has been immensely successful as a pivotal part of the World Wide Web. The Web is almost unimaginable without such hyperlinking functionality.

In HTML, the hyperlinking mechanism uses the a element. It is possible to use the a element to link externally to other HTML Web pages or other resources, or to link internally or externally to specified document fragments.

These simple mechanisms are immensely useful, but they do have limitations. For example, a link is expressed at one end only. If you click a link on page A and move to page B, the browser Back button typically allows you to link back to page A. But if you visit page B directly, there is likely no way to link to page A at all.

To take another example, if you want to link to a fragment of page B but the document author hasn’t provided an anchor at the point that interests you, you can’t link directly to that point. You are limited to linking to the Web page and providing instructions for what part of the document you want a user to scroll to.

XLink and XPointer were intended to address limitations such as these.

Simple Links and Extended Links

XLink provides two significantly different types of links: simple links and extended links.

An XLink simple link behaves on its own very much like an HTML hyperlink. When used with XPointer, it is potentially much more flexible in linking to specified document fragments.

XLink extended links allow links to be created among more than two resources.

XLink Jargon

XLink brings with it a lot of jargon, which is needed to precisely express what is happening with XLink extended links.

In XLink terminology, a link is simply an explicit association between two or more resources. The link is made explicit by an XLink linking element.

Note

No elements exist in the XLink namespace— only attributes. An element in a non-XLink namespace that possesses XLink attributes is termed an XLink linking element.



So, an XLink simple link might look like this:

<myPrefix:myElement xlink:href="SomeResource.xml" ... /> 

The preceding code assumes that the XLink namespace URI, www.w3.org/1999/xlink, has been declared at an appropriate place in the document.

Using or following an XLink link is termed traversal. The resource that contains the XLink linking element is known as the starting resource, and the destination of the link is the ending resource.

A local resource is an XML element that participates in a link by virtue of having a linking element as its parent or being itself a linking element. A remote resource is addressed by means of a URI reference.

A link that has a local starting resource and a remote ending resource is termed outbound. XLink simple links, like HTML hyperlinks, are of this type.

XLink also allows two other types of arc: inbound and third-party. An inbound arc exists when the XLink linking element is expressed on a local resource—in other words, there is a local ending resource and a remote starting resource. A third-party link exists when the XLink linking element is expressed in neither the starting resource nor the ending resource. These types of links, which are XLink extended links, can be used to form link databases, also called linkbases.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset