com.ximpleware
Class VTDNav_L5

java.lang.Object
  extended by com.ximpleware.VTDNav
      extended by com.ximpleware.VTDNav_L5

public class VTDNav_L5
extends VTDNav


Field Summary
protected  FastLongBuffer l3Buffer
           
protected  FastLongBuffer l4Buffer
           
protected  int l4index
           
protected  int l4lower
           
protected  int l4upper
           
protected  FastIntBuffer l5Buffer
           
protected  int l5index
           
protected  int l5lower
           
protected  int l5upper
           
 
Fields inherited from class com.ximpleware.VTDNav
atTerminal, context, contextStack, contextStack2, count, currentNode, docLen, docOffset, encoding, FC, fib, FIRST_CHILD, FORMAT_ASCII, FORMAT_ISO_8859_1, FORMAT_ISO_8859_10, FORMAT_ISO_8859_11, FORMAT_ISO_8859_12, FORMAT_ISO_8859_13, FORMAT_ISO_8859_14, FORMAT_ISO_8859_15, FORMAT_ISO_8859_16, FORMAT_ISO_8859_2, FORMAT_ISO_8859_3, FORMAT_ISO_8859_4, FORMAT_ISO_8859_5, FORMAT_ISO_8859_6, FORMAT_ISO_8859_7, FORMAT_ISO_8859_8, FORMAT_ISO_8859_9, FORMAT_UTF_16BE, FORMAT_UTF_16LE, FORMAT_UTF8, FORMAT_WIN_1250, FORMAT_WIN_1251, FORMAT_WIN_1252, FORMAT_WIN_1253, FORMAT_WIN_1254, FORMAT_WIN_1255, FORMAT_WIN_1256, FORMAT_WIN_1257, FORMAT_WIN_1258, l1Buffer, l1index, l2Buffer, l2index, l2lower, l2upper, l3index, l3lower, l3upper, LAST_CHILD, LC, LN, localName, localNameIndex, MASK_TOKEN_DEPTH, MASK_TOKEN_FULL_LEN, MASK_TOKEN_NS_MARK, MASK_TOKEN_OFFSET, MASK_TOKEN_PRE_LEN, MASK_TOKEN_QN_LEN, MASK_TOKEN_TYPE, maxLCDepthPlusOne, name, nameIndex, nestingLevel, NEXT_SIBLING, ns, NS, P, PARENT, PREV_SIBLING, PS, R, ROOT, rootIndex, shallowDepth, stackTemp, STRING_NORMALIZED, STRING_RAW, STRING_REGULAR, TOKEN_ATTR_NAME, TOKEN_ATTR_NS, TOKEN_ATTR_VAL, TOKEN_CDATA_VAL, TOKEN_CHARACTER_DATA, TOKEN_COMMENT, TOKEN_DEC_ATTR_NAME, TOKEN_DEC_ATTR_VAL, TOKEN_DOCUMENT, TOKEN_DTD_VAL, TOKEN_ENDING_TAG, TOKEN_PI_NAME, TOKEN_PI_VAL, TOKEN_STARTING_TAG, URIName, vtdBuffer, vtdSize, XMLDoc, XPATH_STRING_MODE_LOWERCASE, XPATH_STRING_MODE_NORMAL, XPATH_STRING_MODE_UPPERCASE
 
Constructor Summary
protected VTDNav_L5(int RootIndex, int enc, boolean NS, int depth, IByteBuffer x, FastLongBuffer vtd, FastLongBuffer l1, FastLongBuffer l2, FastLongBuffer l3, FastLongBuffer l4, FastIntBuffer l5, int so, int length)
          Initialize the VTD navigation object.
 
Method Summary
 VTDNav cloneNav()
          Clone the VTDNav instance to get with shared XML, VTD and LC buffers The node position is also copied from the original instance
 void dumpState()
           
 VTDNav duplicateNav()
          Duplicate the VTDNav instance with shared XML, VTD and LC buffers This method may be useful for parallel XPath evaluation The node Position is at root element
