C# Class com.ximpleware.AutoPilot

XimpleWare's AutoPilot implementation encapsulating node iterator and XPath.
Mostra file Open project: jzhang2004/vtd-xml Class Usage Examples

Protected Properties

Property Type Description
URL System.String
cachingEnabled bool
contextCopy int[]
depth int
endIndex int
ft bool
index int
iter_type int
localName System.String
name System.String
name2 System.String
nsHash System.Collections.Hashtable
size int
special bool
stackSize int
vn VTDNav
xpe Expr

Public Methods

Method Description
AutoPilot ( ) : System

Use this constructor for delayed binding to VTDNav which allows the reuse of XPath expression

AutoPilot ( VTDNav v ) : System

AutoPilot constructor comment.

bind ( VTDNav vnv ) : void

Bind is to replace rebind() and setVTDNav() It resets the internal state of AutoPilot so one can attach a VTDNav object to the autopilot

clearVariableExprs ( ) : void

Remove all namespaces bindings

clearXPathNameSpaces ( ) : void

Remove all namespace bindings

declareVariableExpr ( String varName, String varExpr ) : void

declare variable references

declareXPathNameSpace ( System prefix, System URL ) : void

This function creates URL ns prefix and is intended to be called prior to selectXPath

enableCaching ( bool state ) : void

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.. param state

evalXPath ( ) : int

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

evalXPathToBoolean ( ) : bool

evalXPathToBoolean() evaluates the xpath expression to a boolean

evalXPathToNumber ( ) : double

evalXPathToNumber() evaluates the xpath expression to a double

evalXPathToString ( ) : String

evalXPathToString() evaluates the xpath expression to a String

getExprString ( ) : System.String

Convert the expression to a string For debugging purpose

getNav ( ) : VTDNav
iterate ( ) : bool

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)

iterate2 ( ) : bool
iterateAttr ( ) : int

This method implements the attribute axis for XPath

resetXPath ( ) : void

Reset the XPath so the XPath Expression can be reused and revaluated in anther context position

selectAttr ( System en ) : void

Select an attribute name for iteration, * choose all attributes of an element

selectAttrNS ( System ns_URL, System ln ) : void

Select an attribute name, both local part and namespace URL part

selectElement ( System en ) : void

Select the element name before iterating. "*" matches every element Creation date: (12/4/03 5:51:31 PM)

selectElementNS ( System ns_URL, System ln ) : void

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)

selectXPath ( System s ) : void

This method selects the string representing XPath expression Usually evalXPath is called afterwards

Protected Methods

Method Description
checkNsUniqueness ( int i ) : bool
iterateAttr2 ( ) : int

This method implements the attribute axis for XPath

iterateNameSpace ( ) : int

selectDescendantNode ( ) : void

selectElementNS_D ( System ns_URL, System ln ) : void

Select all descendent elements along the Descendent axis, withns awareness

selectElementNS_F ( System ns_URL, System ln ) : void

Select all elements along the preceding axis as defined in XPath The namespace-aware version

selectElementNS_P ( System ns_URL, System ln ) : void

Select all elements along the preceding axis as defined in XPath This is the namespace aware version

selectElement_D ( System en ) : void

Select all descendent elements along the descendent axis, without ns awareness

selectElement_F ( System en ) : void

Select all elements along the following axis, without ns, null selects every elements and documents

selectElement_P ( System en ) : void

Select all elements along the preceding axis as defined in XPath

selectFollowingNode ( ) : void
selectNameSpace ( String en ) : void

selectNode ( ) : void
selectPrecedingNode ( ) : void

Method Details

AutoPilot() public method

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

AutoPilot() public method

AutoPilot constructor comment.
If the VTDNav object is null ///
public AutoPilot ( VTDNav v ) : System
v VTDNav
return System

bind() public method

Bind is to replace rebind() and setVTDNav() It resets the internal state of AutoPilot so one can attach a VTDNav object to the autopilot
public bind ( VTDNav vnv ) : void
vnv VTDNav * ///
return void

checkNsUniqueness() protected method

protected checkNsUniqueness ( int i ) : bool
i int
return bool

clearVariableExprs() public method

Remove all namespaces bindings
public clearVariableExprs ( ) : void
return void

clearXPathNameSpaces() public method

Remove all namespace bindings
public clearXPathNameSpaces ( ) : void
return void

declareVariableExpr() public method

declare variable references
public declareVariableExpr ( String varName, String varExpr ) : void
varName String
varExpr String
return void

declareXPathNameSpace() public method

This function creates URL ns prefix and is intended to be called prior to selectXPath
public declareXPathNameSpace ( System prefix, System URL ) : void
prefix System
URL System
return void

