Introduction to XLink

In HTML, the contents of the a element define the hyperlink. However, an XML document can contain user-defined elements. Therefore, web browsers cannot identify hyperlinks in an XML document. The solution is to use XLink, which stands for XML Linking language. XLink specifies constructs such as elements and attributes that enable you to create hyperlinks in an XML document.

The following code snippet creates a hyperlink in an XML document:

  <?xml version="1.0"?>
    <hyperlinks     xmlns:xlink="http://www.w3.org/1999/xlink">
      <hyperlinkName xlink:type="simple"
      xlink:href="http://mysite.com"> MySite       </hyperlinkName>
    </hyperlinks>

In the preceding code snippet, xmlns:xlink="http://www.w3.org/1999/xlink" defines the namespace that defines features such as the attributes of XLink. Examples of the attributes defined in the XLink namespace are xlink:type and xlink:href. These attributes declare that the http://mysite.com web site will be displayed by clicking MySite.

After specifying the XLink constructs in an XML document, applications can use an XLink processor, which can interpret the XLink elements and attributes, to present the hyperlinks contained in an XML document. An example of such an application is an HTML web browser such as Mozilla Firefox.

The graphic shows a hyperlink in an XML document point to a web browser.
Click the Next button to continue.