protected  boolean iterateNS(int dp, String URL, String ln)
          This method is similar to getElementByName in DOM except it doesn't return the nodeset, instead it iterates over those nodes .
protected  boolean nodeToElement(int direction)
          the corner case of element to node jump
 boolean pop()
          Load the context info from ContextBuffer.
protected  boolean pop2()
          Load the context info from contextStack2.
 void push()
          Store the context info into the ContextBuffer.
protected  void push2()
          Store the context info into the contextStack2.
 void recoverNode(int index)
          This method takes a vtd index, and recover its correspondin node position, the index can only be of node type element, document, attribute name, attribute value or character data, or CDATA
protected  void resolveLC_l3()
          Sync L3 location Cache
protected  void resolveLC()
          Sync up the current context with location cache.
 void sampleState(FastIntBuffer fib)
          This is for debugging purpose
protected  void sync(int depth, int index)
          Used by following:: axis
 boolean toElement(int direction)
          A generic navigation method.
 boolean toElement(int direction, String en)
          A generic navigation method.
 boolean toElementNS(int direction, String URL, String ln)
          A generic navigation method with namespace support.
protected  boolean toNode_LastChild()
           
protected  boolean toNode_PrevSibling()
           
protected  boolean toNode(int dir)
           
 boolean verifyNodeCorrectness()
          This is for debugging purpose
 void writeIndex(OutputStream os)
          Write VTDNav's internal structure into an OutputStream
 void writeSeparateIndex(OutputStream os)
          Write VTDNav's VTD and LCs into an OutputStream (XML not written out)
 
Methods inherited from class com.ximpleware.VTDNav
clearStack2, compareNormalizedTokenString2, compareRawTokenString, compareRawTokenString, compareTokens, compareTokenString, compareTokenString, contains, dumpXML, dumpXML, endsWith, fillXPathString, getAtTerminal, getAttrCount, getAttrVal, getAttrValNS, getContentFragment, getCurrentDepth, getCurrentIndex, getCurrentIndex2, getElementFragment, getElementFragmentNs, getEncoding, getIndexsize, getNestingLevel, getNormalizedStringLength, getOffsetAfterHead, getOffsetBeforeTail, getPrefixString, getRawStringLength, getRootIndex, getSiblingElementFragments, getStringLength, getText, getTokenCount, getTokenDepth, getTokenLength, getTokenLength2, getTokenOffset, getTokenType, getXML, getXPathStringVal, getXPathStringVal, getXPathStringVal2, hasAttr, hasAttrNS, isElement, isElementOrDocument, iterate_following_node, iterate_following, iterate_followingNS, iterate_preceding_node, iterate_preceding, iterate_precedingNS, iterate, iterateNode, loadCurrentNode, lookupNS, lookupNS, matchElement, matchElementNS, matchNormalizedTokenString2, matchRawTokenString, matchTokens, matchTokenString, overWrite, overWrite, parseDouble, parseFloat, parseInt, parseInt, parseLong, parseLong, recoverNode_l1, recoverNode_l2, resolveLC_l1, resolveLC_l2, setAtTerminal, setCurrentNode, startsWith, toNormalizedString, toNormalizedString2, toNormalizedXPathString, toRawString, toRawString, toRawString, toRawString, toRawString, toRawStringLowerCase, toRawStringLowerCase, toRawStringLowerCase, toRawStringUpperCase, toRawStringUpperCase, toRawStringUpperCase, toString, toString, toString, toString, toStringLowerCase, toStringLowerCase, toStringLowerCase, toStringLowerCase, toStringUpperCase, toStringUpperCase, toStringUpperCase, toStringUpperCase, writeIndex, writeSeparateIndex, XPathStringVal_Contains, XPathStringVal_EndsWith, XPathStringVal_StartsWith
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

l4index

protected int l4index

l5index

protected int l5index

l4upper

protected int l4upper

l4lower

protected int l4lower

l5upper

protected int l5upper

l5lower

protected int l5lower

