net.sf.saxon.functions
Class Document

java.lang.Object
  extended by net.sf.saxon.expr.ComputedExpression
      extended by net.sf.saxon.expr.FunctionCall
          extended by net.sf.saxon.functions.SystemFunction
              extended by net.sf.saxon.functions.Document
All Implemented Interfaces:
Serializable, Expression, MappingFunction, XSLTFunction

public class Document
extends SystemFunction
implements MappingFunction, XSLTFunction

Implements the XSLT document() function

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.functions.SystemFunction
operation
 
Fields inherited from class net.sf.saxon.expr.FunctionCall
argument
 
Fields inherited from class net.sf.saxon.expr.ComputedExpression
lineNumber, NO_ARGUMENTS, staticProperties
 
Constructor Summary
Document()
           
 
Method Summary
 void checkArguments(StaticContext env)
          Method called during static type checking
 int computeCardinality()
          Determine the static cardinality
 int computeSpecialProperties()
          Get the static properties of this expression (other than its type).
 SequenceIterator iterate(XPathContext context)
          iterate() handles evaluation of the function: it returns a sequence of Document nodes
static NodeInfo makeDoc(String href, String baseURL, XPathContext c)
          Supporting routine to load one external document given a URI (href) and a baseURI
 Object map(Item item, XPathContext context, Object dinfo)
          Implement the MappingFunction interface: called from the MappingIterator
 Expression preEvaluate(StaticContext env)
          preEvaluate: this method suppresses compile-time evaluation by doing nothing
 
Methods inherited from class net.sf.saxon.functions.SystemFunction
addContextDocumentArgument, display, getDetails, getItemType, getName, getRequiredType, main, makeSystemFunction, useContextItemAsDefault
 
Methods inherited from class net.sf.saxon.expr.FunctionCall
analyze, checkArgumentCount, getNumberOfArguments, getSubExpressions, promote, setArguments, simplify, simplifyArguments
 
Methods inherited from class net.sf.saxon.expr.ComputedExpression
computeDependencies, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getDependencies, getIntrinsicDependencies, getLineNumber, getSpecialProperties, markTailFunctionCalls, setLineNumber, typeError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Document

public Document()
Method Detail

checkArguments

public void checkArguments(StaticContext env)
                    throws XPathException
Description copied from class: SystemFunction
Method called during static type checking

Overrides:
checkArguments in class SystemFunction
Throws:
XPathException

computeCardinality

public int computeCardinality()
Determine the static cardinality

Overrides:
computeCardinality in class SystemFunction

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.

Overrides:
computeSpecialProperties in class ComputedExpression

preEvaluate

public Expression preEvaluate(StaticContext env)
preEvaluate: this method suppresses compile-time evaluation by doing nothing

Overrides:
preEvaluate in class FunctionCall

iterate

public SequenceIterator iterate(XPathContext context)
                         throws XPathException
iterate() handles evaluation of the function: it returns a sequence of Document nodes

Specified by:
iterate in interface Expression
Overrides:
iterate in class ComputedExpression
Parameters:
context - supplies the context for evaluation
Returns:
a SequenceIterator that can be used to iterate over the result of the expression
Throws:
XPathException - if any dynamic error occurs evaluating the expression

map

public Object map(Item item,
                  XPathContext context,
                  Object dinfo)
           throws XPathException
Implement the MappingFunction interface: called from the MappingIterator

Specified by:
map in interface MappingFunction
Parameters:
item - The item to be mapped. If context is supplied, this must be the same as context.currentItem().
context - The processing context. This is supplied only for mapping constructs that set the context node, position, and size. Otherwise it is null.
dinfo - Arbitrary information supplied by the creator of the MappingIterator. It must be read-only and immutable for the duration of the iteration.
Returns:
either (a) a SequenceIterator over the sequence of items that the supplied input item maps to, or (b) an Item if it maps to a single item, or (c) null if it maps to an empty sequence.
Throws:
XPathException

makeDoc

public static NodeInfo makeDoc(String href,
                               String baseURL,
                               XPathContext c)
                        throws XPathException
Supporting routine to load one external document given a URI (href) and a baseURI

Throws:
XPathException