XML technologies / XML / Python & XML / Querying XML with XPath

(Excerpt from "Python & XML" by Christopher A. Jones & Fred L. Drake, Jr.)

The XML Path Language (XPath) is a language that lets you search XML documents using a path-like string. An XPath query returns individual nodes or sets of nodes based on expressions. XPath does not use XML syntax. Indeed, it is not a procedural programming language in the usual sense: there is no concept of control flow. XPath expressions are usually individual strings. XPath does support a certain functional style of processing, commonly found in programming languages, but you do not write XPath scripts or programs. Instead, you write XPath expressions, which are evaluated against XML documents and produce lists of nodes that are then returned. This section explains the origins of XPath, its syntax and capabilities, and how it is used in Python.

  

  

 

 

 

back to top