XPath – Introduction to the technology for the access to XML structures

XPath is a language for addressing nodes of XML documents and is therefore the second partial concept within the XSL concept. XPath allows the access to structures and contents of a XML document. In addition to the mere navigation, it is also possible to perform certain operations via defined functions. Here we will focus on the functions being most common and important for our purposes. For the testing of XPath expressions, we recommend you the free programme XPath tester which is generally available online. XPath expressions can be very complex in practice and therefore very error-prone. Most errors in XPath expressions occur because the target  cannot be found, which means no results are displayed or a result is displayed which was not intended. During the visualisation process the targets of XPath expressions are displayed in the context of the XML document. In this way it is easy to decide whether the expression achieves the desired result.

Instructions for starting the XPath tester

1. Call up the XPath tester under www.xpathtester.com/test.

2. Copy the content of the Europe.xml file into the XML window.

3. Enter the required XPath expression (e.g. //Population) in the XPath: input field and press the Test! button.

XPath tester

 

The result of the selection by the XPath expression appears in the XML window:

XPath tester - query result

  next >>