前言: Xpath, 就把它当做一棵树的查找!!
Xpath Data Model
-
Sequences and items
The XPath data model is based on the notion of a sequence. The value of an XPath expression is always a sequence. A sequence is an ordered collection of zero or more items. An item is either an atomic value or a node. -
Atomic values
An atomic value is an instance of one of the built-in atomic data types that are defined by XML Schema.These data types include strings, integers, decimals, dates, and other atomic types. -
Nodes
A node conforms to one of the types of nodes that are defined for XPath. These node types include: document, element, attribute, text, processing instruction, comment, and namespace nodes.-
Document nodes
A document node encapsulates an XML document. -
Element nodes
An element node encapsulates an XML element. -
Attribute nodes
An attribute node represents an XML attribute. -
Text nodes
A text node encapsulates XML character content. -
Processing instruction nodes
A processing instruction node encapsulates an XML processing instruction. -
Comment nodes
A comment node encapsulates XML comments.
-
Document nodes
Relationship of Nodes
-
Parent
Each element and attribute has one parent. -
Children
Element nodes may have zero, one or more children. -
Siblings
Nodes that have the same parent. -
Ancestors
A node's parent, parent's parent, etc. -
Descendants
A node's children, children's children, etc.
Xpath Syntax
Location Path
axis::nodetest[predicate]
网友评论