May 28, 2021 XLink
In HTML, we know that the elements can define hyperlinks. B ut XML doesn't work that way. In an XML document, you can use whatever name you want - so it's impossible for a browser to predict what hyperlink elements can be called in an XML document.
The way to define hyperlinks in an XML document is to place tags on elements that can be used as hyperlinks.
Here's a simple example of using XLink to create a link in an XML document:
In order to access the properties and attributes of XLink, we must declare the XLink namespace at the top of the document.
XLink's namespace is http://www.w3.org/1999/xlink."
The xlink:type and xlink:href properties in the element define the type and href properties from the XLink namespace.
xlink:type"simple" creates a simple link between the ends (meaning "where to go from here"). We'll look at multi-end links (multi-directional) later.
In HTML, we can create a hyperlink that points to both an HTML page and a bookmark within the HTML page (using .
Sometimes it's better to point to more specific content. F or example, we need to point to the third item of a particular list, or to the second line of the fifth paragraph. XPointer is easy to do.
If the hyperlink points to an XML document, we can add the XPointer section to the Xlink:href property after the URL so that we can navigate (through the XPath expression) to a specific location in the document.
For example, in the following example, we use XPointer to point to the fifth item in a list with the unique id "rock".