com.icl.saxon.axis
Class Axis

java.lang.Object
  |
  +--com.icl.saxon.axis.Axis

public abstract class Axis
extends java.lang.Object

An axis, that is a direction of navigation in the document structure.


Field Summary
static int ANCESTOR
           
static int ANCESTOR_OR_SELF
           
static int ATTRIBUTE
           
protected  int axisNumber
           
static int CHILD
           
static int DESCENDANT
           
static int DESCENDANT_OR_SELF
           
static int FOLLOWING
           
static int FOLLOWING_SIBLING
           
static int NAMESPACE
           
protected  NameTest nodeName
           
protected  int nodeType
           
static int PARENT
           
static int PRECEDING
           
static int PRECEDING_SIBLING
           
static int SELF
           
 
Constructor Summary
Axis()
           
 
Method Summary
 int getAxisNumber()
          Get the axis number (e.g.
abstract  NodeEnumeration getEnumeration(NodeInfo node)
          Return an enumeration over the nodes reached by the given axis from a specified node
 int getPrincipalNodeType()
          Get the principal node type for the axis.
abstract  boolean isPeer()
          An axis has the peer property if no node in the result is an ancestor of another (redundant: if this is true the sibling property will also be true)
 boolean isReverseSorted()
          If an axis is not in document order, then it is in reverse document order
abstract  boolean isSibling()
          An Axis has the sibling property if all the nodes it returns have the same parent
abstract  boolean isSorted()
          An Axis has the sorted property if it returns nodes in document order
abstract  boolean isWithinSubtree()
          An axis has the withinSubtree property if all the nodes it returns are in the subtree rooted at the start node, that is if it is a subset of the descendants-of-self axis
static int lookup(java.lang.String name)
          resolve an axis name into a symbolic constant representing the axis
static Axis make(int axisNumber, int nodeType, NameTest nameTest)
          Factory method to make an axis of the specified type.
static Axis makeAxis(int axisNumber)
           
 void setNameTest(NameTest test)
          Set the name test required by the axis.
 void setNodeType(int type)
          Set the node type required by the axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANCESTOR

public static final int ANCESTOR

ANCESTOR_OR_SELF

public static final int ANCESTOR_OR_SELF

ATTRIBUTE

public static final int ATTRIBUTE

CHILD

public static final int CHILD

DESCENDANT

public static final int DESCENDANT

DESCENDANT_OR_SELF

public static final int DESCENDANT_OR_SELF

FOLLOWING

public static final int FOLLOWING

FOLLOWING_SIBLING

public static final int FOLLOWING_SIBLING

NAMESPACE

public static final int NAMESPACE

PARENT

public static final int PARENT

PRECEDING

public static final int PRECEDING

PRECEDING_SIBLING

public static final int PRECEDING_SIBLING

SELF

public static final int SELF

axisNumber

protected int axisNumber

nodeType

protected int nodeType

nodeName

protected NameTest nodeName
Constructor Detail

Axis

public Axis()
Method Detail

lookup

public static int lookup(java.lang.String name)
                  throws org.xml.sax.SAXException
resolve an axis name into a symbolic constant representing the axis

make

public static Axis make(int axisNumber,
                        int nodeType,
                        NameTest nameTest)
                 throws org.xml.sax.SAXException
Factory method to make an axis of the specified type. The use of axisNumber is historic, it would be better for the caller to say directly which Axis subclass it wants to create.

makeAxis

public static Axis makeAxis(int axisNumber)
                     throws org.xml.sax.SAXException

getAxisNumber

public int getAxisNumber()
Get the axis number (e.g. PARENT or PRECEDING_SIBLING)

setNodeType

public void setNodeType(int type)
Set the node type required by the axis.
Parameters:
nodeType - e.g. NodeInfo.ELEMENT for an element, NodeInfo.NODE for any node type

getPrincipalNodeType

public int getPrincipalNodeType()
Get the principal node type for the axis. This is the default node type, and is Node.ELEMENT for all axes except the Attribute and Namespace axes

setNameTest

public void setNameTest(NameTest test)
Set the name test required by the axis.
Parameters:
nodeType - e.g. NodeInfo.ELEMENT for an element, NodeInfo.NODE for any node type

getEnumeration

public abstract NodeEnumeration getEnumeration(NodeInfo node)
                                        throws org.xml.sax.SAXException
Return an enumeration over the nodes reached by the given axis from a specified node
Parameters:
node - NodeInfo representing the node from which the enumeration starts
nodeType - the type(s) of node to be included, e.g. NodeInfo.ELEMENT, NodeInfo.TEXT. The value NodeInfo.NODE means include any type of node.
nodeNameTest - include only nodes with this name (e.g. an element name). Set this to null to include nodes of any name.
Returns:
a NodeEnumeration that scans the nodes reached by the axis in turn.
Throws:
org.xml.sax.SAXException - if an invalid axis is specified

isSorted

public abstract boolean isSorted()
An Axis has the sorted property if it returns nodes in document order

isReverseSorted

public boolean isReverseSorted()
If an axis is not in document order, then it is in reverse document order

isSibling

public abstract boolean isSibling()
An Axis has the sibling property if all the nodes it returns have the same parent

isPeer

public abstract boolean isPeer()
An axis has the peer property if no node in the result is an ancestor of another (redundant: if this is true the sibling property will also be true)

isWithinSubtree

public abstract boolean isWithinSubtree()
An axis has the withinSubtree property if all the nodes it returns are in the subtree rooted at the start node, that is if it is a subset of the descendants-of-self axis