XPath Basics

XPath expressions navigate and retrieve XML content similar to traversing a file system’s directory structure, except that XPath works on an XML document tree (also called XML DOM tree).

In XPath, the root node of an XML document is defined as a slash (/). Then, a location path, which is another slash (/) along with the element’s name, steps down the XML DOM tree and selects the specified XML element. For example, the XPath expression /contact returns the <contact> element. The /contact/first_name returns the <first_name> element, which is a child element of <contact>.

The most important type of XPath expressions is the location path, which consists of a sequence of location steps. Each step has three components: an axis, a node ...

Get Oracle Database 11g Building Oracle XML DB Applications 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.