com.saxonica.extra
Class StreamingCopy

java.lang.Object
  extended by net.sf.saxon.expr.Expression
      extended by com.saxonica.extra.StreamingCopy
All Implemented Interfaces:
Serializable, SourceLocator, Container, EvaluableItem, SequenceIterable, InstructionInfoProvider

public class StreamingCopy
extends Expression

This class performs a streaming copy of selected nodes within a document. The document is read in another thread using a SAX (push) parser, with a filter that selects the required nodes on the fly. When such a node is encountered, a TinyBuilder is created and events for the subtree rooted at that node are pushed to the TinyBuilder to build this subtree. The root nodes of these subtrees are placed in a cyclic buffer (the Conduit where they can be read in pull mode and delivered as the result of a SequenceIterator. The tree for the document as a whole is never built.

This class enables expressions such as <xsl:copy-of select="doc('a.xml')//customer"/> to be processed serially without ever instantiating a.xml in memory. This is only possible when there is an explicit request to make a copy, because it is then known that there is no dependency on the node identity of nodes in a.xml.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
 
Method Summary
 int computeDependencies()
          Compute the dependencies of an expression, as the union of the dependencies of its subexpressions.
 int computeSpecialProperties()
           
 void display(int level, PrintStream out, Configuration config)
          Diagnostic print of expression structure.
 int getImplementationMethod()
          An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
 ItemType getItemType(TypeHierarchy th)
          Determine the data type of the expression, if possible.
 SequenceIterator iterate(XPathContext context)
          Return an Iterator to iterate over the values of a sequence.
 Iterator iterateSubExpressions()
          Get the immediate sub-expressions of this expression.
 Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType)
          Perform optimisation of an expression and its subexpressions.
 void process(XPathContext context)
          Process the instruction, without returning any tail calls
 boolean replaceSubExpression(Expression original, Expression replacement)
          Replace one subexpression by a replacement subexpression
 Expression typeCheck(StaticContext env, ItemType contextItemType)
          Perform type checking of an expression and its subexpressions.
 
Methods inherited from class net.sf.saxon.expr.Expression
adoptChildExpression, checkPermittedContents, computeStaticProperties, doPromotion, effectiveBooleanValue,