public abstract class ItemFeed extends java.lang.Object implements Feed
Every kind of expression can be evaluated using an ItemFeed. The ItemFeed is obtained by calling getFeedMaker() on the ExpressionCompiler corresponding to the class of expression. The expression must have been previously marked to indicate which of its inputs is being supplied in streaming mode.
Constructor and Description |
---|
ItemFeed(Expression exp,
Feed result,
XPathContext context) |
ItemFeed(Feed result,
XPathContext context) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Finish evaluating the expression.
|
void |
dynamicError(XPathException error)
Report a dynamic error.
|
void |
endSelectedParentNode(Location locationId)
Signal that the endElement event has occurred for the element whose startElement
event caused the Watch to be activated.
|
XPathContext |
getContext()
Get the dynamic evaluation context
|
Expression |
getExpression()
Get the expression being evaluated by this ItemFeed.
|
PipelineConfiguration |
getPipelineConfiguration()
Get the pipeline configuration
|
Receiver |
getReceiver()
Get a receiver to which start and end events for documents and elements can be
written.
|
Feed |
getResult()
Get the result, that is, the ItemFeed to which the items in the result
of the expression should be supplied
|
Terminator |
getTerminator()
Get the Terminator which can be used to request early termination of the Feed
|
boolean |
hasFailed() |
void |
open(Terminator terminator)
Start evaluating the expression.
|
abstract void |
processItem(Item<?> item)
Supply one item towards the streamed input of the expression
|
static void |
processItems(SequenceIterator<?> iter,
Feed result)
Convenience method to process all the items selected by an iterator and push them to the next
feed in the push pipeline
|
void |
setExpression(Expression exp)
Set the expression being evaluated by this ItemFeed
|
void |
setHasFailed()
Mark this feed as having failed (that is, as having detected and reported
a dynamic error).
|
void |
setPipelineConfiguration(PipelineConfiguration pipe)
Set the pipeline configuration
|
void |
setTerminator(Terminator terminator)
Provide a callback that can be used to request early termination of the
streaming of this input document
|
Receiver |
startSelectedParentNode(FleetingParentNode node,
Location locationId)
Signal that an element or document node has been found that matches the selection that this
Watch is looking for.
|
public ItemFeed(Feed result, XPathContext context)
public ItemFeed(Expression exp, Feed result, XPathContext context)
public static void processItems(SequenceIterator<?> iter, Feed result) throws XPathException
iter
- iterator over the selected itemsresult
- the next feed in the pipelineXPathException
- if any dynamic error occurspublic void setExpression(Expression exp)
exp
- the relevant expressionpublic Expression getExpression()
public void setTerminator(Terminator terminator)
terminator
- the class that can be called to request terminationpublic void setHasFailed()
public Terminator getTerminator()
public Feed getResult()
public void setPipelineConfiguration(PipelineConfiguration pipe)
pipe
- the pipeline configurationpublic PipelineConfiguration getPipelineConfiguration()
getPipelineConfiguration
in interface Feed
public XPathContext getContext()
public void open(Terminator terminator) throws XPathException
open
in interface Feed
terminator
- used to achieve early exitXPathException
- if a dynamic error occurspublic Receiver startSelectedParentNode(FleetingParentNode node, Location locationId) throws XPathException
startSelectedParentNode
in interface Feed
node
- the element or document node whose start event has been matchedlocationId
- the location associated with the element or document node (may be
the location of the instruction that created it)XPathException
- May be raised if a dynamic error occurspublic abstract void processItem(Item<?> item) throws XPathException
processItem
in interface Feed
item
- the item to be suppliedXPathException
- May be raised if a dynamic error occurspublic void endSelectedParentNode(Location locationId) throws XPathException
endSelectedParentNode
in interface Feed
locationId
- the location of the elementXPathException
- May be raised if a constraint implemented by this
Watch is violatedpublic void close() throws XPathException
close
in interface Feed
XPathException
- if a dynamic error occurspublic Receiver getReceiver()
getReceiver
in interface Feed
public void dynamicError(XPathException error) throws XPathException
error
- the exception representing the dynamic errorXPathException
- if there is no try/catch expression wanting to catch this errorpublic boolean hasFailed()
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.