Table 3-1: XPath
basic operators
Operator
|
Description
|
/
|
Path (Children): the child operator ('/') selects
from immediate children of the left-side collection.
|
//
|
Descendants: the descendant operator ('//')
selects from arbitrary descendants of the left-side collection.
|
*
|
Collecting element children: an element can
be referenced without using its name by substituting the '*'
collection
|
@
|
Attribute: attribute names are preceded by
the '@' symbol
|
[]
|
Filter: You can apply constraints and branching
to any collection by adding a filter clause '[ ]'
to the collection. The filter is analogous to the SQL where clause
with any semantics. The filter contains
a query within it, called the sub-query. If a collection is placed
within the filter, a Boolean “true” is generated
if the collection contains any members, and a “false” is
generated if the collection is empty.
|
[n]
|
Index: index is mainly use to find a specific
node within a set of nodes. Enclose the index within square brackets. The
first node is index 1.
|
text()
|
Selects the text nodes of the current context
node.
|