## net.sf.saxon.event
Class Emitter

    java.lang.Object
      |
      +--net.sf.saxon.event.Emitter

All Implemented Interfaces:
  Receiver, javax.xml.transform.Result

Direct Known Subclasses:
  ContentHandlerProxy, DOMEmitter, UncommittedEmitter, 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
`protected CharacterSet` `characterSet`
`protected Configuration` `config`
`protected NamePool` `namePool`
`protected java.util.Properties` `outputProperties`
`protected java.io.OutputStream` `outputStream`
`protected javax.xml.transform.stream.StreamResult` `streamResult`
`protected java.lang.String` `systemId`
`protected java.io.Writer` `writer`

Fields inherited from interface javax.xml.transform.Result
`PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING`

Constructor Summary
`Emitter()`

Method Summary
`Configuration` `getConfiguration()` Get the namepool used for this document
`LocationProvider` `getDocumentLocator()` Get the Document Locator
`java.util.Properties` `getOutputProperties()` Get the output properties
`java.io.OutputStream` `getOutputStream()` Get the output stream
`java.lang.String` `getSystemId()` Get the System ID
`java.io.Writer` `getWriter()` Get the output writer
`static Emitter` `makeEmitter(java.lang.String className)` Load a named output emitter or SAX2 ContentHandler and check it is OK.
`protected void` `makeWriter()` Make a Writer for this Emitter to use, given a StreamResult
`void` `setConfiguration(Configuration config)` Set the namePool in which all name codes can be found
`void` `setDocumentLocator(LocationProvider locator)` Set locator, to identify position in the document.
`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` `setSystemId(java.lang.String systemId)` Set the System ID
`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` `usesWriter()` 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

### config

    protected Configuration config

### 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

Constructor Detail

### Emitter

    public Emitter()

Method Detail

### setConfiguration

    public void setConfiguration(Configuration config)

  Set the namePool in which all name codes can be found

  Specified by:
    `setConfiguration` in interface `Receiver`

### getConfiguration

    public Configuration getConfiguration()

  Get the namepool used for this document

  Specified by:
    `getConfiguration` in interface `Receiver`

### setSystemId

    public void setSystemId(java.lang.String systemId)

  Set the System ID

  Specified by:
    `setSystemId` in interface `javax.xml.transform.Result`

### getSystemId

    public java.lang.String getSystemId()

  Get the System ID

  Specified by:
    `getSystemId` in interface `javax.xml.transform.Result`

### setOutputProperties

    public void setOutputProperties(java.util.Properties details)
                             throws XPathException

  Set output properties

    `XPathException`

### getOutputProperties

    public java.util.Properties getOutputProperties()

  Get the output properties

### setStreamResult

    public void setStreamResult(javax.xml.transform.stream.StreamResult result)

  Set the StreamResult acting as the output destination of the Emitter

### makeWriter

    protected void makeWriter()
                       throws XPathException

  Make a Writer for this Emitter to use, given a StreamResult

    `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 XPathException

  Set the output destination as a byte stream

    `XPathException`

### getOutputStream

    public java.io.OutputStream getOutputStream()

  Get the output stream

### setDocumentLocator

    public void setDocumentLocator(LocationProvider locator)

  Set locator, to identify position in the document. Used only when supplying input from a parser.

  Specified by:
    `setDocumentLocator` in interface `Receiver`

### getDocumentLocator

    public LocationProvider getDocumentLocator()

  Get the Document Locator

  Specified by:
    `getDocumentLocator` in interface `Receiver`

### setUnparsedEntity

    public void setUnparsedEntity(java.lang.String name,
                                  java.lang.String uri,
                                  java.lang.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
    `XPathException`

### makeEmitter

    public static Emitter makeEmitter(java.lang.String className)
                               throws XPathException

  Load a named output emitter or SAX2 ContentHandler and check it is OK.

    `XPathException`