## com.icl.saxon.output
Class Emitter

    java.lang.Object
      com.icl.saxon.output.Emitter

All Implemented Interfaces:
  Result

Direct Known Subclasses:
  Builder, ContentHandlerProxy, DocumentHandlerProxy, DOMEmitter, ErrorEmitter, ProxyEmitter, XMLEmitter

public abstract class Emitter
extends java.lang.Object
implements Result

Emitter: This interface 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.

Field Summary
`protected org.xml.sax.Locator` `locator`
`protected NamePool` `namePool`
`protected java.util.Properties` `outputProperties`
`protected java.io.OutputStream` `outputStream`
`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
`abstract void` `characters(char[] chars, int start, int len)` Output character data
`abstract void` `comment(char[] chars, int start, int length)` Output a comment.
`abstract void` `endDocument()` Notify document end
`abstract void` `endElement(int nameCode)` Output an element end tag
`NamePool` `getNamePool()` Get the namepool used for this document
`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 document handler and check it is OK.
`abstract void` `processingInstruction(java.lang.String name, java.lang.String data)` Output a processing instruction
`void` `setDocumentLocator(org.xml.sax.Locator locator)` Set locator, to identify position in the document.
`void` `setEscaping(boolean escaping)` Switch escaping on or off.
`void` `setNamePool(NamePool namePool)` Set the namePool in which all name codes can be found
`void` `setOutputProperties(java.util.Properties props)` Set the output properties
`void` `setOutputStream(java.io.OutputStream stream)` Set the output destination as a byte stream
`void` `setSystemId(java.lang.String systemId)` Set the System ID
`void` `setUnparsedEntity(java.lang.String name, java.lang.String uri)` Set unparsed entity URI Used only when supplying input from a parser.
`void` `setWriter(java.io.Writer writer)` Set the output destination as a character stream
`abstract void` `startDocument()` Notify document start
`abstract void` `startElement(int nameCode, org.xml.sax.Attributes attributes, int[] namespaces, int nscount)` Output an element start tag.
`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`

Field Detail

### namePool

    protected NamePool namePool

### systemId

    protected java.lang.String systemId

### writer

    protected java.io.Writer writer

### outputStream

    protected java.io.OutputStream outputStream

### outputProperties

    protected java.util.Properties outputProperties

### locator

    protected org.xml.sax.Locator locator

Constructor Detail

### Emitter

    public Emitter()

Method Detail

### setNamePool

    public void setNamePool(NamePool namePool)

  Set the namePool in which all name codes can be found

### getNamePool

    public NamePool getNamePool()

  Get the namepool used for this document

### setSystemId

    public void setSystemId(java.lang.String systemId)

  Set the System ID

  Specified by:
    `setSystemId` in interface `Result`
  Parameters:
    `systemId` - The system identifier as a URI string.

### getSystemId

    public java.lang.String getSystemId()

  Get the System ID

  Specified by:
    `getSystemId` in interface `Result`
  Returns:
    The system identifier that was set with setSystemId, or null if setSystemId was not called.

### setOutputProperties

    public void setOutputProperties(java.util.Properties props)

  Set the output properties

### getOutputProperties

    public java.util.Properties getOutputProperties()

  Get the output properties

### usesWriter

    public boolean usesWriter()

  Determine whether the Emitter wants a Writer for character output or an OutputStream for binary output

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

  Set the output destination as a byte stream

### getOutputStream

    public java.io.OutputStream getOutputStream()

  Get the output stream

### startDocument

    public abstract void startDocument()
                                throws TransformerException

  Notify document start

  Throws:
    `TransformerException`

### endDocument

    public abstract void endDocument()
                              throws TransformerException

  Notify document end

  Throws:
    `TransformerException`

### startElement

    public abstract void startElement(int nameCode,
                                      org.xml.sax.Attributes attributes,
                                      int[] namespaces,
                                      int nscount)
                               throws TransformerException

  Output an element start tag.

  Parameters:
    `namespaces` - Array of namespace codes identifying the namespace prefix/uri pairs associated with this element
    `nscount` - Number of significant entries within namespaces array
  Throws:
    `TransformerException`

### endElement

    public abstract void endElement(int nameCode)
                             throws TransformerException

  Output an element end tag

  Throws:
    `TransformerException`

### characters

    public abstract void characters(char[] chars,
                                    int start,
                                    int len)
                             throws TransformerException

  Output character data

  Throws:
    `TransformerException`

### processingInstruction

    public abstract void processingInstruction(java.lang.String name,
                                               java.lang.String data)
                                        throws TransformerException

  Output a processing instruction

  Throws:
    `TransformerException`

### comment

    public abstract void comment(char[] chars,
                                 int start,
                                 int length)
                          throws TransformerException

  Output a comment.
  (The method signature is borrowed from the SAX2 LexicalHandler interface)

  Throws:
    `TransformerException`

### setEscaping

    public void setEscaping(boolean escaping)
                     throws TransformerException

  Switch escaping on or off. This is called when the XSLT disable-output-escaping attribute is used to switch escaping on or off. It is also called at the start and end of a CDATA section It is not called for other sections of output (e.g. comments) where escaping is inappropriate.

  Throws:
    `TransformerException`

### setDocumentLocator

    public void setDocumentLocator(org.xml.sax.Locator locator)

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

### setUnparsedEntity

    public void setUnparsedEntity(java.lang.String name,
                                  java.lang.String uri)
                           throws TransformerException

  Set unparsed entity URI Used only when supplying input from a parser.

  Throws:
    `TransformerException`

### makeEmitter

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

  load a named output emitter or document handler and check it is OK.

  Throws:
    `TransformerException`