Home XML Tutorials XML Namespace, XPath, XPointer, and XLink

XML Tutorials - XML Namespace, XPath, XPointer, and XLink

As we've seen in tutorial 2, the XML language is defined in several specifications. In this tutorial, we will look at four of the XML specifications: XML Namespaces, XML Path Language (XPath), XML Pointer Language (XPointer), and XML Linking Language (XLink). You can view these four specifications at the W3C Web site (http://www.w3c.org.)

XLink is part of the XML standard that currently defines the linking components of XML. XLink is similar to the functionality of the <a> tag in HTML in that XLink allows elements to be inserted into XML documents to create links between resources. XLink also has additional features. XPath is a language that views the XML document as a tree with nodes. Using XPath, you can locate any node in the XML document tree. XPointer provides a way to address the internal structure of an XML document. XPointer extends XPath by allowing you to address points and ranges in addition to nodes, locate information by string matching, and use addressing expressions in URI-references as fragment identifiers. XLink works with either XPath or XPointer. The XPath or XPointer language is used to define where you want to link in an XML document, and XLink will provide the actual link to that point in the document.

Namespaces are also an important part of the XML specification. When creating DTDs or schemas from multiple documents, you need a way to define where each definition originated. This is especially important if two external documents use the same name for an element, but each is defining a different element. For example, title could refer to Mr., Mrs., and Miss in one DTD and to the title of the document in another DTD. If you merged these two DTDs, you would have a name conflict. Namespaces prevent this conflict from happening.

In this tutorial, we'll begin by looking at namespaces and then move on to the XPath, XPointer, and XLink languages.

NOTE
At the time of this writing, the specifications for XLink and XPointer are still being reviewed, and it's possible that some of the syntax will change. The overall structure of XPointer, XPath, and XLink should not change.

Table of content (tutorial index)

advertisement