BEA Systems, Inc.


weblogic.apache.xpath.axes
Class AxesWalker

java.lang.Object
  |
  +--weblogic.apache.xpath.Expression
        |
        +--weblogic.apache.xpath.patterns.NodeTest
              |
              +--weblogic.apache.xpath.axes.PredicatedNodeTest
                    |
                    +--weblogic.apache.xpath.axes.AxesWalker
Direct Known Subclasses:
FilterExprWalker, KeyWalker, ReverseAxesWalker

public class AxesWalker
extends PredicatedNodeTest
implements java.lang.Cloneable

Serves as common interface for axes Walkers, and stores common state variables.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

See Also:
Serialized Form

Field Summary
protected  int m_axis
          The traversal axis from where the nodes will be filtered.
protected  AxesWalker m_nextWalker
          The next walker in the location step chain.
protected  weblogic.apache.xml.dtm.DTMAxisTraverser m_traverser
          The DTM inner traversal class, that corresponds to the super axis.
 
Fields inherited from class weblogic.apache.xpath.axes.PredicatedNodeTest
m_foundLast, m_lpi, m_predCount, m_proximityPositions
 
Fields inherited from class weblogic.apache.xpath.patterns.NodeTest
m_name, m_whatToShow, SCORE_NODETEST, SCORE_NONE, SCORE_NSWILD, SCORE_OTHER, SCORE_QNAME, SHOW_BYFUNCTION, SUPPORTS_PRE_STRIPPING, WILD
 
Fields inherited from class weblogic.apache.xpath.Expression
m_slocator
 
Constructor Summary
AxesWalker(LocPathIterator locPathIterator, int axis)
          Construct an AxesWalker using a LocPathIterator.
 
Method Summary
 java.lang.Object clone()
          Get a cloned AxesWalker.
 int getAxis()
          Returns the axis being iterated, if it is known.
 int getCurrentNode()
          The node at which the TreeWalker is currently positioned.
 weblogic.apache.xml.dtm.DTM getDTM(int node)
          Get the DTM for this walker.
 int getLastPos(XPathContext xctxt)
          Get the index of the last node that can be itterated to.
protected  int getNextNode()
          Get the next node in document order on the axes.
 AxesWalker getNextWalker()
          Get the next walker in the location step chain.
 AxesWalker getPrevWalker()
          Get the previous walker reference in the location step chain.
 int getRoot()
          The root node of the TreeWalker, as specified in setRoot(int root).
 void init(Compiler compiler, int opPos, int stepType)
          Initialize an AxesWalker during the parse of the XPath expression.
 boolean isDocOrdered()
          Returns true if all the nodes in the iteration well be returned in document order.
 int nextNode()
          Moves the TreeWalker to the next visible node in document order relative to the current node, and returns the new node.
 void setDefaultDTM(weblogic.apache.xml.dtm.DTM dtm)
          Set the DTM for this walker.
 void setNextWalker(AxesWalker walker)
          Set the next walker in the location step chain.
 void setPrevWalker(AxesWalker walker)
          Set or clear the previous walker reference in the location step chain.
 void setRoot(int root)
          Set the root node of the TreeWalker.
 WalkingIterator wi()
           
 
Methods inherited from class weblogic.apache.xpath.axes.PredicatedNodeTest
acceptNode, canTraverseOutsideSubtree, countProximityPosition, fixupVariables, getLocPathIterator, getPredicateCount, getPredicateIndex, getProximityPosition, getProximityPosition, getProximityPosition, initPredicateInfo, initProximityPosition, isReverseAxes, nodeToString, resetProximityPositions, setLocPathIterator, setPredicateCount
 
Methods inherited from class weblogic.apache.xpath.patterns.NodeTest
calcScore, debugWhatToShow, execute, execute, execute, getDefaultScore, getLocalName, getNamespace, getNodeTypeTest, getStaticScore, getWhatToShow, initNodeTest, initNodeTest, setLocalName, setNamespace, setStaticScore, setWhatToShow
 
Methods inherited from class weblogic.apache.xpath.Expression
asIterator, asNode, assertion, bool, error, executeCharsToContentHandler, isNodesetExpr, isStableNumber, num, setSourceLocator, warn, xstr
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_nextWalker

