public class AutoPilot
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ATTR |
static int |
ATTR_NS |
static int |
DESCENDANT |
static int |
DESCENDANT_NODE |
static int |
DESCENDANT_NS |
static int |
FOLLOWING |
static int |
FOLLOWING_NODE |
static int |
FOLLOWING_NS |
static int |
NAME_SPACE |
static int |
PRECEDING |
static int |
PRECEDING_NODE |
static int |
PRECEDING_NS |
static int |
SIMPLE |
static int |
SIMPLE_NODE |
static int |
SIMPLE_NS |
static int |
UNDEFINED |
Constructor and Description |
---|
AutoPilot()
Use this constructor for delayed binding to VTDNav which allows the reuse
of XPath expression
|
AutoPilot(VTDNav v)
AutoPilot constructor comment.
|
Modifier and Type | Method and Description |
---|---|
void |
bind(VTDNav vnv)
Bind is to replace rebind() and setVTDNav() It resets the internal state
of AutoPilot so one can attach a VTDNav object to the autopilot
|
void |
clearVariableExprs()
Remove all declared variable expressions
|
void |
clearXPathNameSpaces()
Remove all namespaces bindings
|
void |
declareVariableExpr(java.lang.String varName,
java.lang.String varExpr)
Register the binding between a variableExpr name and variableExpr
expression
|
void |
declareXPathNameSpace(java.lang.String prefix,
java.lang.String URL)
This function creates URL ns prefix and is intended to be called prior to
selectXPath
|
void |
enableCaching(boolean state)
set state to false to disable caching, which by default is enabled This
method will turn on the internal caching feature during xpath evaluation,
which is to store the evaluation results of absolute expressions when
they resides in a predicate examples: //a[//bb=//cc] //bb and //cc are
cached internally to avoid repeitive computation..
|
int |
evalXPath()
This method returns the next node in the nodeset it returns -1 if there
is no more node Afer finishing evaluating, don't forget to
reset the xpath
|
boolean |
evalXPathToBoolean()
evalXPathToBoolean() evaluates the xpath expression to a boolean
|
double |
evalXPathToNumber()
evalXPathToNumber() evaluates the xpath expression to a double
|
java.lang.String |
evalXPathToString()
evalXPathToString() evaluates the xpath expression to a String
|
java.lang.String |
getExprString()
Convert the expression to a string For debugging purpose
|
VTDNav |
getNav() |
boolean |
iterate()
Iterate over all the selected element nodes in document order.
|
boolean |
iterate2() |
int |
iterateAttr()
This method is meant to be called after calling selectAttr() or
selectAttrNs(), it will return the vtd index attribute name or -1 if
there is none left
|
void |
resetXPath()
Reset the XPath so the XPath Expression can be reused and revaluated in
anther context position
|
void |
selectAttr(java.lang.String en)
Select an attribute name for iteration, * choose all attributes of an
element
|
void |
selectAttrNS(java.lang.String ns_URL,
java.lang.String ln)
Select an attribute name, both local part and namespace URL part
|
void |
selectElement(java.lang.String en)
Select the element name before iterating.
|
void |
selectElementNS(java.lang.String ns_URL,
java.lang.String ln)
Select the element name (name space version) before iterating.
|
void |
selectXPath(java.lang.String s)
This method selects the string representing XPath expression Usually
evalXPath is called afterwards
|
public static final int ATTR
public static final int ATTR_NS
public static final int DESCENDANT
public static final int DESCENDANT_NODE
public static final int DESCENDANT_NS
public static final int FOLLOWING
public static final int FOLLOWING_NODE
public static final int FOLLOWING_NS
public static final int NAME_SPACE
public static final int PRECEDING
public static final int PRECEDING_NODE
public static final int PRECEDING_NS
public static final int SIMPLE
public static final int SIMPLE_NODE
public static final int SIMPLE_NS
public static final int UNDEFINED
public AutoPilot()
public AutoPilot(VTDNav v)
java.lang.IllegalArgumentException
- If the VTDNav object is nullpublic void bind(VTDNav vnv)
vnv
- public final void clearVariableExprs()
public final void clearXPathNameSpaces()
public void declareVariableExpr(java.lang.String varName, java.lang.String varExpr) throws XPathParseException
varName
- varExpr
- XPathParseException
public final void declareXPathNameSpace(java.lang.String prefix, java.lang.String URL)
prefix
- URL
- public final void enableCaching(boolean state)
state
- public int evalXPath() throws XPathEvalException, NavException
XPathEvalException
NavException
public final boolean evalXPathToBoolean()
public final double evalXPathToNumber()
public final java.lang.String evalXPathToString()
public final java.lang.String getExprString()
public final VTDNav getNav()
public boolean iterate() throws PilotException, NavException
NavException
- See description in method toElement() in VTDNav class.PilotException
public boolean iterate2() throws PilotException, NavException
PilotException
NavException
public int iterateAttr() throws PilotException, NavException
PilotException
NavException
public final void resetXPath()
public void selectAttr(java.lang.String en)
en
- public final void selectAttrNS(java.lang.String ns_URL, java.lang.String ln)
ns_URL
- ln
- public void selectElement(java.lang.String en)
en
- java.lang.Stringpublic void selectElementNS(java.lang.String ns_URL, java.lang.String ln)
ns_URL
- Stringln
- Stringpublic void selectXPath(java.lang.String s) throws XPathParseException
s
- XPathParseException