XML technologies / XML / Python & XML / Querying XML with XPath / XPath at a glance
(Excerpt from "Python & XML" by Christopher A. Jones & Fred L. Drake, Jr.)
XPath 1.0 is a W3C recommendation (Note from the data2type editors: There is now XPath 3.0, as of February 2015). XPath provides access to parts of an XML document through XPath expressions. The specification defines a concrete expression syntax and a well-defined meaning when expressions are interpreted. When an XPath expression is processed by a DOM, the matching nodes are returned to the caller. XPath expressions target a particular node or a group of nodes in an XML document. The result can take four different forms:
A collection of nodes
A boolean value
A floating-point number
A string
In XPath the term context refers to the location in the document where the XPath expression is applied. You can start at the document element (the root element) or at any element derived from it. XPath can report the current context node, which represents the current position in the document. A pair of integers can specify the context position and size. The context may also contain variables, functions and a namespace relevant to the current position.
Copyright © 2002 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from the book "Python & XML" is subject to the same conditions as the printed edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de
back to top