|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
XPath
represents an XPath expression after
it has been parsed from a String.
Method Summary | |
java.lang.Object |
evaluate(java.lang.Object context)
evaluate evaluates an XPath expression and returns
the result as an Object . |
org.jaxen.FunctionContext |
getFunctionContext()
|
org.jaxen.NamespaceContext |
getNamespaceContext()
|
java.lang.String |
getText()
getText will return the textual version of
the XPath expression. |
org.jaxen.VariableContext |
getVariableContext()
|
boolean |
matches(Node node)
matches returns true if the given node matches
the XPath expression. |
java.lang.Number |
numberValueOf(java.lang.Object context)
numberValueOf evaluates an XPath expression
and returns the numeric value of the XPath expression if the XPath
expression results in a number, or null if the result is not a number. |
java.util.List |
selectNodes(java.lang.Object context)
selectNodes performs this XPath expression
on the given Node or List of Node s
instances appending all the results together into a single list. |
java.util.List |
selectNodes(java.lang.Object context,
XPath sortXPath)
selectNodes evaluates the XPath expression
on the given Node or List of Node s
and returns the result as a List of
Node s sorted by the sort XPath expression. |
java.util.List |
selectNodes(java.lang.Object context,
XPath sortXPath,
boolean distinct)
selectNodes evaluates the XPath expression
on the given Node or List of Node s
and returns the result as a List of
Node s sorted by the sort XPath expression. |
java.lang.Object |
selectObject(java.lang.Object context)
Deprecated. please use evaluate(Object) instead. |
Node |
selectSingleNode(java.lang.Object context)
selectSingleNode evaluates this XPath expression
on the given Node or List of Node s
and returns the result as a single Node instance. |
void |
setFunctionContext(org.jaxen.FunctionContext functionContext)
Sets the function context to be used when evaluating XPath expressions |
void |
setNamespaceContext(org.jaxen.NamespaceContext namespaceContext)
Sets the namespace context to be used when evaluating XPath expressions |
void |
setNamespaceURIs(java.util.Map map)
Sets the current NamespaceContext from a Map where the keys are the String namespace prefixes and the values are the namespace URIs For example. |
void |
setVariableContext(org.jaxen.VariableContext variableContext)
Sets the variable context to be used when evaluating XPath expressions |
void |
sort(java.util.List list)
sort sorts the given List of Nodes
using this XPath expression as a Comparator . |
void |
sort(java.util.List list,
boolean distinct)
sort sorts the given List of Nodes
using this XPath expression as a Comparator
and optionally removing duplicates. |
java.lang.String |
valueOf(java.lang.Object context)
valueOf evaluates this XPath expression
and returns the textual representation of the results using the
XPath string() function. |
Method Detail |
public java.lang.String getText()
getText
will return the textual version of
the XPath expression.
public boolean matches(Node node)
matches
returns true if the given node matches
the XPath expression. To be more precise when evaluating this XPath
expression on the given node the result set must include the node.
matches
in interface NodeFilter
public java.lang.Object evaluate(java.lang.Object context)
evaluate
evaluates an XPath expression and returns
the result as an Object
. The object returned can
either be a List
of Node
instances, a Node
instance, a String
or a Number
instance depending on
the XPath expression.
context
- is either a node or a list of nodes on which to
evalute the XPath
List
of Node
instances, a Node
instance, a String
or a Number
instance depending on
the XPath expression.public java.lang.Object selectObject(java.lang.Object context)
selectObject
evaluates an XPath expression and returns
the result as an Object
. The object returned can
either be a List
of Node
instances, a Node
instance, a String
or a Number
instance depending on
the XPath expression.
context
- is either a node or a list of nodes on which to
evalute the XPath
List
of Node
instances, a Node
instance, a String
or a Number
instance depending on
the XPath expression.public java.util.List selectNodes(java.lang.Object context)
selectNodes
performs this XPath expression
on the given Node
or List
of Node
s
instances appending all the results together into a single list.
context
- is either a node or a list of nodes on which to
evalute the XPath
public java.util.List selectNodes(java.lang.Object context, XPath sortXPath)
selectNodes
evaluates the XPath expression
on the given Node
or List
of Node
s
and returns the result as a List
of
Node
s sorted by the sort XPath expression.
context
- is either a node or a list of nodes on which to
evalute the XPathsortXPath
- is the XPath expression to sort by
Node
instancespublic java.util.List selectNodes(java.lang.Object context, XPath sortXPath, boolean distinct)
selectNodes
evaluates the XPath expression
on the given Node
or List
of Node
s
and returns the result as a List
of
Node
s sorted by the sort XPath expression.
context
- is either a node or a list of nodes on which to
evalute the XPathsortXPath
- is the XPath expression to sort bydistinct
- specifies whether or not duplicate values of the
sort expression are allowed. If this parameter is true then only
distinct sort expressions values are included in the result
Node
instancespublic Node selectSingleNode(java.lang.Object context)
selectSingleNode
evaluates this XPath expression
on the given Node
or List
of Node
s
and returns the result as a single Node
instance.
context
- is either a node or a list of nodes on which to
evalute the XPath
Node
instancepublic java.lang.String valueOf(java.lang.Object context)
valueOf
evaluates this XPath expression
and returns the textual representation of the results using the
XPath string() function.
context
- is either a node or a list of nodes on which to
evalute the XPath
public java.lang.Number numberValueOf(java.lang.Object context)
numberValueOf
evaluates an XPath expression
and returns the numeric value of the XPath expression if the XPath
expression results in a number, or null if the result is not a number.
context
- is either a node or a list of nodes on which to
evalute the XPath
public void sort(java.util.List list)
sort
sorts the given List of Nodes
using this XPath expression as a Comparator
.
list
- is the list of Nodes to sortpublic void sort(java.util.List list, boolean distinct)
sort
sorts the given List of Nodes
using this XPath expression as a Comparator
and optionally removing duplicates.
list
- is the list of Nodes to sortdistinct
- if true then duplicate values (using the sortXPath for
comparisions) will be removed from the Listpublic org.jaxen.FunctionContext getFunctionContext()
public void setFunctionContext(org.jaxen.FunctionContext functionContext)
public org.jaxen.NamespaceContext getNamespaceContext()
public void setNamespaceContext(org.jaxen.NamespaceContext namespaceContext)
public void setNamespaceURIs(java.util.Map map)
Map uris = new HashMap();
uris.put( "SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/" );
uris.put( "m", "urn:xmethodsBabelFish" );
XPath xpath = document.createXPath( "/SOAP-ENV:Envelope/SOAP-ENV:Body/m:BabelFish" );
xpath.setNamespaceURIs( uris );
Node babelfish = xpath.selectSingleNode( document );
public org.jaxen.VariableContext getVariableContext()
public void setVariableContext(org.jaxen.VariableContext variableContext)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |