Package net.sf.saxon.om
Class AxisInfo
java.lang.Object
net.sf.saxon.om.AxisInfo
An axis, that is a direction of navigation in the document structure.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Constant representing the ancestor axisstatic final int
Constant representing the ancestor-or-self axisstatic final int
Constant representing the attribute axisstatic final String[]
Table giving the name of each axis as used in XPath, for example "ancestor-or-self"static final int
Constant representing the child axisstatic final int
Constant representing the descendant axisstatic final int
Constant representing the descendant-or-self axisstatic int[]
Give the corresponding axis if the self node is excluded.static final int
Constant representing the following axisstatic final int
Constant representing the following-sibling axisstatic int[]
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 final boolean[]
Table indicating for each axis whether it is in forwards document orderstatic final boolean[]
Table indicating for each axis whether it is a peer axis.static final boolean[]
Table indicating for each axis whether it is contained within the subtree rooted at the origin node.static final int
Constant representing the namespace axisstatic final int
Constant representing the parent axisstatic final int
Constant representing the preceding axisstatic final int
Constant representing the preceding-or-ancestor axis.static final int
Constant representing the preceding-sibling axisstatic final short[]
Table indicating the principal node type of each axisstatic final UType[]
static final int
Constant representing the self axis -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsNodeKind
(int axis, int nodeKind) Determine whether a given kind of node can be found on a given axis.static int
getAxisNumber
(String name) Resolve an axis name into a symbolic constant representing the axisstatic UType
getTargetUType
(UType origin, int axis) Given a context item type and an axis, determine the kinds of nodes that can be returnedstatic boolean
isAlwaysEmpty
(int axis, int nodeKind) Ask whether a given axis can contain any nodes when starting at the specified node kind.
-
Field Details
-
ANCESTOR
public static final int ANCESTORConstant representing the ancestor axis- See Also:
-
ANCESTOR_OR_SELF
public static final int ANCESTOR_OR_SELFConstant representing the ancestor-or-self axis- See Also:
-
ATTRIBUTE
public static final int ATTRIBUTEConstant representing the attribute axis- See Also:
-
CHILD
public static final int CHILDConstant representing the child axis- See Also:
-
DESCENDANT
public static final int DESCENDANTConstant representing the descendant axis- See Also:
-
DESCENDANT_OR_SELF
public static final int DESCENDANT_OR_SELFConstant representing the descendant-or-self axis- See Also:
-
FOLLOWING
public static final int FOLLOWINGConstant representing the following axis- See Also:
-
FOLLOWING_SIBLING
public static final int FOLLOWING_SIBLINGConstant representing the following-sibling axis- See Also:
-
NAMESPACE
public static final int NAMESPACEConstant representing the namespace axis- See Also:
-
PARENT
public static final int PARENTConstant representing the parent axis- See Also:
-
PRECEDING
public static final int PRECEDINGConstant representing the preceding axis- See Also:
-
PRECEDING_SIBLING
public static final int PRECEDING_SIBLINGConstant representing the preceding-sibling axis- See Also:
-
SELF
public static final int SELFConstant representing the self axis- See Also:
-
PRECEDING_OR_ANCESTOR
public static final int PRECEDING_OR_ANCESTORConstant 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:
-
principalNodeType
public static final short[] principalNodeTypeTable indicating the principal node type of each axis -
principalNodeUType
-
isForwards
public static final boolean[] isForwardsTable indicating for each axis whether it is in forwards document order -
isPeerAxis
public static final boolean[] isPeerAxisTable 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[] isSubtreeAxisTable indicating for each axis whether it is contained within the subtree rooted at the origin node. -
axisName
Table giving the name of each axis as used in XPath, for example "ancestor-or-self" -
inverseAxis
public static int[] inverseAxisFor 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[] excludeSelfAxisGive the corresponding axis if the self node is excluded. (Doesn't really work for the self axis itself).
-
-
Method Details
-
getAxisNumber
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 exampleATTRIBUTE
nodeKind
- the node kind of the origin node, for exampleType.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 exampleATTRIBUTE
nodeKind
- the node kind of the origin node, for exampleType.ELEMENT
- Returns:
- true if the given kind of node can appear on the specified axis
-
getTargetUType
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 kindsaxis
- identifies the axis- Returns:
- the set of possible node kinds in the result of the axis expression, as a UType
-