The XPath Data Model

An XPath query operates on a namespace well-formed XML document after it has been parsed into a tree structure. The particular tree model XPath uses divides each XML document into seven kinds of nodes:

Root Node

The document itself. The root node's children are the comments and processing instructions in the prolog and epilog and the root element of the document.

Element Node

An element. Its children are all of the child elements, text nodes, comments, and processing instructions that the element contains. An element also has namespaces and attributes. However, these are not child nodes.

Attribute Node

An attribute other than one that declares a namespace.

Text Node

The maximum uninterrupted run of text between tags, comments, and ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX 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.