Book HomeXML in a Nutshell

10.3. Link Semantics

A link describes a connection between two resources. These resources may or may not be XML documents, but even if they are XML documents, the relationships they have with each other can be quite varied. For example, links can indicate parent-child relationships, previous-next relationships, employer-employee relationships, customer-supplier relationships, and many more. XLink elements can have xlink:title and xlink:role attributes to specify the meaning of the connection between the resources. The xlink:title attribute contains a small amount of plain text describing the remote resource such as might be shown in a tooltip when the user moves the cursor over the link. The xlink:role attribute contains a URI. This points to something that somehow describes or annotates the remote resource. For instance, it might indicate the MIME media type of the remote resource by pointing to a registration page for the type at the Internet Assigned Numbers Authority (IANA), such as http://www.isi.edu/in-notes/iana/assignments/media-types/application/xml.

For example, the xlink:title attribute of this novel element specifies that the text comes from Project Gutenberg, while the xlink:role attribute points to the Project Gutenberg home page.

<novel xlink:type="simple"
 xlink:href="ftp://archive.org/pub/etext/etext93/wizoz10.txt"
 xlink:title= "The complete text of the novel from Project Gutenberg"
 xlink:role="http://promo.net/pg/" >
  <title>The Wonderful Wizard of Oz</title>
  <author>L. Frank Baum</author>
  <year>1900</year>
</novel>

As with almost everything else related to XLink, exactly what browsers or other applications will do with this information or how they'll present it to readers remains to be determined.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.