Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XLink instance


May 28, 2021 XLink


Table of contents


XLink instance

Once you understand the syntax of XLink, you need to learn more through example exercises.

Let's study some basic XLink syntax by studying an example.


XML instance documentation

Take a look at the following XML document, ".xml," which presents the book:

<?xml version="1.0" encoding="ISO-8859-1"?>

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

<book title="Harry Potter">
<description
xlink:type="simple"
xlink:href="http://book.com/images/HPotter.gif" rel="external nofollow" target="_blank"
xlink:show="new">
As his fifth year at Hogwarts School of Witchcraft and
Wizardry approaches, 15-year-old Harry Potter is.......
</description>
</book>

<book title="XQuery Kick Start">
<description
xlink:type="simple"
xlink:href="http://book.com/images/XQuery.gif" rel="external nofollow" target="_blank"
xlink:show="new">
XQuery Kick Start delivers a concise introduction
to the XQuery standard.......
</description>
</book>

</bookstore>

View the "bookstore.xml" bookstore .xml browser.

In the example above, the XLink document namespace (xmlns:xlink="http://www.w3.org/1999/xlink") is declared at the top of the document. This means that the document has access to XLink's properties and attributes.

xlink:type-"simple" creates simple HTML-like links. You can also specify more complex links (multi-directional links), but for now, we only use simple links.

The xlink:href property specifies the URL to link to, while the xlink:show property specifies where to open the link. xlink:show"new" means that the link (in this case, an image) opens in a new window.


XLink - Learn more

In the example above, we show only simple links. X Link is even more interesting when we want to access resources at remote locations rather than separate pages. I n the example above, the XLINK property of the element set shows a value of "new". T his means that the link should open in a new window. W e can set the value in XLINK: display the property "embed". T his means that resources should be embedded in page processing. You think this could be another XML document, not just an image, and you can build an example of a hierarchy in an XML document.

With XLink, you can also specify resources to display only. T his is handled by XLink's actuate property. T he resource files specified by XLINK: actuate" and "onLoad" should be loaded and displayed. X LINK: Actuate means that the resource cannot be read or displayed until the link is clicked. This is convenient for low bandwidth settings.