XLink - Inside and Out
by Thomas Erl

When comparing XML to HTML, XML’s huge data-centric feature set makes it an attractive alternative to HTML, as a standard document format. However, even when pairing XML with XSL’s formatting functionality, a feature-by-feature comparison of XML+XSL versus HTML will point out one major omission from XML’s list: hyperlinking. With HTML documents, adding hyperlinks is as easy as surrounding a piece of text with anchor (<a>) tags, and adding the link destination as a URL to the tag’s hyperlink reference (href) attribute, as follows:

Click <a href=”www.xmltc.com”>here</a> now.

This HTML statement is rendered as below, once displayed by a browser:

Click here now.

The underlined part of the text represents a link to the SOA Systems’ Web site. This simple ability to provide hyperlinks within a Web page text is arguably the Internet’s most powerful feature, yet an XML document (even when linked to an XSL style sheet) cannot provide this functionality on its own. This is why XLink was developed. Not only does XLink supply the ability to create HTML hyperlinks, its specification is equipped with an elaborate language that addresses many shortcomings of the HTML anchor tag.

For instance, with XLink, a document’s hyperlinks can be isolated in a separate link document. This centralizes link information the same way XSL style sheets centralize formatting information, and the benefits are very similar. If the destination address of a hyperlink changes, it only needs to be updated in one location. Also, in an HTML authoring environment, a document editor would need to have write permissions in order to add hyperlinks to a previously authored HTML document. This is no longer necessary, as the editor can now generate the links independently.

Additionally, with XLink developers can now add meta information to hyperlinks, which can provide the user with comprehensive information about the destination resource of a hyperlink, without having to visit it.

Finally, through the creation of a complex linking structure, XLink can even create linking associations between more than two resources.

XLink structures (regardless of whether they are embedded in XML documents or exist externally), can represent either “simple” or “extended” links (which is defined through the XLink type attribute). A simple link structure provides basic information to associate the origin and destination resources, as follows (note that the numbers on the left are line numbers):

1.  <sample:linkelement xmlns:sample="http://www.samplereports.com/"
2.     xmlns:xlink="http://www.w3.org/1999/xlink"
3.     xlink:type="simple"
4.     xlink:href="http://www.soasystems.com"
5.     xlink:title="Report on SOA Systems Inc."
6.     xlink:show="new">
7.     SOA Systems Inc.
8.  </sample:linkelement>

This XLink structure is really just an XML element definition with a series of attribute/value pairs. This first line:

xmlns:sample="http://www.
samplereports.com/"

…defines the namespace within which this link file is active.

The second line:

xmlns:xlink="http://
www.w3.org/1999/xlink"

…specifies the XLink specification used by the processor.

On the third line:

xlink:type="simple"

…the type attribute defines this structure as being of type “simple.”

The fourth line:

xlink:href="http://www.soasystems.com"

…contains the familiar href attribute, which provides the address of the destination resource.

The title attribute on the fifth line:

xlink:title="Report on SOA Systems Inc."

…assigns the link a text value independent from the displayed text representing the link (this is similar to the HTML alt attribute).

On the sixth line:

xlink:show="new"

…the show attribute is comparable to the HTML target attribute, in that it provides options for how the browser will behave when opening the destination resource.

Finally, the last line before the XLink end-tag:

SOA Systems Inc.

…simply contains the text that is displayed in the browser, to which the hyperlink information is assigned.

Extended links are beyond the scope of this paper, however it is sufficient to state that they introduce the ability to create complex link structures by providing the features to identify multiple link “participants” which can be associated in different ways. Additionally, the “link traversal” paths between participants can also be defined by extended link structures.

SOA Design Patterns by Thomas Erl
Foreword by Grady Booch
With contributions from David Chappell, Jason Hogg, Anish Karmarkar, Mark Little, David Orchard, Satadru Roy, Thomas Rischbeck, Arnaud Simon, Clemens Utschig, Dennis Wisnosky, and others.
Web Service Contract Design & Versioning for SOA by Thomas Erl, Anish Karmarkar, Priscilla Walmsley, Hugo Haas, Umit Yalcinalp, Canyang Kevin Liu, David Orchard, Andre Tost, James Pasley
SOA Principles of Service Design by Thomas Erl
Service-Oriented Architecture: A Field Guide to Integrating XML and Web Services by Thomas Erl
Service-Oriented Infrastructure:On-Premise and in the Cloud by Raj Balasubramanian, Benjamin Carlyle, Thomas Erl, Cesare Pautasso
Next Generation SOA:A Real-World Guide to Modern Service-Oriented Computing by Pethuru Cheliah, Thomas Erl, Clive Gee, Robert Laird, Berthold Maier, Hajo Normann, Leo Shuster, Bernd Trops, Clemens Utschig, Torsten Winterberg
SOA with .NET & Windows Azure: Realizing Service-Orientation with the Microsoft Platform by David Chou, John deVadoss, Thomas Erl, Nitin Gandhi, Hanu Kommalapati, Brian Loesgen, Christoph Schittko, Herbjorn Wilhelmsen, Mickey Williams
SOA Governance:
Governing Shared Services On-Premise & in the Cloud
by Stephen Bennett, Thomas Erl, Clive Gee, Anne Thomas Manes, Robert Schneider, Leo Shuster, Andre Tost, Chris Venable
SOA with Java by Raj Balasubramanian, David Chou, Thomas Erl, Thomas Plunkett, Satadru Roy, Philip Thomas, Andre Tost
Modern SOA Methodology: Methods for Applying Service-Orientation On-Premise & in the Cloud by Raj Balasubramanian, David Chou, Thomas Erl, Thomas Plunkett, Satadru Roy, Philip Thomas, Andre Tost
Cloud Computing: Concepts, Technology & Architecture by Thomas Erl, Zaigham Mahmood, Ricardo Puttini
Cloud Computing Design Patterns by Thomas Erl, Amin Naserpour

For more information about these books, visit: www.servicetechbooks.com


Arcitura Education Inc.
Arcitura Education Inc. is a leading global provider of progressive, vendor-neutral training and certification programs, providing industry-recognized certification programs for a range of certifications.
For more information:
www.arcitura.com
SOA Certified Professional (SOACP)
The books in this series are part of the official curriculum for the SOA Certified Professional program.
For more information:
www.soaschool.com
Cloud Certified Professional (CCP)
The books in this series are part of the official curriculum for the Cloud Certified Professional program.
For more information:
www.cloudschool.com
Big Data Science Certified Professional (BDSCP)
The books in this series are part of the official curriculum for the Big Data Science Certified Professional program.
For more information:
www.bigdatascienceschool.com/