Package scriptella.driver.xpath
Class NodeVariable
java.lang.Object
scriptella.driver.xpath.NodeVariable
A special
node variable for sub-queries and scripts that wraps
the node selected by an XPath query, exposing useful methods.- Author:
- Martin Alderson
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNodeVariable(scriptella.driver.xpath.XPathExpressionCompiler compiler, Node node) -
Method Summary
Modifier and TypeMethodDescriptionGets the text value(s) of the node(s) selected by the specified XPath expression.Gets the string value of the first selected node by the specified XPath expression.Gets the string value of the first selected node by the specified XPath expression.String[]getStringArray(String expression) Gets the text values of the nodes selected by the specified XPath expression.voidremove()Removes this node from the document.
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
NodeVariable
-
-
Method Details
-
getStringArray
Gets the text values of the nodes selected by the specified XPath expression.- Parameters:
expression- xpath expression to evaluate.- Returns:
- a String array of text values of the selected nodes.
-
getString
Gets the string value of the first selected node by the specified XPath expression.- Parameters:
expression- xpath expression to evaluate.- Returns:
- the text value of the first selected node, or null.
-
getString
Gets the string value of the first selected node by the specified XPath expression.- Parameters:
expression- xpath expression to evaluate.ifNull- String to return if the specified expression evaluates to null.- Returns:
- the text value of the first selected node, or the specified string if null.
-
get
Gets the text value(s) of the node(s) selected by the specified XPath expression.- Parameters:
expression- xpath expression to evaluate.- Returns:
- a String array of the selected nodes, or just a single String if one node found.
-
remove
public void remove()Removes this node from the document. This is especially useful to improve performance and reduce memory usage when processing large documents.
-