public class XPathUtil extends Object
Constructor and Description |
---|
XPathUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkUniqueMatchingPaths(DOMNode from,
DOMNode to,
XPathNodePointerRanking paths) |
static Integer |
count(String expression,
WebBrowser browser)
Returns the value of the xpath expression count(myexpression).
|
static void |
disableCache() |
static String |
doQuery(String expression,
String typeResult,
WebBrowser browser)
Executes the given query and returns the textual representation of the result (not useful to retrieve nodes)
|
static void |
enableCache() |
static DOMNode |
getFirstNode(String xpath,
DOMNode contextNode) |
static DOMNode |
getFirstNode(String xpath,
WebBrowser browser)
Gets the first node returned by an xpath expression, or null if any
|
static List<DOMNode> |
getNodes(Iterable<String> xpathExpressions,
WebBrowser browser) |
static List<DOMNode> |
getNodes(String xpath,
DOMNode contextNode)
Gets the first node returned by an xpath expression, or null if any
|
static List<DOMNode> |
getNodes(String xpath,
DOMNode node,
WebBrowser browser) |
static List<DOMNode> |
getNodes(String xpath,
WebBrowser browser)
Gets the first node returned by an xpath expression, or null if any
|
static DOMNode |
getUniqueNode(String xpath,
DOMNode contextNode) |
static void |
invalidateCache() |
static boolean |
isInvalidName(String nodeName) |
static boolean |
isUniquelyMatching(String xpath,
DOMNode targetNode) |
static int |
retrieveNodePosition(String xpath,
DOMNode target,
int count)
Gets the position of the selected DOM node by adding a positional predicate to the xpath expression.
|
static XPathNodePointerRanking |
uniqueMatchingPaths(DOMNode from,
DOMNode to,
XPathNodePointerRanking paths) |
public static void enableCache()
public static void disableCache()
public static void invalidateCache()
public static String doQuery(String expression, String typeResult, WebBrowser browser)
expression
- the querytypeResult
- accepted values as "STRING" "BOOLEAN" "NUM" "NODESET"browser
- public static Integer count(String expression, WebBrowser browser)
DiademRuntimeException
if any
error occurs.
TODO why Integer and not int as return value?expression
- the expression to use as argument for countbrowser
- the browser to usepublic static int retrieveNodePosition(String xpath, DOMNode target, int count)
xpath
- the xpath expressionnode
- the target DOM nodecount
- the count of the OXPath expressionpublic static DOMNode getFirstNode(String xpath, WebBrowser browser)
xpath
- the OXPath expressionnode
- the DOM nodepublic static DOMNode getUniqueNode(String xpath, DOMNode contextNode) throws WebAPIException
WebAPIException
public static List<DOMNode> getNodes(String xpath, WebBrowser browser)
xpath
- the OXPath expressionnode
- the DOM nodepublic static List<DOMNode> getNodes(String xpath, DOMNode contextNode)
xpath
- the OXPath expressionnode
- the DOM nodepublic static List<DOMNode> getNodes(String xpath, DOMNode node, WebBrowser browser)
public static List<DOMNode> getNodes(Iterable<String> xpathExpressions, WebBrowser browser)
public static boolean isInvalidName(String nodeName)
public static boolean checkUniqueMatchingPaths(DOMNode from, DOMNode to, XPathNodePointerRanking paths)
public static XPathNodePointerRanking uniqueMatchingPaths(DOMNode from, DOMNode to, XPathNodePointerRanking paths)
Copyright © 2020 OXPath Team. All rights reserved.