6.1. Introduction to XPath

An XPath expression specifies a part of any XML object to which it is applied.

XPath models XML as a hierarchical tree of nodes. The best way of thinking of this structure is to say the following: An XPath operation takes an XPath node-set (or XML converted into an XPath node-set) and then tags certain nodes in that set as being selected. As long as you stay in the world of XPath node-sets, the entire original node-set remains accessible through XPath operations that can find related nodes from any starting node in the set. For example, XPath operations can find ancestor or descendant nodes. As soon as you leave the XPath world with a selected node-set, all nodes not output are lost. In XML Security, the nodes output ...

Get Secure XML: The New Syntax for Signatures and Encryption now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.