Package net.sf.saxon.event
Class Emitter
- java.lang.Object
-
- net.sf.saxon.event.Emitter
-
- All Implemented Interfaces:
javax.xml.transform.Result,Receiver
- Direct Known Subclasses:
XMLEmitter
public abstract class Emitter extends java.lang.Object implements javax.xml.transform.Result, Receiver
Emitter: This abstract class defines methods that must be implemented by components that format SAXON output. There is one emitter for XML, one for HTML, and so on. Additional methods are concerned with setting options and providing a Writer.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanallCharactersEncodableprotected CharacterSetcharacterSetprotected NamePoolnamePoolprotected java.util.PropertiesoutputPropertiesprotected java.io.OutputStreamoutputStreamprotected PipelineConfigurationpipelineConfigprotected javax.xml.transform.stream.StreamResultstreamResultprotected java.lang.StringsystemIdprotected java.io.Writerwriter
-
Constructor Summary
Constructors Constructor Description Emitter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationgetConfiguration()Get the configuration used for this documentjava.util.PropertiesgetOutputProperties()Get the output propertiesjava.io.OutputStreamgetOutputStream()Get the output streamPipelineConfigurationgetPipelineConfiguration()Get the pipeline configuration used for this documentjava.lang.StringgetSystemId()Get the System IDjava.io.WritergetWriter()Get the output writerprotected voidmakeWriter()Make a Writer for this Emitter to use, given a StreamResultvoidsetOutputProperties(java.util.Properties details)Set output propertiesvoidsetOutputStream(java.io.OutputStream stream)Set the output destination as a byte streamvoidsetPipelineConfiguration(PipelineConfiguration pipe)Set the pipelineConfigurationvoidsetStreamResult(javax.xml.transform.stream.StreamResult result)Set the StreamResult acting as the output destination of the EmittervoidsetSystemId(java.lang.String systemId)Set the System IDvoidsetUnparsedEntity(java.lang.String name, java.lang.String uri, java.lang.String publicId)Set unparsed entity URI.voidsetWriter(java.io.Writer writer)Set the output destination as a character streambooleanusesWriter()Determine whether the Emitter wants a Writer for character output or an OutputStream for binary output.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.event.Receiver
attribute, characters, close, comment, endDocument, endElement, namespace, open, processingInstruction, startContent, startDocument, startElement
-
-
-
-
Field Detail
-
pipelineConfig
protected PipelineConfiguration pipelineConfig
-
namePool
protected NamePool namePool
-
systemId
protected java.lang.String systemId
-
streamResult
protected javax.xml.transform.stream.StreamResult streamResult
-
writer
protected java.io.Writer writer
-
outputStream
protected java.io.OutputStream outputStream
-
outputProperties
protected java.util.Properties outputProperties
-
characterSet
protected CharacterSet characterSet
-
allCharactersEncodable
protected boolean allCharactersEncodable
-
-
Method Detail
-
setPipelineConfiguration
public void setPipelineConfiguration(PipelineConfiguration pipe)
Set the pipelineConfiguration- Specified by:
setPipelineConfigurationin interfaceReceiver
-
getPipelineConfiguration
public PipelineConfiguration getPipelineConfiguration()
Get the pipeline configuration used for this document- Specified by:
getPipelineConfigurationin interfaceReceiver
-
getConfiguration
public Configuration getConfiguration()
Get the configuration used for this document
-
setSystemId
public void setSystemId(java.lang.String systemId)
Set the System ID- Specified by:
setSystemIdin interfaceReceiver- Specified by:
setSystemIdin interfacejavax.xml.transform.Result
-
getSystemId
public java.lang.String getSystemId()
Get the System ID- Specified by:
getSystemIdin interfacejavax.xml.transform.Result
-
setOutputProperties
public void setOutputProperties(java.util.Properties details) throws XPathExceptionSet output properties- Throws:
XPathException
-
getOutputProperties
public java.util.Properties getOutputProperties()
Get the output properties
-
setStreamResult
public void setStreamResult(javax.xml.transform.stream.StreamResult result) throws XPathExceptionSet the StreamResult acting as the output destination of the Emitter- Throws:
XPathException
-
makeWriter
protected void makeWriter() throws XPathExceptionMake a Writer for this Emitter to use, given a StreamResult- Throws:
XPathException
-
usesWriter
public boolean usesWriter()
Determine whether the Emitter wants a Writer for character output or an OutputStream for binary output. The standard Emitters all use a Writer, so this returns true; but a subclass can override this if it wants to use an OutputStream
-
setWriter
public void setWriter(java.io.Writer writer)
Set the output destination as a character stream
-
getWriter
public java.io.Writer getWriter()
Get the output writer
-
setOutputStream
public void setOutputStream(java.io.OutputStream stream) throws XPathExceptionSet the output destination as a byte stream- Throws:
XPathException
-
getOutputStream
public java.io.OutputStream getOutputStream()
Get the output stream
-
setUnparsedEntity
public void setUnparsedEntity(java.lang.String name, java.lang.String uri, java.lang.String publicId) throws XPathExceptionSet unparsed entity URI. Needed to satisfy the Receiver interface, but not used, because unparsed entities can occur only in input documents, not in output documents.- Specified by:
setUnparsedEntityin interfaceReceiver- Parameters:
name- The name of the unparsed entityuri- The system identifier of the unparsed entitypublicId- The public identifier of the unparsed entity- Throws:
XPathException
-
-