2 data model
XPath operates an XML document as a tree. The tree model is only conceptual and does not require any particular implementation. The relationship between the model and the XML information set is described in the XML information set (http://www.w3.org/tr/xpath#infoseet).
The tree contains nodes, with a total of 7 node types:
· Root node
· Element node
· Text node
· Attribute node
· Name Space Node
· Handling instruction node
· Note node
The node is an orderly, and they follow the order of documents, the document order is a order in which all node definitions in the document correspond to the general entity extension, and the first character of each node appears in the first character. The order in the document XML represents. In this way, the root node will be the first node. Element nodes appear in front of their children. Therefore, the document order is set in order of the element node to start the label in XML (after the entity extension). The properties node and namespace nodes of the element appear in front of the children of the elements. Name Space Node Definitions appear before the property node. The relative order of the namespace node is dependent on the implementation. The relative order of the attribute node is realized.
For each node type, there is a method to determine the string value of the node of this type. For some nodes, string values are part of the node; for other nodes, the calculation of string values is determined by the string value of the descendant node.
Root node
The root of the root node is the tree. In addition to the root of the tree, the root node will no longer appear. The element node of the document element is the child of the root node. The processing instructions and comments that appear after the preamble and document elements are also sub-processing instructions and comment nodes of the root node. The string value of the root node is the accumulation of the string value of all text nodes under the text sequence.
Element node
Each element in the document has an element node. Children with element nodes are element nodes, comment nodes, processing nodes, and text nodes thereof. Entity references to internal and external entities will be expanded, and the character reference is also decomposed. The string value of the element node is the accumulation of the string value of all the descendants of all text nodes under the text order.
Element node can have a unique identifier (ID), which is a value declared in the DTD as the attribute of the type ID. In the same document, there is no two elements to have the same unique identifier.
Property node
Each element node has associated attribute node set; the element is the parent node of each of these attribute nodes; the property node has a string value. String value is a standardized value for XML recommendations.
Name Space Node
Each element has a collection of namespace nodes, one for each different namespace prefix in the range of elements (including XML prefix, which is implicitly declared by XML Names Space Recommendation), and the other is for the default Namespaces. The element is the parent node of these named spatial nodes. The string value of the namespace node is binding namespace URI that is binding in the namespace prefix; if it is relative, it must be parsed.
Processing command node
In addition to the processing instructions that appear in the document type declaration, each processing instruction corresponds to the processing instruction node. The string value of each processing command node is the target and any blank portion of the processing instruction, which does not include the end?>.
Note node
In addition to the comments that appear in the document type declaration, each annotation has an comment node. The string value of the comment is the content of the comment, not including the start.
.
Text node
Text node consists of character data. Each body node always contains as many character data as possible: two adjacent text nodes do not appear. The string value of the text node is its character data. Text nodes always have at least one character's data.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -----------------