weblogic.xml.xpath
Class DOMXPath

IMPORTANT: Each of the evaluateAs...() methods can take
either a DOM Document or DOM Node. You should only pass a DOM Node
if you really mean to evaluate the xpath in relation to a DOM
subtree. Do not use the document element
(Document.getDocumentElement()) if your intention is to evaluate
the xpath against the whole document - these are not the same
thing.

To illustrate the difference, consider matching a simple
relative location path 'foo' against a document containing a single
element . This xpath is really an abbreviation for 'select
all child foos of the context node'. The document element (as
returned by Document.getDocumentElement()) in this case is the
single ; if this is passed as the context node, the xpath is
clearly not going to match anything. However, if the Root Node is passed
(which DOM represents with the Document object), then the foo will
be matched.

Field Summary

static int

BOOLEAN
Returned by getType() to indicate that
this XPath evaluates to a boolean.

OTHER

NAMESPACE_NODE_TYPE

public static final int NAMESPACE_NODE_TYPE

Type for synthesized namespace nodes. DOM does not provide
direct support for the 'namespace' node type described in the
XPath data model, so the DOMXPath implementation creates special
org.w3c.dom.Nodes for this purpose. Calling getType() on such
nodes will return NAMESPACE_NODE_TYPE.

evaluateAsNodeset

Evaluates this XPath in the context of the given document and
returns the result as a node-set. The node-set is represented as
a Set of org.w3c.dom.Nodes.

Some effort is made to ensure that Iterators retrived from
such a Set will traverse the matched nodes in document order.
This guarantee is not made for XPaths which make use of the union
or composition operators.

Because the specification does not define conversions to
node-set from other types, this method will return null if the
XPath naturally evaluates to a type other than node-set.

evaluateAsString

Evaluates this XPath in the context of the given document and
returns the result as a String. If this XPath naturally
evaluates to a type other than String, the necessary type
conversion will be performed as described in the XPath
specification.

evaluateAsBoolean

Evaluates this XPath in the context of the given document and
returns the result as a boolean. If this XPath naturally
evaluates to a type other than boolean, the necessary type
conversion will be performed as described in the XPath
specification.

evaluateAsNumber

Evaluates this XPath in the context of the given document and
returns the result as a number. If this XPath naturally
evaluates to a type other than number, the necessary type
conversion will be performed as described in the XPath
specification.

evaluateAsNodeset

Evaluates this XPath in the context of the given Node and
returns the result as a node-set. The node-set is represented as
a Set of org.w3c.dom.Nodes.

Some effort is made to ensure that Iterators retrived from
such a Set will traverse the matched nodes in document order.
This guarantee is not made for XPaths which make use of the union
or composition operators.

Because the specification does not define conversions to
node-set from other types, this method will return null if the
XPath naturally evaluates to a type other than node-set.

evaluateAsString

Evaluates this XPath in the context of the given Node and
returns the result as a String. If this XPath naturally
evaluates to a type other than String, the necessary type
conversion will be performed as described in the XPath
specification.

evaluateAsBoolean

Evaluates this XPath in the context of the given Node and
returns the result as a boolean. If this XPath naturally
evaluates to a type other than boolean, the necessary type
conversion will be performed as described in the XPath
specification.

evaluateAsNumber

Evaluates this XPath in the context of the given Node and
returns the result as a number. If this XPath naturally
evaluates to a type other than number, the necessary type
conversion will be performed as described in the XPath
specification.

setVariableBindings

Sets the variable bindings for the evaluation process. This
method must not be called after one of the xpath's evaluate
methods has been called.

Parameters:

bindings - Provides a mapping for resolving variable
names which may appear in the XPath. Values in the map which are
instances of java.lang.String,
java.lang.Boolean, or java.lang.Number
will be used as values of the corresponding XPath types. Values
which are instances of java.util.List are assumed to
be node-lists. Values of other types are not currently
recognized.

Copyright 1996, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.