public class HtmlUnitXPath
extends org.jaxen.BaseXPath
This is the main entry point for matching an XPath against a HU-DOM
tree. You create a compiled XPath object, then match it against one or
more context nodes using the BaseXPath.selectNodes(Object)
method, as in the following example:
XPath path = new HtmlUnitXPath("a/b/c"); List results = path.selectNodes(domNode);
BaseXPath
,
Serialized FormConstructor and Description |
---|
HtmlUnitXPath(String xpathExpr)
Construct given an XPath expression string.
|
HtmlUnitXPath(String xpathExpr,
org.jaxen.Navigator navigator)
Construct given an XPath expression string and a Document Navigator.
|
Modifier and Type | Method and Description |
---|---|
static org.jaxen.Navigator |
buildSubtreeNavigator(DomNode node)
Builds a navigator that will see the provided node as the "document"
and only navigate in its children.
The returned navigator can only be used to evaluate xpath expressions on nodes of the same document as the provided one. |
String |
toString()
Gives the xpath expression provided to c'tor.
|
addNamespace, booleanValueOf, createFunctionContext, createNamespaceContext, createVariableContext, debug, evaluate, getContext, getContextSupport, getFunctionContext, getNamespaceContext, getNavigator, getRootExpr, getVariableContext, numberValueOf, selectNodes, selectNodesForContext, selectSingleNode, selectSingleNodeForContext, setFunctionContext, setNamespaceContext, setVariableContext, stringValueOf, valueOf
public HtmlUnitXPath(String xpathExpr) throws org.jaxen.JaxenException
xpathExpr
- The XPath expression.org.jaxen.JaxenException
- if there is a syntax error while parsing the expression.public HtmlUnitXPath(String xpathExpr, org.jaxen.Navigator navigator) throws org.jaxen.JaxenException
xpathExpr
- The XPath expression.navigator
- the document navigator to use for evaluationorg.jaxen.JaxenException
- if there is a syntax error while parsing the expression.public static org.jaxen.Navigator buildSubtreeNavigator(DomNode node)
node
- the node that should be considered as the root by the navigatorpublic String toString()
toString
in class org.jaxen.BaseXPath
BaseXPath.toString()
Copyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.