Class AxisInfo


  • public final class AxisInfo
    extends java.lang.Object
    An axis, that is a direction of navigation in the document structure.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ANCESTOR
      Constant representing the ancestor axis
      static int ANCESTOR_OR_SELF
      Constant representing the ancestor-or-self axis
      static int ATTRIBUTE
      Constant representing the attribute axis
      static java.lang.String[] axisName
      Table giving the name of each axis as used in XPath, for example "ancestor-or-self"
      static int CHILD
      Constant representing the child axis
      static int DESCENDANT
      Constant representing the descendant axis
      static int DESCENDANT_OR_SELF
      Constant representing the descendant-or-self axis
      static int[] excludeSelfAxis
      Give the corresponding axis if the self node is excluded.
      static int FOLLOWING
      Constant representing the following axis
      static int FOLLOWING_SIBLING
      Constant representing the following-sibling axis
      static int[] inverseAxis
      For each axis, determine the inverse axis, in the sense that if A is on axis X starting at B, the B is on the axis inverseAxis[X] starting at A.
      static boolean[] isForwards
      Table indicating for each axis whether it is in forwards document order
      static boolean[] isPeerAxis
      Table indicating for each axis whether it is a peer axis.
      static boolean[] isSubtreeAxis
      Table indicating for each axis whether it is contained within the subtree rooted at the origin node.
      static int NAMESPACE
      Constant representing the namespace axis
      static int PARENT
      Constant representing the parent axis
      static int PRECEDING
      Constant representing the preceding axis
      static int PRECEDING_OR_ANCESTOR
      Constant representing the preceding-or-ancestor axis.
      static int PRECEDING_SIBLING
      Constant representing the preceding-sibling axis
      static short[] principalNodeType
      Table indicating the principal node type of each axis
      static UType[] principalNodeUType  
      static int SELF
      Constant representing the self axis
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean containsNodeKind​(int axis, int nodeKind)
      Determine whether a given kind of node can be found on a given axis.
      static int getAxisNumber​(java.lang.String name)
      Resolve an axis name into a symbolic constant representing the axis
      static UType getTargetUType​(UType origin, int axis)
      Given a context item type and an axis, determine the kinds of nodes that can be returned
      static boolean isAlwaysEmpty​(int axis, int nodeKind)
      Ask whether a given axis can contain any nodes when starting at the specified node kind.
      • 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
        Constant representing the ancestor axis
        See Also:
        Constant Field Values
      • ANCESTOR_OR_SELF

        public static final int ANCESTOR_OR_SELF
        Constant representing the ancestor-or-self axis
        See Also:
        Constant Field Values
      • ATTRIBUTE

        public static final int ATTRIBUTE
        Constant representing the attribute axis
        See Also:
        Constant Field Values
      • CHILD

        public static final int CHILD
        Constant representing the child axis
        See Also:
        Constant Field Values
      • DESCENDANT

        public static final int DESCENDANT
        Constant representing the descendant axis
        See Also:
        Constant Field Values
      • DESCENDANT_OR_SELF

        public static final int DESCENDANT_OR_SELF
        Constant representing the descendant-or-self axis
        See Also:
        Constant Field Values
      • FOLLOWING

        public static final int FOLLOWING
        Constant representing the following axis
        See Also:
        Constant Field Values
      • FOLLOWING_SIBLING

        public static final int FOLLOWING_SIBLING
        Constant representing the following-sibling axis
        See Also:
        Constant Field Values
      • NAMESPACE

        public static final int NAMESPACE
        Constant representing the namespace axis
        See Also:
        Constant Field Values
      • PARENT

        public static final int PARENT
        Constant representing the parent axis
        See Also:
        Constant Field Values
      • PRECEDING

        public static final int PRECEDING
        Constant representing the preceding axis
        See Also:
        Constant Field Values
      • PRECEDING_SIBLING

        public static final int PRECEDING_SIBLING
        Constant representing the preceding-sibling axis
        See Also:
        Constant Field Values
      • PRECEDING_OR_ANCESTOR

        public static final int PRECEDING_OR_ANCESTOR
        Constant representing the preceding-or-ancestor axis. This axis is used internally by the xsl:number implementation, it returns the union of the preceding axis and the ancestor axis.
        See Also:
        Constant Field Values
      • principalNodeType

        public static final short[] principalNodeType
        Table indicating the principal node type of each axis
      • principalNodeUType

        public static final UType[] principalNodeUType
      • isForwards

        public static final boolean[] isForwards
        Table indicating for each axis whether it is in forwards document order
      • isPeerAxis

        public static final boolean[] isPeerAxis
        Table indicating for each axis whether it is a peer axis. An axis is a peer axis if no node on the axis is an ancestor of another node on the axis.
      • isSubtreeAxis

        public static final boolean[] isSubtreeAxis
        Table indicating for each axis whether it is contained within the subtree rooted at the origin node.
      • axisName

        public static final java.lang.String[] axisName
        Table giving the name of each axis as used in XPath, for example "ancestor-or-self"
      • inverseAxis

        public static int[] inverseAxis
        For each axis, determine the inverse axis, in the sense that if A is on axis X starting at B, the B is on the axis inverseAxis[X] starting at A. This doesn't quite work for the PARENT axis, which has no simple inverse: this table gives the inverse as CHILD
      • excludeSelfAxis

        public static int[] excludeSelfAxis
        Give the corresponding axis if the self node is excluded. (Doesn't really work for the self axis itself).
    • Method Detail

      • getAxisNumber

        public static int getAxisNumber​(java.lang.String name)
                                 throws XPathException
        Resolve an axis name into a symbolic constant representing the axis
        Parameters:
        name - the name of the axis
        Returns:
        integer value representing the named axis
        Throws:
        XPathException - if the axis name is not one of the defined axes
      • isAlwaysEmpty

        public static boolean isAlwaysEmpty​(int axis,
                                            int nodeKind)
        Ask whether a given axis can contain any nodes when starting at the specified node kind. For example, the attribute axis when starting at an attribute node will always be empty
        Parameters:
        axis - the axis, for example ATTRIBUTE
        nodeKind - the node kind of the origin node, for example Type.ATTRIBUTE
        Returns:
        true if no nodes will ever appear on the specified axis when starting at the specified node kind.
      • containsNodeKind

        public static boolean containsNodeKind​(int axis,
                                               int nodeKind)
        Determine whether a given kind of node can be found on a given axis. For example, the attribute axis will never contain any element nodes.
        Parameters:
        axis - the axis, for example ATTRIBUTE
        nodeKind - the node kind of the origin node, for example Type.ELEMENT
        Returns:
        true if the given kind of node can appear on the specified axis
      • getTargetUType

        public static UType getTargetUType​(UType origin,
                                           int axis)
        Given a context item type and an axis, determine the kinds of nodes that can be returned
        Parameters:
        origin - the context item type, as a UType representing one or more node kinds
        axis - identifies the axis
        Returns:
        the set of possible node kinds in the result of the axis expression, as a UType