public final class ComplexContentOutputter extends SequenceReceiver
The same ComplexContentOutputter may be used for generating an entire XML document; it is not necessary to create a new outputter for each element node.
From Saxon 9.9, the ComplexContentOutputter does not combine top-level events. Unless nested within a startDocument/endDocument or startElement/endElement pair, items such as atomic values, text nodes, attribute nodes, maps and arrays are passed through unchanged to the output. It is typically the responsibility of the Destination object to decide how to combine top-level events (whether to build a single document, whether to insert item separators, etc).
pipelineConfiguration, previousAtomic, systemId
Constructor and Description |
---|
ComplexContentOutputter(Receiver next)
Create a ComplexContentOutputter
|
Modifier and Type | Method and Description |
---|---|
void |
append(Item item,
Location locationId,
int copyNamespaces)
Append an arbitrary item (node or atomic value) to the output
|
void |
attribute(NodeName attName,
SimpleType typeCode,
java.lang.CharSequence value,
Location locationId,
int properties)
Output an attribute value.
|
void |
bulkCopyElementNode(TinyElementImpl elementNode,
int copyOptions) |
void |
characters(java.lang.CharSequence s,
Location locationId,
int properties)
Produce text content output.
|
void |
close()
Close the output
|
void |
comment(java.lang.CharSequence comment,
Location locationId,
int properties)
Write a comment
|
void |
endDocument()
Notify the end of a document node
|
void |
endElement()
Output an element end tag.
|
Receiver |
getReceiver()
Get the next receiver in the processing pipeline
|
void |
graftElementNode(TinyElementImpl elementNode,
int copyOptions) |
boolean |
isReadyForBulkCopy() |
boolean |
isReadyForGrafting() |
static Receiver |
makeComplexContentReceiver(Receiver receiver,
ParseOptions options)
Static factory method to create an push pipeline containing a ComplexContentOutputter
|
void |
namespace(NamespaceBindingSet nsBindings,
int properties)
Output one or more namespace declarations.
|
void |
open()
Start the output process
|
void |
processingInstruction(java.lang.String target,
java.lang.CharSequence data,
Location locationId,
int properties)
Write a processing instruction
|
void |
setHostLanguage(int language)
Set the host language
|
void |
setPipelineConfiguration(PipelineConfiguration pipe)
Set the pipeline configuration
|
void |
setReceiver(Receiver receiver)
Set the receiver (to handle the next stage in the pipeline) directly
|
void |
setSystemId(java.lang.String systemId)
Set the system ID
|
void |
setUnparsedEntity(java.lang.String name,
java.lang.String systemID,
java.lang.String publicID)
Notify an unparsed entity URI.
|
void |
startContent()
Flush out a pending start tag
|
void |
startDocument(int properties)
Start of a document node.
|
void |
startElement(NodeName elemName,
SchemaType typeCode,
Location location,
int properties)
Output an element start tag.
|
boolean |
usesTypeAnnotations()
Ask whether this Receiver (or the downstream pipeline) makes any use of the type annotations
supplied on element and attribute events
|
append, decompose, flatten, getConfiguration, getErrorCodeForDecomposingFunctionItems, getNamePool, getPipelineConfiguration, getSystemId, handlesAppend
public ComplexContentOutputter(Receiver next)
next
- the next receiver in the pipelinepublic static Receiver makeComplexContentReceiver(Receiver receiver, ParseOptions options)
receiver
- the destination to which the constructed complex content will be writtenoptions
- options for validating the output stream; may be nullpublic void setPipelineConfiguration(PipelineConfiguration pipe)
Receiver
setPipelineConfiguration
in interface Receiver
setPipelineConfiguration
in class SequenceReceiver
pipe
- the pipeline configurationpublic void setSystemId(java.lang.String systemId)
SequenceReceiver
setSystemId
in interface javax.xml.transform.Result
setSystemId
in interface Receiver
setSystemId
in class SequenceReceiver
systemId
- the URI used to identify the tree being passed across this interfacepublic void setHostLanguage(int language)
language
- the host language, for example Configuration.XQUERY
public void setReceiver(Receiver receiver)
receiver
- the receiver to handle the next stage in the pipelinepublic Receiver getReceiver()
public void open() throws XPathException
open
in interface Receiver
open
in class SequenceReceiver
XPathException
- if an error occurspublic void startDocument(int properties) throws XPathException
properties
- bit-significant integer indicating properties of the document node.
The definitions of the bits are in class ReceiverOptions
XPathException
- if an error occurspublic void endDocument() throws XPathException
XPathException
- if an error occurspublic void setUnparsedEntity(java.lang.String name, java.lang.String systemID, java.lang.String publicID) throws XPathException
setUnparsedEntity
in interface Receiver
setUnparsedEntity
in class SequenceReceiver
name
- The name of the unparsed entitysystemID
- The system identifier of the unparsed entitypublicID
- The public identifier of the unparsed entityXPathException
- if an error occurspublic void characters(java.lang.CharSequence s, Location locationId, int properties) throws XPathException
s
- The String to be outputlocationId
- the location of the node in the source, or of the instruction that created itproperties
- Bit significant value. The following bits are defined:
XPathException
- for any failurepublic void startElement(NodeName elemName, SchemaType typeCode, Location location, int properties) throws XPathException
elemName
- The element namelocation
- the location of the element node (or the instruction that created it)typeCode
- the type annotation of the element.properties
- bit-significant properties of the element node. If there are no revelant
properties, zero is supplied. The definitions of the bits are in class ReceiverOptions
XPathException
- if an error occurspublic void namespace(NamespaceBindingSet nsBindings, int properties) throws XPathException
nsBindings
- The namespace bindingsproperties
- The most important property is REJECT_DUPLICATES. If this property is set, the
namespace declaration will be rejected if it conflicts with a previous declaration of the same
prefix. If the property is not set, the namespace declaration will be ignored if it conflicts
with a previous declaration. This reflects the fact that when copying a tree, namespaces for child
elements are emitted before the namespaces of their parent element. Unfortunately this conflicts
with the XSLT rule for complex content construction, where the recovery action in the event of
conflicts is to take the namespace that comes last. XSLT therefore doesn't recover from this error:XPathException
- if there is no start tag to write to (created using writeStartTag),
or if character content has been written since the start tag was written.public void attribute(NodeName attName, SimpleType typeCode, java.lang.CharSequence value, Location locationId, int properties) throws XPathException
attName
- The name of the attributevalue
- The value of the attributelocationId
- the location of the node in the source, or of the instruction that created itproperties
- Bit fields containing properties of the attribute to be written @throws XPathException if there is no start tag to write to (created using writeStartTag),
or if character content has been written since the start tag was written.typeCode
- The type annotation of the attributeXPathException
- if an error occurspublic void endElement() throws XPathException
XPathException
- if an error occurspublic void comment(java.lang.CharSequence comment, Location locationId, int properties) throws XPathException
comment
- The content of the commentlocationId
- provides information such as line number and system ID.properties
- Additional information about the comment.XPathException
- if an error occurspublic void processingInstruction(java.lang.String target, java.lang.CharSequence data, Location locationId, int properties) throws XPathException
target
- The PI name. This must be a legal name (it will not be checked).data
- The data portion of the processing instructionlocationId
- provides information such as line number and system ID.properties
- Additional information about the PI.XPathException
- if an error occurspublic void append(Item item, Location locationId, int copyNamespaces) throws XPathException
append
in interface Receiver
append
in class SequenceReceiver
item
- the item to be appendedlocationId
- the location of the calling instruction, for diagnosticscopyNamespaces
- if the item is an element node, this indicates whether its namespaces
need to be copied. Values are ReceiverOptions.ALL_NAMESPACES
,
ReceiverOptions.LOCAL_NAMESPACES
; the default (0) means
no namespacesXPathException
public void close() throws XPathException
XPathException
- if an error occurspublic void startContent() throws XPathException
XPathException
- if an error occurspublic boolean usesTypeAnnotations()
public boolean isReadyForGrafting()
public void graftElementNode(TinyElementImpl elementNode, int copyOptions) throws XPathException
XPathException
public boolean isReadyForBulkCopy()
public void bulkCopyElementNode(TinyElementImpl elementNode, int copyOptions) throws XPathException
XPathException
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.