XPath Data Model
In the perspective of XPath, elements,
Attributes, text, comments, processing
Instructions or even namespaces
Are represented by nodes associated with each other in the tree structure. Some nodes, such as elements, can have subnodes, but some cannot. For example, attributes cannot have subnodes according to XML specifications. The root node is the ultimate parent node.
Each node exposes its attributes to XPath in different ways:
- A name. some nodes, such as the root node, the remarks and text node names are always empty strings "". elements and attributes have extended names: local name plus namespace URI. processing Instructions uses the "target" that is not affected by namespace processing as the name. the namespace node uses the prefix as the name.
- A text node in a string value. xml source contains text characters
A string value. text nodes contain the text characters from
Source XML, with line endings normalized to # XA as required by the XML specification. Text
Nodes will always contain as much text as possible, and, thus, no two
Consecutive children will ever both be text nodes and the location of CDATA
Sections is not preserved. Comment nodes
Contain the full text of the comment (minus
<! --And
-->Delimiters). Attributes contain the attribute value, and processing instructions contain the text after
The initial target and whitespace, and up to and not including the terminating
?>. Namespace nodes contain a URI (or the empty
String) as a name. The root node and Element
Nodes compute their string value by recursively concatenating the string values
Of all descendant nodes.
Children. In theory, you can ask about children
Of any node, but only the root node and element nodes will actually have
Children.
A position relative to all other nodes.
Overall ordering is called the document order.
Alas... I am tired. I am still able to read English directly.