Class Emitter

java.lang.Object
net.sf.saxon.event.Emitter
All Implemented Interfaces:
Result, Receiver
Direct Known Subclasses:
XMLEmitter

public abstract class Emitter extends Object implements 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 Details

    • pipelineConfig

      protected PipelineConfiguration pipelineConfig
    • namePool

      protected NamePool namePool
    • systemId

      protected String systemId
    • streamResult

      protected StreamResult streamResult
    • writer

      protected Writer writer
    • outputStream

      protected OutputStream outputStream
    • outputProperties

      protected Properties outputProperties
    • characterSet

      protected CharacterSet characterSet
    • allCharactersEncodable

      protected boolean allCharactersEncodable
  • Constructor Details

    • Emitter

      public Emitter()
  • Method Details

    • setPipelineConfiguration

      public void setPipelineConfiguration(PipelineConfiguration pipe)
      Set the pipelineConfiguration
      Specified by:
      setPipelineConfiguration in interface Receiver
    • getPipelineConfiguration

      public PipelineConfiguration getPipelineConfiguration()
      Get the pipeline configuration used for this document
      Specified by:
      getPipelineConfiguration in interface Receiver
    • getConfiguration

      public Configuration getConfiguration()
      Get the configuration used for this document
    • setSystemId

      public void setSystemId(String systemId)
      Set the System ID
      Specified by:
      setSystemId in interface Receiver
      Specified by:
      setSystemId in interface Result
    • getSystemId

      public String getSystemId()
      Get the System ID
      Specified by:
      getSystemId in interface Result
    • setOutputProperties

      public void setOutputProperties(Properties details) throws XPathException
      Set output properties
      Throws:
      XPathException
    • getOutputProperties

      public Properties getOutputProperties()
      Get the output properties
    • setStreamResult

      public void setStreamResult(StreamResult result) throws XPathException
      Set the StreamResult acting as the output destination of the Emitter
      Throws:
      XPathException
    • makeWriter

      protected void makeWriter() throws XPathException
      Make 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(Writer writer)
      Set the output destination as a character stream
    • getWriter

      public Writer getWriter()
      Get the output writer
    • setOutputStream

      public void setOutputStream(OutputStream stream) throws XPathException
      Set the output destination as a byte stream
      Throws:
      XPathException
    • getOutputStream

      public OutputStream getOutputStream()
      Get the output stream
    • setUnparsedEntity

      public void setUnparsedEntity(String name, String uri, String publicId) throws XPathException
      Set 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:
      setUnparsedEntity in interface Receiver
      Parameters:
      name - The name of the unparsed entity
      uri - The system identifier of the unparsed entity
      publicId - The public identifier of the unparsed entity
      Throws:
      XPathException