public abstract class Emitter extends SequenceReceiver implements javax.xml.transform.Result
The interface is deliberately designed to be as close as possible to the standard SAX2 ContentHandler interface, however, it allows additional information to be made available. An Emitter is a Receiver, specifically it is a Receiver that can direct output to a Writer or OutputStream, using serialization properties defined in a Properties object.
Modifier and Type | Field and Description |
---|---|
protected boolean |
allCharactersEncodable |
protected CharacterSet |
characterSet |
protected java.util.Properties |
outputProperties |
protected java.io.OutputStream |
outputStream |
protected javax.xml.transform.stream.StreamResult |
streamResult |
protected java.io.Writer |
writer |
pipelineConfiguration, previousAtomic, systemId
Constructor and Description |
---|
Emitter() |
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 |
close()
Notify the end of the event stream
|
java.util.Properties |
getOutputProperties()
Get the output properties
|
java.io.OutputStream |
getOutputStream()
Get the output stream
|
java.io.Writer |
getWriter()
Get the output writer
|
protected java.io.OutputStream |
makeOutputStream() |
protected void |
makeWriter()
Make a Writer for this Emitter to use, given a StreamResult.
|
void |
setOutputProperties(java.util.Properties details)
Set output properties
|
void |
setOutputStream(java.io.OutputStream stream)
Set the output destination as a byte stream.
|
void |
setStreamResult(javax.xml.transform.stream.StreamResult result)
Set the StreamResult acting as the output destination of the Emitter
|
void |
setUnparsedEntity(java.lang.String name,
java.lang.String uri,
java.lang.String publicId)
Set unparsed entity URI.
|
void |
setWriter(java.io.Writer writer)
Set the output destination as a character stream
|
boolean |
usesTypeAnnotations()
Ask whether this Receiver (or the downstream pipeline) makes any use of the type annotations
supplied on element and attribute events
|
boolean |
usesWriter()
Determine whether the Emitter wants a Writer for character output or
an OutputStream for binary output.
|
append, getConfiguration, getNamePool, getPipelineConfiguration, getSystemId, isTrueSequenceReceiver, open, setPipelineConfiguration, setSystemId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
attribute, characters, comment, endDocument, endElement, namespace, processingInstruction, startContent, startDocument, startElement
protected javax.xml.transform.stream.StreamResult streamResult
protected java.io.Writer writer
protected java.io.OutputStream outputStream
protected java.util.Properties outputProperties
protected CharacterSet characterSet
protected boolean allCharactersEncodable
public void setOutputProperties(java.util.Properties details) throws XPathException
details
- the output serialization propertiesXPathException
- if an error occurs finding the encoding propertypublic java.util.Properties getOutputProperties()
public void setStreamResult(javax.xml.transform.stream.StreamResult result) throws XPathException
result
- the output destinationXPathException
- if an error occursprotected void makeWriter() throws XPathException
XPathException
- if an error occursprotected java.io.OutputStream makeOutputStream() throws XPathException
XPathException
public boolean usesWriter()
public void setWriter(java.io.Writer writer) throws XPathException
writer
- the Writer to use as an output destinationXPathException
- if an error occurspublic java.io.Writer getWriter()
public void setOutputStream(java.io.OutputStream stream) throws XPathException
Note that if a specific encoding (other than the default, UTF-8) is required, then
setOutputProperties(java.util.Properties)
must be called before calling
this method.
stream
- the OutputStream being used as an output destinationXPathException
- if an error occurspublic java.io.OutputStream getOutputStream()
public void setUnparsedEntity(java.lang.String name, java.lang.String uri, java.lang.String publicId) throws XPathException
setUnparsedEntity
in interface Receiver
setUnparsedEntity
in class SequenceReceiver
name
- the entity nameuri
- the entity system IDpublicId
- the entity public IDXPathException
- if an error occurspublic void close() throws XPathException
close
in interface Receiver
XPathException
- if an error occurspublic boolean usesTypeAnnotations()
usesTypeAnnotations
in interface Receiver
public void append(Item item, Location locationId, int copyNamespaces) throws XPathException
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 NodeInfo.ALL_NAMESPACES
,
NodeInfo.LOCAL_NAMESPACES
, NodeInfo.NO_NAMESPACES
XPathException
- if the operation failsCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.