l3Buffer

protected FastLongBuffer l3Buffer

l4Buffer

protected FastLongBuffer l4Buffer

l5Buffer

protected FastIntBuffer l5Buffer
Constructor Detail

VTDNav_L5

protected VTDNav_L5(int RootIndex,
                    int enc,
                    boolean NS,
                    int depth,
                    IByteBuffer x,
                    FastLongBuffer vtd,
                    FastLongBuffer l1,
                    FastLongBuffer l2,
                    FastLongBuffer l3,
                    FastLongBuffer l4,
                    FastIntBuffer l5,
                    int so,
                    int length)
Initialize the VTD navigation object.

Parameters:
RootIndex - int
maxDepth - int
encoding - int
NS - boolean
x - byte[]
vtd - com.ximpleware.ILongBuffer
l1 - com.ximpleware.ILongBuffer
l2 - com.ximpleware.ILongBuffer
l3 - com.ximpleware.IIntBuffer
so - int starting offset of the document(in byte)
length - int length of the document (in byte)
Method Detail

cloneNav

public VTDNav cloneNav()
Clone the VTDNav instance to get with shared XML, VTD and LC buffers The node position is also copied from the original instance

Overrides:
cloneNav in class VTDNav
Returns:
a new instance of VTDNav

duplicateNav

public final VTDNav duplicateNav()
Duplicate the VTDNav instance with shared XML, VTD and LC buffers This method may be useful for parallel XPath evaluation The node Position is at root element

Overrides:
duplicateNav in class VTDNav
Returns:
a VTDNav instance

iterateNS

protected final boolean iterateNS(int dp,
                                  String URL,
                                  String ln)
                           throws NavException
This method is similar to getElementByName in DOM except it doesn't return the nodeset, instead it iterates over those nodes . When URL is "*" it will match any namespace if ns is false, return false immediately