enableCaching() public method

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.. param state
public enableCaching ( bool state ) : void
state bool
return void

evalXPath() public method

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
public evalXPath ( ) : int
return int

evalXPathToBoolean() public method

evalXPathToBoolean() evaluates the xpath expression to a boolean
public evalXPathToBoolean ( ) : bool
return bool

evalXPathToNumber() public method

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

evalXPathToString() public method

evalXPathToString() evaluates the xpath expression to a String
public evalXPathToString ( ) : String
return String

getExprString() public method

Convert the expression to a string For debugging purpose
public getExprString ( ) : System.String
return System.String

getNav() public method

public getNav ( ) : VTDNav
return VTDNav

iterate() public method

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)
See description in method toElement() in VTDNav class. ///
public iterate ( ) : bool
return bool

iterate2() public method

public iterate2 ( ) : bool
return bool

iterateAttr() public method

This method implements the attribute axis for XPath
public iterateAttr ( ) : int
return int

iterateAttr2() protected method

This method implements the attribute axis for XPath
protected iterateAttr2 ( ) : int
return int

iterateNameSpace() protected method

protected iterateNameSpace ( ) : int
return int

resetXPath() public method

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

selectAttr() public method

Select an attribute name for iteration, * choose all attributes of an element
public selectAttr ( System en ) : void
en System ///
return void

selectAttrNS() public method

Select an attribute name, both local part and namespace URL part
public selectAttrNS ( System ns_URL, System ln ) : void
ns_URL System ///
ln System ///
return void

selectDescendantNode() protected method

protected selectDescendantNode ( ) : void
return void

selectElement() public method

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

selectElementNS() public method

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)
public selectElementNS ( System ns_URL, System ln ) : void
ns_URL System
ln System java.lang.String ///
return void

selectElementNS_D() protected method

Select all descendent elements along the Descendent axis, withns awareness
protected selectElementNS_D ( System ns_URL, System ln ) : void
ns_URL System ///
ln System ///
return void

selectElementNS_F() protected method

Select all elements along the preceding axis as defined in XPath The namespace-aware version
protected selectElementNS_F ( System ns_URL, System ln ) : void
ns_URL System
ln System
return void

selectElementNS_P() protected method

Select all elements along the preceding axis as defined in XPath This is the namespace aware version
protected selectElementNS_P ( System ns_URL, System ln ) : void
ns_URL System ///
ln System ///
return void

selectElement_D() protected method

Select all descendent elements along the descendent axis, without ns awareness
protected selectElement_D ( System en ) : void
en System ///
return void

selectElement_F() protected method

Select all elements along the following axis, without ns, null selects every elements and documents
protected selectElement_F ( System en ) : void
en System ///
return void

selectElement_P() protected method

Select all elements along the preceding axis as defined in XPath
protected selectElement_P ( System en ) : void
en System ///
return void

selectFollowingNode() protected method

protected selectFollowingNode ( ) : void
return void

selectNameSpace() protected method

protected selectNameSpace ( String en ) : void
en String
return void

selectNode() protected method

protected selectNode ( ) : void
return void

selectPrecedingNode() protected method

protected selectPrecedingNode ( ) : void
return void

selectXPath() public method

This method selects the string representing XPath expression Usually evalXPath is called afterwards
public selectXPath ( System s ) : void
s System ///
return void

Property Details

URL protected_oe property

Store URL name after selectElementNS
protected String,System URL
return System.String

cachingEnabled protected_oe property

true if caching is enabled for xpath evaluation
protected bool cachingEnabled
return bool

contextCopy protected_oe property

for preceding axis
protected int[] contextCopy
return int[]

depth protected_oe property

the depth of the element at the starting point will determine when to stop iteration
protected int depth
return int

endIndex protected_oe property

protected int endIndex
return int

ft protected_oe property

a helper variable for
protected bool ft
return bool

index protected_oe property

for iterAttr
protected int index
return int

iter_type protected_oe property

see selectElement
protected int iter_type
return int

localName protected_oe property

Store local name after selectElemntNS
protected String,System localName
return System.String

name protected_oe property

Store element name after selectElement
protected String,System name
return System.String

name2 protected_oe property

xmlns:+name
protected String,System name2
return System.String

nsHash protected_oe static_oe property

hash table holding
protected static System.Collections.Hashtable nsHash
return System.Collections.Hashtable

size protected_oe property

for iterateAttr
protected int size
return int

special protected_oe property

This helps distinguish between
protected bool special
return bool

stackSize protected_oe property

the stack size for xpath evaluation
protected int stackSize
return int

vn protected_oe property

the navigator object
protected VTDNav vn
return VTDNav

xpe protected_oe property

for evalXPath
protected Expr xpe
return Expr