net.sf.saxon.functions

Class Doc

public class Doc extends SystemFunction

Implement the fn:doc() function - a simplified form of the Document function
Method Summary
PathMap.PathMapNodeSetaddToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap.
voidcheckArguments(ExpressionVisitor visitor)
intcomputeCardinality()
intcomputeSpecialProperties()
Get the static properties of this expression (other than its type).
Expressioncopy()
Copy an expression.
ItemevaluateItem(XPathContext context)
Evaluate the expression
StringgetStaticBaseURI()
Get the static base URI of the expression
booleanisReadOnce()
Ask whether this document has been marked as being read once only.
ExpressionpreEvaluate(ExpressionVisitor visitor)
preEvaluate: this method suppresses compile-time evaluation unless a configuration option has been set to allow early evaluation.
voidsendDocument(XPathContext context, Receiver out)
Copy the document identified by this expression to a given Receiver.
voidsetReadOnce(boolean once)
Indicate that the document will be read once only (or that it should be treated as if it is read once only.

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

checkArguments

public void checkArguments(ExpressionVisitor visitor)

computeCardinality

public int computeCardinality()

computeSpecialProperties

public int computeSpecialProperties()
Get the static properties of this expression (other than its type). The result is bit-signficant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.

copy

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

Returns: the copy of the original expression

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate the expression

Parameters: context the dynamic evaluation context

Returns: the result of evaluating the expression (a document node)

Throws: XPathException

getStaticBaseURI

public String getStaticBaseURI()
Get the static base URI of the expression

Returns: the static base URI

isReadOnce

public boolean isReadOnce()
Ask whether this document has been marked as being read once only.

Returns: true if the document has been marked as being read once only

preEvaluate

public Expression preEvaluate(ExpressionVisitor visitor)
preEvaluate: this method suppresses compile-time evaluation unless a configuration option has been set to allow early evaluation.

Parameters: visitor an expression visitor

sendDocument

public void sendDocument(XPathContext context, Receiver out)
Copy the document identified by this expression to a given Receiver. This method is used only when it is known that the document is being copied, because there is then no problem about node identity.

Parameters: context the XPath dynamic context out the destination to which the document will be sent

setReadOnce

public void setReadOnce(boolean once)
Indicate that the document will be read once only (or that it should be treated as if it is read once only. This means (a) the document will not be held in memory after all references to it go out of scope, and (b) if the query or transformation tries to read it again, it will get a new copy, with different node identities, and potentially with different content. It also means that the document is eligible for document projection.

Parameters: once true if this document is to be treated as being read once only