Overrides:
iterateNS in class VTDNav
Parameters:
dp - int (The depth of the starting position before iterating)
URL - java.lang.String
ln - java.lang.String
Returns:
boolean
Throws:
NavException - The exception if the underlying byte content contains various errors. Notice that we are being conservative in making little assumption on the correctness of underlying byte content. This is because VTD records can be generated by another machine from a load-balancer..
IllegalArguementException - if ln is null example int depth = nv.getCurrentDepth() while(iterateNS(depth, "www.url.com","node_name")){ push(); // store the current position //move position safely pop(); // load the position }

resolveLC

protected void resolveLC()
Sync up the current context with location cache. This operation includes finding out l1index, l2index, l3index and restores upper and lower bound info To improve efficieny this method employs some heuristic search algorithm. The result is that it is quite close to direct access. Creation date: (11/16/03 7:44:53 PM)

Overrides:
resolveLC in class VTDNav

resolveLC_l3

protected void resolveLC_l3()
Sync L3 location Cache

Overrides:
resolveLC_l3 in class VTDNav

pop

public boolean pop()
Load the context info from ContextBuffer. Info saved including LC and current state of the context

Overrides:
pop in class VTDNav
Returns:
boolean

pop2

protected final boolean pop2()
Load the context info from contextStack2. This method is dedicated for XPath evaluation.

Overrides:
pop2 in class VTDNav
Returns:
status of pop2

push

public final void push()
Store the context info into the ContextBuffer. Info saved including LC and current state of the context Creation date: (11/16/03 7:00:27 PM)

Overrides:
push in class VTDNav

push2

protected final void push2()
Store the context info into the contextStack2. This method is reserved for XPath Evaluation

Overrides:
push2 in class VTDNav

sync

protected void sync(int depth,
                    int index)
Description copied from class: VTDNav
Used by following:: axis

Overrides:
sync in class VTDNav

sampleState

public void sampleState(FastIntBuffer fib)
This is for debugging purpose

Overrides:
sampleState in class VTDNav
Parameters:
fib -

dumpState

public void dumpState()
Overrides:
dumpState in class VTDNav

toElement

public boolean toElement(int direction,
                         String en)
                  throws NavException
A generic navigation method. Move the cursor to the element according to the direction constants and the element name If no such element, no position change and return false. "*" matches any element Creation date: (12/2/03 1:43:50 PM) Legal direction constants are
                ROOT            0  
 
                PARENT          1  
 
                FIRST_CHILD     2  
 
                LAST_CHILD      3  
 
                NEXT_SIBLING    4  
 
                PREV_SIBLING    5  
 

for ROOT and PARENT, element name will be ignored.

Overrides:
toElement in class VTDNav
Parameters:
direction - int
en - String
Returns:
boolean
Throws:
NavException - When direction value is illegal. Or there are errors in underlying byte representation of the document
IllegalArguementException - if en is null

toElement

public boolean toElement(int direction)
                  throws NavException
A generic navigation method. Move the cursor to the element according to the direction constants If no such element, no position change and return false. Creation date: (12/2/03 1:43:50 PM) Legal direction constants are
                        ROOT               0 
 
                    PARENT                 1 
 
                    FIRST_CHILD            2 
 
                    LAST_CHILD             3 
 
                    NEXT_SIBLING       4 
 
            PREV_SIBLING       5 
 

Overrides:
toElement in class VTDNav
Parameters:
direction - int
Returns:
boolean
Throws:
NavException - When direction value is illegal.

nodeToElement

protected boolean nodeToElement(int direction)
Description copied from class: VTDNav
the corner case of element to node jump

Overrides:
nodeToElement in class VTDNav
Returns:

toElementNS

public boolean toElementNS(int direction,
                           String URL,
                           String ln)
                    throws NavException
A generic navigation method with namespace support. Move the cursor to the element according to the direction constants and the prefix and local names If no such element, no position change and return false. URL * matches any namespace, including undefined namespaces a null URL means hte namespace prefix is undefined for the element ln * matches any localname Creation date: (12/2/03 1:43:50 PM) Legal direction constants are
                ROOT            0  
 
                PARENT          1  
 
                FIRST_CHILD     2  
 
                LAST_CHILD      3  
 
                NEXT_SIBLING    4  
 
                PREV_SIBLING    5  
 

for ROOT and PARENT, element name will be ignored. If not ns enabled, return false immediately with no position change.

Overrides:
toElementNS in class VTDNav
Parameters:
direction - int
URL - String
ln - String
Returns:
boolean
Throws:
NavException - When direction value is illegal. Or there are errors in underlying byte representation of the document

recoverNode

public void recoverNode(int index)
                 throws NavException
This method takes a vtd index, and recover its correspondin node position, the index can only be of node type element, document, attribute name, attribute value or character data, or CDATA

Overrides:
recoverNode in class VTDNav
Parameters:
index -
Throws:
NavException

writeIndex

public void writeIndex(OutputStream os)
                throws IndexWriteException,
                       IOException
Description copied from class: VTDNav
Write VTDNav's internal structure into an OutputStream

Overrides:
writeIndex in class VTDNav
Throws:
IndexWriteException
IOException

writeSeparateIndex

public void writeSeparateIndex(OutputStream os)
                        throws IndexWriteException,
                               IOException
Write VTDNav's VTD and LCs into an OutputStream (XML not written out)

Overrides:
writeSeparateIndex in class VTDNav
Parameters:
os -
Throws:
IndexWriteException
IOException

toNode

protected boolean toNode(int dir)
                  throws NavException
Overrides:
toNode in class VTDNav
Throws:
NavException

toNode_PrevSibling

protected boolean toNode_PrevSibling()
Overrides:
toNode_PrevSibling in class VTDNav

toNode_LastChild

protected boolean toNode_LastChild()
Overrides:
toNode_LastChild in class VTDNav

verifyNodeCorrectness

public boolean verifyNodeCorrectness()
Description copied from class: VTDNav
This is for debugging purpose

Overrides:
verifyNodeCorrectness in class VTDNav


Copyright © 2013. All Rights Reserved.