Package net.sf.saxon.event
Class SequenceOutputter
- java.lang.Object
-
- net.sf.saxon.event.SequenceReceiver
-
- net.sf.saxon.event.SequenceWriter
-
- net.sf.saxon.event.SequenceOutputter
-
- All Implemented Interfaces:
javax.xml.transform.Result
,Receiver
public final class SequenceOutputter extends SequenceWriter
This outputter is used when writing a sequence of atomic values and nodes, that is, when xsl:variable is used with content and an "as" attribute. The outputter builds the sequence and provides access to it. (It isn't really an outputter at all, it doesn't pass the events to anyone, it merely constructs the sequence in memory and provides access to it). Note that the event sequence can include calls such as startElement and endElement that require trees to be built. If nodes such as attributes and text nodes are received while an element is being constructed, the nodes are added to the tree. Otherwise, "orphan" nodes (nodes with no parent) are created and added directly to the sequence.This class is not used to build temporary trees. For that, the ComplexContentOutputter is used.
- Author:
- Michael H. Kay
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.event.SequenceReceiver
pipelineConfiguration, previousAtomic, systemId
-
-
Constructor Summary
Constructors Constructor Description SequenceOutputter(PipelineConfiguration pipe)
Create a new SequenceOutputterSequenceOutputter(PipelineConfiguration pipe, Controller controller)
SequenceOutputter(PipelineConfiguration pipe, Controller controller, int estimatedSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SequenceOutputter
allocateSequenceOutputter(XPathContext context, int hostLang)
Allocate a SequenceOutputter.Item
getFirstItem()
Get the first item in the sequence that has been builtjava.util.List<Item>
getList()
Get the list containing the sequence of itemsValueRepresentation<Item>
getSequence()
Get the sequence that has been builtSequenceIterator<? extends Item>
iterate()
Get an iterator over the sequence of items that has been constructedItem
popLastItem()
Get the last item in the sequence that has been built, and remove itvoid
reset()
Clear the contents of the SequenceOutputter and make it available for reusevoid
write(Item item)
Method to be supplied by subclasses: output one item in the sequence.-
Methods inherited from class net.sf.saxon.event.SequenceWriter
adviseReuse, append, attribute, characters, close, comment, endDocument, endElement, namespace, processingInstruction, startContent, startDocument, startElement, usesTypeAnnotations
-
Methods inherited from class net.sf.saxon.event.SequenceReceiver
append, getConfiguration, getNamePool, getPipelineConfiguration, getSystemId, open, setPipelineConfiguration, setSystemId, setUnparsedEntity
-
-
-
-
Constructor Detail
-
SequenceOutputter
public SequenceOutputter(PipelineConfiguration pipe)
Create a new SequenceOutputter- Parameters:
pipe
- the pipeline configuration
-
SequenceOutputter
public SequenceOutputter(PipelineConfiguration pipe, Controller controller, int estimatedSize)
-
SequenceOutputter
public SequenceOutputter(PipelineConfiguration pipe, Controller controller)
-
-
Method Detail
-
allocateSequenceOutputter
public static SequenceOutputter allocateSequenceOutputter(XPathContext context, int hostLang)
Allocate a SequenceOutputter. Used from generated bytecode.- Parameters:
context
- dynamic XPath contexthostLang
- host language (XSLT/XQuery)- Returns:
- the allocated SequenceOutputter
- See Also:
com.saxonica.bytecode.util.CompilerService
-
reset
public void reset()
Clear the contents of the SequenceOutputter and make it available for reuse
-
write
public void write(Item item)
Method to be supplied by subclasses: output one item in the sequence.- Specified by:
write
in classSequenceWriter
- Parameters:
item
- the item to be written to the sequence
-
getSequence
public ValueRepresentation<Item> getSequence()
Get the sequence that has been built- Returns:
- the value (sequence of items) that have been written to this SequenceOutputter
-
iterate
public SequenceIterator<? extends Item> iterate()
Get an iterator over the sequence of items that has been constructed- Returns:
- an iterator over the items that have been written to this SequenceOutputter
-
getList
public java.util.List<Item> getList()
Get the list containing the sequence of items- Returns:
- the list of items that have been written to this SequenceOutputter
-
getFirstItem
public Item getFirstItem()
Get the first item in the sequence that has been built- Returns:
- the first item in the list of items that have been written to this SequenceOutputter; or null if the list is empty.
-
popLastItem
public Item popLastItem()
Get the last item in the sequence that has been built, and remove it- Returns:
- the last item written
-
-