public final class Navigator
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
Navigator.AncestorEnumeration |
General-purpose implementation of the ancestor and ancestor-or-self axes
|
static class |
Navigator.AxisFilter |
AxisFilter is an iterator that applies a NodeTest filter to
the nodes returned by an underlying AxisIterator.
|
static class |
Navigator.BaseEnumeration |
BaseEnumeration is an abstract implementation of an AxisIterator, it
simplifies the implementation of the underlying AxisIterator by requiring
it to provide only two methods: advance(), and getAnother().
|
static class |
Navigator.DescendantEnumeration |
General-purpose implementation of the descendant and descendant-or-self axes,
in terms of the child axis.
|
static class |
Navigator.FollowingEnumeration |
General purpose implementation of the following axis, in terms of the
ancestor, child, and following-sibling axes
|
static class |
Navigator.PrecedingEnumeration |
Helper method to iterate over the preceding axis, or Saxon's internal
preceding-or-ancestor axis, by making use of the ancestor, descendant, and
preceding-sibling axes.
|
Modifier and Type | Method | Description |
---|---|---|
static java.lang.String |
alphaKey(int value) |
Construct an alphabetic key from an positive integer; the key collates in the same sequence
as the integer
|
static void |
appendSequentialKey(SiblingCountingNode node,
FastStringBuffer sb,
boolean addDocNr) |
Get a character string that uniquely identifies this node and that collates nodes
into document order
|
static int |
compareOrder(SiblingCountingNode first,
SiblingCountingNode second) |
Generic (model-independent) method to determine the relative position of two
node in document order.
|
static void |
copy(NodeInfo node,
Receiver out,
NamePool namePool,
int whichNamespaces,
boolean copyAnnotations,
int locationId) |
Generic (model-independent) implementation of deep copy algorithm for nodes.
|
static AxisIterator |
filteredSingleton(NodeInfo node,
NodeTest nodeTest) |
Create an iterator over a singleton node, if it exists and matches a nodetest;
otherwise return an empty iterator
|
static java.lang.String |
getAttributeValue(NodeInfo element,
java.lang.String uri,
java.lang.String localName) |
Get the string value of an attribute of a given element, given the URI and
local part of the attribute name.
|
static java.lang.String |
getBaseURI(NodeInfo node) |
Helper method to get the base URI of an element or processing instruction node
|
static int |
getNumberAny(Expression inst,
NodeInfo node,
Pattern count,
Pattern from,
XPathContext context,
boolean hasVariablesInPatterns) |
Get node number (level="any").
|
static java.util.List |
getNumberMulti(NodeInfo node,
Pattern count,
Pattern from,
XPathContext context) |
Get node number (level="multiple").
|
static int |
getNumberSimple(NodeInfo node,
XPathContext context) |
Get simple node number.
|
static int |
getNumberSingle(NodeInfo node,
Pattern count,
Pattern from,
XPathContext 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 |
isAncestorOrSelf(NodeInfo a,
NodeInfo d) |
Test if one node is an ancestor-or-self of another
|
static boolean |
isWhite(java.lang.CharSequence content) |
Deprecated.
since Saxon 8.5: use
Whitespace.isWhite(java.lang.CharSequence) |
static NodeTest |
makeNodeTest(NamePool pool,
int nodeKind,
java.lang.String uri,
java.lang.String localName) |
Helper method to construct a NodeTest for use with the
NodeInfo.iterateAxis(byte) method |
public static java.lang.String getAttributeValue(NodeInfo element, java.lang.String uri, java.lang.String localName)
element
- the element on which the required attribute appearsuri
- The namespace URI of the attribute name. The null URI is represented as an empty string.localName
- The local part of the attribute name.public static NodeTest makeNodeTest(NamePool pool, int nodeKind, java.lang.String uri, java.lang.String localName)
NodeInfo.iterateAxis(byte)
methodpool
- the NamePool. The relevant NamePool can be obtained by calling the method
NodeInfo.getNamePool()
.nodeKind
- The kind of node required, for example Type.ELEMENT
or Type.ATTRIBUTE
.
To select nodes of any kind, use Type.NODE
.uri
- The namespace URI of the nodes to be selected. Supply null to selects nodes from any
namespace or none. Supply "" to select nodes that are not in a namespace.localName
- The local name of the nodes to be selected. Supply null to select nodes irrespective
of their local name.public static java.lang.String getBaseURI(NodeInfo node)
node
- the node whose base URI is requiredpublic static java.lang.String getPath(NodeInfo node)
node
- the node whose path is required. If null is supplied,
an empty string is returned - this fact is used in making a recursive call
for a parentless node.public static int getNumberSimple(NodeInfo node, XPathContext context) throws XPathException
node
- The node whose number is requiredcontext
- Used for remembering previous result, for
performanceXPathException
- if any error occurspublic static int getNumberSingle(NodeInfo node, Pattern count, Pattern from, XPathContext context) throws XPathException
node
- the current node, the one whose node number is requiredcount
- 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.)context
- the dynamic context of the transformation, used if
the patterns reference context values (e.g. variables)XPathException
- when any error occurs in processingpublic static int getNumberAny(Expression inst, NodeInfo node, Pattern count, Pattern from, XPathContext context, boolean hasVariablesInPatterns) throws XPathException
inst
- Identifies the xsl:number expression; this is relevant
when the function is memoised to support repeated use of the same
instruction to number multiple nodesnode
- The node being numberedcount
- 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.context
- The dynamic context for the transformationhasVariablesInPatterns
- if the count or from patterns
contain variables, then it's not safe to get the answer by adding
one to the number of the most recent node that matchesXPathException
public static java.util.List getNumberMulti(NodeInfo node, Pattern count, Pattern from, XPathContext context) throws XPathException
node
- The node to be numberedcount
- 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.context
- The dynamic context for the transformationXPathException
public static void copy(NodeInfo node, Receiver out, NamePool namePool, int whichNamespaces, boolean copyAnnotations, int locationId) throws XPathException
node
- The node to be copiedout
- The receiver to which events will be sentnamePool
- Namepool holding the name codes (used only to resolve namespace
codes)whichNamespaces
- Indicates which namespace nodes for an element should
be copied. Values are NodeInfo.NO_NAMESPACES
,
NodeInfo.LOCAL_NAMESPACES
, NodeInfo.ALL_NAMESPACES
copyAnnotations
- Indicates whether type annotations should be copiedlocationId
- The location of the instruction invoking the copyXPathException
- on any failure reported by the Receiverpublic static int compareOrder(SiblingCountingNode first, SiblingCountingNode second)
first
- The first nodesecond
- The second node, whose position is to be compared with the first nodepublic static void appendSequentialKey(SiblingCountingNode node, FastStringBuffer sb, boolean addDocNr)
node
- the node whose unique identifier is reuqiredsb
- a buffer to which the unique identifier will be appendedaddDocNr
- true if a unique document number is to be included in the informationpublic static java.lang.String alphaKey(int value)
value
- The positive integer key value (negative values are treated as zero).public static boolean isWhite(java.lang.CharSequence content)
Whitespace.isWhite(java.lang.CharSequence)
content
- the string to be testedpublic static boolean isAncestorOrSelf(NodeInfo a, NodeInfo d)
a
- the putative ancestor-or-self noded
- the putative descendant nodepublic static AxisIterator filteredSingleton(NodeInfo node, NodeTest nodeTest)
node
- the singleton node, or null if the node does not existnodeTest
- the test to be applied