2008年(17)
分类: C/C++
2008-03-10 17:44:39
Expression | Refers to |
---|---|
./author |
All elements within the current context. Note that this is equivalent to the expression in the next row. |
author |
All elements within the current context. |
first.name |
All elements within the current context. |
/bookstore |
The document element ( ) of this document. |
//author |
All elements in the document. |
book[/bookstore/@specialty = @style] |
All elements whose style attribute value is equal to the specialty attribute value of the element at the root of the document. |
author/first-name |
All elements that are children of an element. |
bookstore//title |
All elements one or more levels deep in the element (arbitrary descendants). Note that this is different from the expression in the next row. |
bookstore/*/title |
All elements that are grandchildren of elements. |
bookstore//book/excerpt//emph |
All elements anywhere inside children of elements, anywhere inside the element. |
.//title |
All elements one or more levels deep in the current context. Note that this situation is essentially the only one in which the period notation is required. |
author/* |
All elements that are the children of elements. |
book/*/last-name |
All elements that are grandchildren of elements. |
*/* |
All grandchildren elements of the current context. |
*[@specialty] |
All elements with the specialty attribute. |
@style |
The style attribute of the current context. |
price/@exchange |
The exchange attribute on elements within the current context. |
price/@exchange/total |
Returns an empty node set, because attributes do not contain element children. This expression is allowed by the XML Path Language (XPath) grammar, but is not strictly valid. |
book[@style] |
All elements with style attributes, of the current context. |
book/@style |
The style attribute for all elements of the current context. |
@* |
All attributes of the current element context. |
./first-name |
All elements in the current context node. Note that this is equivalent to the expression in the next row. |
first-name |
All elements in the current context node. |
author[1] |
The first element in the current context node. |
author[first-name][3] |
The third element that has a child. |
my:book |
The element from the my namespace. |
my:* |
All elements from the my namespace. |
@my:* |
All attributes from the my namespace (this does not include unqualified attributes on elements from the my namespace). |