Google

: Class Navigator

com.icl.saxon.om
Class Navigator


java.lang.Object

  |

  +--com.icl.saxon.om.Navigator


public class Navigator
extends java.lang.Object

Navigator provides helper classes for navigating a tree, irrespective of its implementation


Constructor Summary
Navigator()
           
 
Method Summary
static int getNumberAny(NodeInfo node, Pattern count, Pattern from, Context context)
          Get node number (level="any").
static java.util.Vector getNumberMulti(NodeInfo node, Pattern count, Pattern from, Context context)
          Get node number (level="multiple").
static int getNumberSimple(NodeInfo node)
          Get simple node number.
static int getNumberSimple(NodeInfo node, Context context)
          Get simple node number.
static int getNumberSingle(NodeInfo node, Pattern count, Pattern from, Context context)
          Get node number (level="single").
static java.lang.String getPath(NodeInfo node)
          Get an absolute XPath expression that identifies a given node within its document
static boolean isAncestor(NodeInfo node, NodeInfo other)
          Determine whether this node is an ancestor of another node
static boolean isWhite(java.lang.String content)
          Determine if a string is all-whitespace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Navigator


public Navigator()
Method Detail

isWhite


public static boolean isWhite(java.lang.String content)
Determine if a string is all-whitespace

isAncestor


public static boolean isAncestor(NodeInfo node,
                                 NodeInfo other)
Determine whether this node is an ancestor of another node
Parameters:
node - the putative ancestor node
other - the other node (the putative descendant of this node)
Returns:
true of this node is an ancestor of the other node

getPath


public static java.lang.String getPath(NodeInfo node)
Get an absolute XPath expression that identifies a given node within its document

getNumberSimple


public static int getNumberSimple(NodeInfo node,
                                  Context context)
                           throws XPathException
Get simple node number. This is defined as one plus the number of previous siblings of the same node type and name. It is not accessible directly in XSL.
Parameters:
context - Used for remembering previous result, for performance

getNumberSimple


public static int getNumberSimple(NodeInfo node)
Get simple node number. This is defined as one plus the number of previous siblings of the same node type and name. It is not accessible directly in XSL. This version doesn't require the context, and therefore doesn't remember previous results

getNumberSingle


public static int getNumberSingle(NodeInfo node,
                                  Pattern count,
                                  Pattern from,
                                  Context context)
                           throws XPathException
Get node number (level="single"). If the current node matches the supplied pattern, the returned number is one plus the number of previous siblings that match the pattern. Otherwise, return the element number of the nearest ancestor that matches the supplied pattern.
Parameters:
count - Pattern that identifies which nodes should be counted. Default (null) is the element name if the current node is an element, or "node()" otherwise.
from - Pattern that specifies where counting starts from. Default (null) is the root node. (This parameter does not seem useful but is included for the sake of XSLT conformance.)
Returns:
the node number established as follows: go to the nearest ancestor-or-self that matches the 'count' pattern and that is a descendant of the nearest ancestor that matches the 'from' pattern. Return one plus the nunber of preceding siblings of that ancestor that match the 'count' pattern. If there is no such ancestor, return 0.

getNumberAny


public static int getNumberAny(NodeInfo node,
                               Pattern count,
                               Pattern from,
                               Context context)
                        throws XPathException
Get node number (level="any"). Return one plus the number of previous nodes in the document that match the supplied pattern
Parameters:
count - Pattern that identifies which nodes should be counted. Default (null) is the element name if the current node is an element, or "node()" otherwise.
from - Pattern that specifies where counting starts from. Default (null) is the root node. Only nodes after the first (most recent) node that matches the 'from' pattern are counted.
Returns:
one plus the number of nodes that precede the current node, that match the count pattern, and that follow the first node that matches the from pattern if specified.

getNumberMulti


public static java.util.Vector getNumberMulti(NodeInfo node,
                                              Pattern count,
                                              Pattern from,
                                              Context context)
                                       throws XPathException
Get node number (level="multiple"). Return a vector giving the hierarchic position of this node. See the XSLT spec for details.
Parameters:
count - Pattern that identifies which nodes (ancestors and their previous siblings) should be counted. Default (null) is the element name if the current node is an element, or "node()" otherwise.
from - Pattern that specifies where counting starts from. Default (null) is the root node. Only nodes below the first (most recent) node that matches the 'from' pattern are counted.
Returns:
a vector containing for each ancestor-or-self that matches the count pattern and that is below the nearest node that matches the from pattern, an Integer which is one greater than the number of previous siblings that match the count pattern.