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.
The result of the selection by the XPath expression appears in the XML window:
Copyright © dpunkt.verlag GmbH 2007
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "Professionelle XML-Verarbeitung mit Word" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19B, 69115 Heidelberg, fon 06221-14830, fax 06221-148399, hallo(at)dpunkt.de