public class ForEachAction extends ItemFeed
The feed is capable of handling a select expression that selects non-peer nodes (that is, one selected node that is a descendant of another). A top-level selected node is processed directly to the output receiver; a nested node is processed to create a temporary result tree, which is then appended to the output sequence when the processing of the outer selected node is complete.
Modifier and Type | Class and Description |
---|---|
protected static class |
ForEachAction.Activation
An activation represents an occurrence of a node that matches the selection, whose start tag
has been encountered and whose end tag has not yet been encountered.
|
Modifier and Type | Field and Description |
---|---|
protected XPathContext |
bodyContext |
Constructor and Description |
---|
ForEachAction(WatchManager watchManager,
Expression expression,
Feed result,
XPathContext context) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Finish evaluating the expression.
|
void |
endSelectedParentNode(Location locationId)
Signal that the endElement event has occurred for the element whose startElement
event caused the Watch to be activated.
|
protected Expression |
getAction() |
protected java.util.Stack<ForEachAction.Activation> |
getActivationStack() |
protected XPathContext |
getBodyContext() |
protected Inversion |
getInversion() |
SequenceReceiver |
getReceiver()
Get a receiver to which start and end events for documents and elements can be
written.
|
protected java.util.List<Sequence<?>> |
getValuesAwaitingOutput() |
protected WatchManager |
getWatchManager() |
protected boolean |
isActionConsuming() |
protected void |
makeBodyContext() |
void |
open(Terminator terminator)
Start evaluating the expression.
|
void |
processItem(Item<?> it)
Method called by the feed for a subexpression to supply a grounded item from the streamed input.
|
void |
setInversion(Inversion inversion)
Set the inversion of the for-each action (the body of the loop)
|
Receiver |
startSelectedParentNode(FleetingParentNode node,
Location locationId)
Signal that an element has been found that matches the selection that this
Watch is looking for.
|
dynamicError, getContext, getExpression, getPipelineConfiguration, getResult, getTerminator, hasFailed, processItems, setExpression, setHasFailed, setPipelineConfiguration, setTerminator
protected XPathContext bodyContext
public ForEachAction(WatchManager watchManager, Expression expression, Feed result, XPathContext context)
public void setInversion(Inversion inversion)
inversion
- the inverted code implementing the body of the for-eachprotected Inversion getInversion()
protected WatchManager getWatchManager()
protected Expression getAction()
protected boolean isActionConsuming()
protected XPathContext getBodyContext()
protected java.util.Stack<ForEachAction.Activation> getActivationStack()
protected java.util.List<Sequence<?>> getValuesAwaitingOutput()
public SequenceReceiver getReceiver()
ItemFeed
getReceiver
in interface Feed
getReceiver
in class ItemFeed
public void open(Terminator terminator) throws XPathException
ItemFeed
open
in interface Feed
open
in class ItemFeed
terminator
- used to achieve early exitXPathException
- if a dynamic error occursprotected void makeBodyContext()
public Receiver startSelectedParentNode(FleetingParentNode node, Location locationId) throws XPathException
startSelectedParentNode
in interface Feed
startSelectedParentNode
in class ItemFeed
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)ValidationException
- May be raised if the constraint implemented by this
Watch is violated @param locationId the location of the node in the source, or of the instruction that created itXPathException
- May be raised if a dynamic error occurspublic void processItem(Item<?> it) throws XPathException
processItem
in interface Feed
processItem
in class ItemFeed
it
- the grounded item.XPathException
- May be raised if a dynamic error occurspublic void endSelectedParentNode(Location locationId) throws XPathException
endSelectedParentNode
in interface Feed
endSelectedParentNode
in class ItemFeed
locationId
- the location of the node in the source, or of the instruction that created itValidationException
- May be raised if the constraint implemented by this
Watch is violated @param locationId the location of the node in the source, or of the instruction that created itXPathException
- May be raised if a constraint implemented by this
Watch is violatedpublic void close() throws XPathException
ItemFeed
close
in interface Feed
close
in class ItemFeed
XPathException
- if a dynamic error occursCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.