6.2. Data Model
The XPath data model is relatively simple. Any XML document or object is a set of nodes of one of seven types (listed below). These nodes are organized into a hierarchical tree. In addition to this tree structure, a linear ordering of the nodes is maintained; this ordering is called “document order.”
The document order of nodes matches the order in which the first character of that node appears in the document character string form. Thus an element node precedes all of its children, because the element start tag's opening left angle bracket occurs before all element content, attributes, or namespace declarations. By convention, the root node, which has no character representation, comes first in document order:
Root node
Element ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access