com.ximpleware
Class AutoPilot

java.lang.Object
  extended by com.ximpleware.AutoPilot

public class AutoPilot
extends java.lang.Object

XimpleWare's AutoPilot implementation encapsulating node iterator and XPath.


Field Summary
static int ATTR
           
static int ATTR_NS
           
static int DESCENDANT
           
static int DESCENDANT_NS
           
static int FOLLOWING
           
static int FOLLOWING_NS
           
static int PRECEDING
           
static int PRECEDING_NS
           
static int SIMPLE
           
static int SIMPLE_NS
           
static int UNDEFINED
           
 
Constructor Summary
AutoPilot()
          Use this constructor for delayed binding to VTDNav which allows the reuse of XPath expression
AutoPilot(VTDNav v)
          AutoPilot constructor comment.
 
Method Summary
 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
 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
 boolean iterate()
          Iterate over all the selected element nodes in document order.
 void resetXPath()
          Reset the XPath so the XPath Expression can be reused and revaluated in anther context position
 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR

public static final int ATTR
See Also:
Constant Field Values

ATTR_NS

public static final int ATTR_NS
See Also:
Constant Field Values

DESCENDANT

public static final int DESCENDANT
See Also:
Constant Field Values

DESCENDANT_NS

public static final int DESCENDANT_NS
See Also:
Constant Field Values

FOLLOWING

public static final int FOLLOWING
See Also:
Constant Field Values

FOLLOWING_NS

public static final int FOLLOWING_NS
See Also:
Constant Field Values

PRECEDING

public static final int PRECEDING
See Also:
Constant Field Values

PRECEDING_NS

public static final int PRECEDING_NS
See Also:
Constant Field Values

SIMPLE

public static final int SIMPLE
See Also:
Constant Field Values

SIMPLE_NS

public static final int SIMPLE_NS
See Also:
Constant Field Values

UNDEFINED

public static final int UNDEFINED
See Also:
Constant Field Values
Constructor Detail

AutoPilot

public AutoPilot()
Use this constructor for delayed binding to VTDNav which allows the reuse of XPath expression


AutoPilot

public AutoPilot(VTDNav v)
AutoPilot constructor comment.

Throws:
java.lang.IllegalArgumentException - If the VTDNav object is null
Method Detail

bind

public 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

Parameters:
vnv -

clearVariableExprs

public void clearVariableExprs()
Remove all declared variable expressions


clearXPathNameSpaces

public void clearXPathNameSpaces()
Remove all namespaces bindings


declareVariableExpr

public void declareVariableExpr(java.lang.String varName,
                                java.lang.String varExpr)
                         throws XPathParseException
Register the binding between a variableExpr name and variableExpr expression

Parameters:
varName -
varExpr -
Throws:
XPathParseException

declareXPathNameSpace

public 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

Parameters:
prefix -
URL -

evalXPath

public int evalXPath()
              throws XPathEvalException,
                     NavException
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

Returns:
int corresponding to the VTD index
Throws:
XPathEvalException
NavException

evalXPathToBoolean

public boolean evalXPathToBoolean()
evalXPathToBoolean() evaluates the xpath expression to a boolean

Returns:
boolean

evalXPathToNumber

public double evalXPathToNumber()
evalXPathToNumber() evaluates the xpath expression to a double

Returns:
double

evalXPathToString

public java.lang.String evalXPathToString()
evalXPathToString() evaluates the xpath expression to a String

Returns:
String

getExprString

public java.lang.String getExprString()
Convert the expression to a string For debugging purpose

Returns:
String

iterate

public boolean iterate()
                throws com.ximpleware.PilotException,
                       NavException
Iterate over all the selected element nodes in document order. Null element name allowed, corresponding to node() in xpath Creation date: (12/4/03 5:25:42 PM)

Returns:
boolean
Throws:
NavException - See description in method toElement() in VTDNav class.
com.ximpleware.PilotException

resetXPath

public void resetXPath()
Reset the XPath so the XPath Expression can be reused and revaluated in anther context position


selectElement

public void selectElement(java.lang.String en)
Select the element name before iterating. "*" matches every element Creation date: (12/4/03 5:51:31 PM)

Parameters:
en - java.lang.String

selectElementNS

public void selectElementNS(java.lang.String ns_URL,
                            java.lang.String ln)
Select the element name (name space version) before iterating. URL, if set to *, matches every namespace URL, if set to null, indicates the namespace is undefined. localname, if set to *, matches any localname Creation date: (12/4/03 6:05:19 PM)

Parameters:
ns_URL - String
ln - String

selectXPath

public void selectXPath(java.lang.String s)
                 throws XPathParseException
This method selects the string representing XPath expression Usually evalXPath is called afterwards

Parameters:
s -
Throws:
XPathParseException