net.sf.saxon.expr

Class RootExpression

public class RootExpression extends SingleNodeExpression

An expression whose value is always a set of nodes containing a single node, the document root. This corresponds to the XPath Expression "/", including the implicit "/" at the start of a path expression with a leading "/".
Method Summary
PathMap.PathMapNodeSetaddToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap.
intcomputeCardinality()
Specify that the expression returns a singleton
Expressioncopy()
Copy an expression.
booleanequals(Object other)
Is this expression the same as another expression?
voidexplain(ExpressionPresenter destination)
Diagnostic print of expression structure.
intgetIntrinsicDependencies()
Determine which aspects of the context the expression depends on.
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items returned by this expression
NodeInfogetNode(XPathContext context)
Return the first element selected by this Expression
inthashCode()
get HashCode for comparing two expressions
protected StringnoContextMessage()
Customize the error message on type checking
StringtoString()
The toString() method for an expression attempts to give a representation of the expression in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath.

Method Detail

addToPathMap

public PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap. The PathMap captures a map of the nodes visited by an expression in a source tree.

Parameters: pathMap the PathMap to which the expression should be added pathMapNodeSet

Returns: the pathMapNode representing the focus established by this expression, in the case where this expression is the first operand of a path expression or filter expression

computeCardinality

public final int computeCardinality()
Specify that the expression returns a singleton

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

equals

public boolean equals(Object other)
Is this expression the same as another expression?

explain

public void explain(ExpressionPresenter destination)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

getIntrinsicDependencies

public int getIntrinsicDependencies()
Determine which aspects of the context the expression depends on. The result is a bitwise-or'ed value composed from constants such as StaticProperty.VARIABLES and StaticProperty.CURRENT_NODE

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the items returned by this expression

Parameters: th the type hierarchy cache

Returns: Type.NODE

getNode

public NodeInfo getNode(XPathContext context)
Return the first element selected by this Expression

Parameters: context The evaluation context

Returns: the NodeInfo of the first selected element, or null if no element is selected

hashCode

public int hashCode()
get HashCode for comparing two expressions

noContextMessage

protected String noContextMessage()
Customize the error message on type checking

toString

public String toString()
The toString() method for an expression attempts to give a representation of the expression in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax