Latest web development tutorials

XLink and XPointer syntax

XLink syntax

In HTML, we know <a> element defines a hyperlink. But XML is not the case work. In the XML document, you can use any name you want - so the browser is unpredictable in an XML document what hyperlink elements can be called.

Hyperlinks defined in the XML document is to be placed on the element can be used as a hyperlink tags.

Here is XLink in an XML document to create a link to a simple example:

<?xml version="1.0"?>

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

<homepage xlink:type="simple"
xlink:href="http://www.w3schools.com">Visit W3Schools</homepage>

<homepage xlink:type="simple"
xlink:href="http://www.w3.org">Visit W3C</homepage>

</homepages>

To access the properties and characteristics of XLink, we must be declared at the top of the document XLink namespace.

XLink namespace is: "http://www.w3.org/1999/xlink".

<Homepage> element xlink: type and xlink: href attribute defines the type and href attributes from the XLink namespace.

xlink: type = "simple" can create a simple two ends of the link (meaning "to go from here"). Later, we will study the multiport link (multi-directional).


XPointer Syntax

In HTML, we can create a HTML page and both point to a point within an HTML page to a bookmark hyperlink (using #).

Sometimes, it can point to more specific content will be more beneficial. For example, we need to point to a specific list of items in the third or the second line of the fifth paragraph of point. By XPointer it is very easy to do.

If the hyperlink points to an XML document, we can xlink: href attribute added to the rear portion of XPointer URL, so you can navigate (with an XPath expression) to document a specific location of the.

For example, in the following example, we use XPointer points to a fifth item in the list by a unique id "rock".

href="http://www.example.com/cdlist.xml#id('rock').child(5,item)"