XML XLink: Simple Links vs Extended Links

The XML Linking Language (XLink) defines two distinct mechanisms for creating hyperlinks within XML documents: simple links and extended links. While simple links provide traditional, unidirectional, one-to-one connections similar to standard HTML hyperlinks, extended links offer a sophisticated framework capable of connecting multiple resources simultaneously, defining multidirectional paths, and managing links independently from the resources they connect. Understanding the architectural and functional differences between these two link types is essential for structuring complex data relationships in XML.

A simple link (xlink:type="simple") creates a direct, one-way connection from the element containing the link to a target resource. It behaves almost identically to the <a> tag in HTML.

<book xlink:type="simple" 
      xlink:href="https://example.com/books/123" 
      xlink:title="Book Details" 
      xlink:show="replace" 
      xlink:actuate="onRequest">
    XML Fundamentals
</book>

An extended link (xlink:type="extended") is a container that associates multiple resources, both local and remote, and defines complex relationship rules between them.

<relatedDocs xlink:type="extended">
    <document xlink:type="locator" xlink:href="spec.xml" xlink:label="spec" xlink:title="Specification"/>
    <document xlink:type="locator" xlink:href="guide.xml" xlink:label="guide" xlink:title="User Guide"/>
    <document xlink:type="locator" xlink:href="errata.xml" xlink:label="errata" xlink:title="Errata"/>

    <!-- Define bidirectional paths between specification, guide, and errata -->
    <connection xlink:type="arc" xlink:from="spec" xlink:to="guide" xlink:title="Refer to Guide"/>
    <connection xlink:type="arc" xlink:from="spec" xlink:to="errata" xlink:title="View Errata"/>
</relatedDocs>

Key Differences Summary

Feature Simple Links Extended Links
Element Type xlink:type="simple" xlink:type="extended"
Connections Exclusively 1-to-1 1-to-many, many-to-1, many-to-many
Directionality Unidirectional (source to target) Multidirectional via explicit arc definitions
Location Inline only Inline or Out-of-line (external linkbases)
Structure Single self-contained XML element Complex container with child elements (locator, arc, resource)
Use Case Navigational references and basic file pointers Knowledge graphs, complex cross-references, annotations on read-only data