protected AxesWalker m_nextWalker
The next walker in the location step chain.

m_axis

protected int m_axis
The traversal axis from where the nodes will be filtered.

m_traverser

protected weblogic.apache.xml.dtm.DTMAxisTraverser m_traverser
The DTM inner traversal class, that corresponds to the super axis.
Constructor Detail

AxesWalker

public AxesWalker(LocPathIterator locPathIterator,
                  int axis)
Construct an AxesWalker using a LocPathIterator.

Parameters:
locPathIterator - non-null reference to the parent iterator.
Method Detail

wi

public final WalkingIterator wi()


init

public void init(Compiler compiler,
                 int opPos,
                 int stepType)
          throws javax.xml.transform.TransformerException
Initialize an AxesWalker during the parse of the XPath expression.

Parameters:
compiler - The Compiler object that has information about this walker in the op map.
opPos - The op code position of this location step.
stepType - The type of location step.
Throws:
javax.xml.transform.TransformerException -  

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Get a cloned AxesWalker.

Returns:
A new AxesWalker that can be used without mutating this one.
Throws:
java.lang.CloneNotSupportedException -  
Overrides:
clone in class PredicatedNodeTest

getRoot

public int getRoot()
The root node of the TreeWalker, as specified in setRoot(int root). Note that this may actually be below the current node.

Returns:
The context node of the step.

setRoot

public void setRoot(int root)
Set the root node of the TreeWalker. (Not part of the DOM2 TreeWalker interface).

Parameters:
root - The context node of this step.

getCurrentNode

public final int getCurrentNode()
The node at which the TreeWalker is currently positioned.
The value must not be null. Alterations to the DOM tree may cause the current node to no longer be accepted by the TreeWalker's associated filter. currentNode may also be explicitly set to any node, whether or not it is within the subtree specified by the root node or would be accepted by the filter and whatToShow flags. Further traversal occurs relative to currentNode even if it is not part of the current view by applying the filters in the requested direction (not changing currentNode where no traversal is possible).

Returns:
The node at which the TreeWalker is currently positioned, only null if setRoot has not yet been called.

setNextWalker

public void setNextWalker(AxesWalker walker)
Set the next walker in the location step chain.

Parameters:
walker - Reference to AxesWalker derivative, or may be null.

getNextWalker

public AxesWalker getNextWalker()
Get the next walker in the location step chain.

Returns:
Reference to AxesWalker derivative, or null.

setPrevWalker

public void setPrevWalker(AxesWalker walker)
Set or clear the previous walker reference in the location step chain.

Parameters:
walker - Reference to previous walker reference in the location step chain, or null.

getPrevWalker

public AxesWalker getPrevWalker()
Get the previous walker reference in the location step chain.

Returns:
Reference to previous walker reference in the location step chain, or null.

getNextNode

protected int getNextNode()
Get the next node in document order on the axes.

Returns:
the next node in document order on the axes, or null.

nextNode

public int nextNode()
Moves the TreeWalker to the next visible node in document order relative to the current node, and returns the new node. If the current node has no next node, or if the search for nextNode attempts to step upward from the TreeWalker's root node, returns null , and retains the current node.

Returns:
The new node, or null if the current node has no next node in the TreeWalker's logical view.

getLastPos

public int getLastPos(XPathContext xctxt)
Get the index of the last node that can be itterated to.

Parameters:
xctxt - XPath runtime context.
Returns:
the index of the last node that can be itterated to.
Overrides:
getLastPos in class PredicatedNodeTest

setDefaultDTM

public void setDefaultDTM(weblogic.apache.xml.dtm.DTM dtm)
Set the DTM for this walker.

Parameters:
dtm - Non-null reference to a DTM.

getDTM

public weblogic.apache.xml.dtm.DTM getDTM(int node)
Get the DTM for this walker.

Returns:
Non-null reference to a DTM.

isDocOrdered

public boolean isDocOrdered()
Returns true if all the nodes in the iteration well be returned in document order. Warning: This can only be called after setRoot has been called!

Returns:
true as a default.

getAxis

public int getAxis()
Returns the axis being iterated, if it is known.

Returns:
Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs70

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference