Class SingletonExpression
java.lang.Object
com.icl.saxon.expr.Expression
com.icl.saxon.expr.NodeSetExpression
com.icl.saxon.expr.SingletonExpression
- Direct Known Subclasses:
AttributeReference, ContextNodeExpression, ParentNodeExpression, RootExpression
A node set expression that will always return zero or one nodes
-
Field Summary
Fields inherited from class Expression
staticContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluate the expression in a given context to return a Node enumerationbooleanevaluateAsBoolean(Context context) Evaluate as a boolean.evaluateAsNodeSet(Context context) Evaluate an expression as a NodeSet.evaluateAsString(Context context) Evaluate as a string.abstract NodeInfoGet the single node to which this expression refersbooleanDetermine, in the case of an expression whose data type is Value.NODESET, whether all the nodes in the node-set are guaranteed to come from the same document as the context node.selectFirst(Context context) Return the first node selected by this Expression when evaluated in the current contextMethods inherited from class NodeSetExpression
evaluate, getDataType, outputStringValueMethods inherited from class Expression
containsReferences, display, evaluateAsNumber, getDependencies, getStaticContext, indent, make, reduce, setStaticContext, simplify, usesCurrent
-
Constructor Details
-
SingletonExpression
public SingletonExpression()
-
-
Method Details
-
isContextDocumentNodeSet
public boolean isContextDocumentNodeSet()Determine, in the case of an expression whose data type is Value.NODESET, whether all the nodes in the node-set are guaranteed to come from the same document as the context node. Used for optimization.- Overrides:
isContextDocumentNodeSetin classExpression
-
getNode
Get the single node to which this expression refers- Throws:
XPathException
-
selectFirst
Return the first node selected by this Expression when evaluated in the current context- Overrides:
selectFirstin classNodeSetExpression- Parameters:
context- The context for the evaluation- Returns:
- the NodeInfo of the first node in document order, or null if the node-set is empty.
- Throws:
XPathException
-
enumerate
Evaluate the expression in a given context to return a Node enumeration- Specified by:
enumeratein classNodeSetExpression- Parameters:
context- the evaluation contextsort- Indicates result must be in document order- Throws:
XPathException- when the expression does not return a nodeset.
-
evaluateAsNodeSet
Evaluate an expression as a NodeSet.- Overrides:
evaluateAsNodeSetin classNodeSetExpression- Parameters:
context- The context in which the expression is to be evaluated- Returns:
- the value of the expression, evaluated in the current context
- Throws:
XPathException- when the expression does not return a nodeset.
-
evaluateAsString
Evaluate as a string. Returns the string value of the node if it exists- Overrides:
evaluateAsStringin classNodeSetExpression- Parameters:
context- The context in which the expression is to be evaluated- Returns:
- true if there are any nodes selected by the NodeSetExpression
- Throws:
XPathException
-
evaluateAsBoolean
Evaluate as a boolean. Returns true if there are any nodes selected by the NodeSetExpression- Overrides:
evaluateAsBooleanin classNodeSetExpression- Parameters:
context- The context in which the expression is to be evaluated- Returns:
- true if there are any nodes selected by the NodeSetExpression
- Throws:
XPathException
-