CopyEmitter
Date: 2016-07-03

com.nwalsh.saxon

## Class CopyEmitter

- java.lang.Object
- - com.icl.saxon.output.Emitter
  - - com.nwalsh.saxon.CopyEmitter

- All Implemented Interfaces:
    javax.xml.transform.Result
  Direct Known Subclasses:
    CalloutEmitter, ColumnUpdateEmitter, NumberLinesEmitter, UnwrapLinksEmitter

      public class CopyEmitter
      extends com.icl.saxon.output.Emitter

  A Saxon 6.0 Emitter that clones its input.

  $Id: CopyEmitter.java 5907 2006-04-27 08:26:47Z xmldoc $

  Copyright (C) 2000 Norman Walsh.

  This class provides a Saxon 6.* implementation of an emitter that manufactures a cloned result tree fragment.

  The purpose of this emitter is to provide something for CalloutEmitter and NumberLinesEmitter to extend. This emitter simply copies all input to a new result tree fragment.

  Change Log:

  1.0

    Initial release.

  See Also:
    `CalloutEmitter`, `NumberLinesEmitter`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected com.icl.saxon.om.NamePool` | `namePool` The namePool.
    `protected com.icl.saxon.expr.FragmentValue` | `rtf` The result tree fragment containing the copied fragment.
    `protected com.icl.saxon.output.Emitter` | `rtfEmitter`

    - ### Fields inherited from class com.icl.saxon.output.Emitter

      `locator, outputProperties, outputStream, systemId, writer`

    - ### Fields inherited from interface javax.xml.transform.Result

      `PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CopyEmitter(com.icl.saxon.Controller controller, com.icl.saxon.om.NamePool namePool)` Constructor for the CopyEmitter.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `characters(char[] chars, int start, int len)` Copy characters.
    `void` | `comment(char[] chars, int start, int length)` Copy comments.
    `void` | `endDocument()` Copy end document events.
    `void` | `endElement(int nameCode)` Copy end element events.
    `com.icl.saxon.expr.FragmentValue` | `getResultTreeFragment()` Return the result tree fragment constructed by replaying events through this emitter.
    `void` | `processingInstruction(java.lang.String name, java.lang.String data)` Copy processing instructions.
    `void` | `setDocumentLocator(org.xml.sax.Locator locator)` Copy set document locator events.
    `void` | `setEscaping(boolean escaping)` Copy set escaping events.
    `void` | `setNamePool(com.icl.saxon.om.NamePool namePool)` Copy set name pool events.
    `void` | `setUnparsedEntity(java.lang.String name, java.lang.String uri)` Copy set unparsed entity events.
    `void` | `setWriter(java.io.Writer writer)` Copy set writer events.
    `void` | `startDocument()` Copy start document events.
    `void` | `startElement(int nameCode, org.xml.sax.Attributes attributes, int[] namespaces, int nscount)` Copy start element events.

    - ### Methods inherited from class com.icl.saxon.output.Emitter

      `getNamePool, getOutputProperties, getOutputStream, getSystemId, getWriter, makeEmitter, setOutputProperties, setOutputStream, setSystemId, usesWriter`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### rtf

          protected com.icl.saxon.expr.FragmentValue rtf

      The result tree fragment containing the copied fragment.

    - #### rtfEmitter

          protected com.icl.saxon.output.Emitter rtfEmitter

    - #### namePool

          protected com.icl.saxon.om.NamePool namePool

      The namePool.

      Copied from the caller, it should be the runtime name pool.

  - ### Constructor Detail

    - #### CopyEmitter

          public CopyEmitter(com.icl.saxon.Controller controller,
                     com.icl.saxon.om.NamePool namePool)

      Constructor for the CopyEmitter.

      Parameters:
        `namePool` - The name pool to use for constructing elements and attributes.

  - ### Method Detail

    - #### getResultTreeFragment

          public com.icl.saxon.expr.FragmentValue getResultTreeFragment()

      Return the result tree fragment constructed by replaying events through this emitter.

    - #### characters

          public void characters(char[] chars,
                        int start,
                        int len)
                          throws javax.xml.transform.TransformerException

      Copy characters.
      Specified by:
        `characters` in class `com.icl.saxon.output.Emitter`
      Throws:
        `javax.xml.transform.TransformerException`

    - #### comment

          public void comment(char[] chars,
                     int start,
                     int length)
                       throws javax.xml.transform.TransformerException

      Copy comments.
      Specified by:
        `comment` in class `com.icl.saxon.output.Emitter`
      Throws:
        `javax.xml.transform.TransformerException`

    - #### endDocument

          public void endDocument()
                           throws javax.xml.transform.TransformerException

      Copy end document events.
      Specified by:
        `endDocument` in class `com.icl.saxon.output.Emitter`
      Throws:
        `javax.xml.transform.TransformerException`

    - #### endElement

          public void endElement(int nameCode)
                          throws javax.xml.transform.TransformerException

      Copy end element events.
      Specified by:
        `endElement` in class `com.icl.saxon.output.Emitter`
      Throws:
        `javax.xml.transform.TransformerException`

    - #### processingInstruction

          public void processingInstruction(java.lang.String name,
                                   java.lang.String data)
                                     throws javax.xml.transform.TransformerException

      Copy processing instructions.
      Specified by:
        `processingInstruction` in class `com.icl.saxon.output.Emitter`
      Throws:
        `javax.xml.transform.TransformerException`

    - #### setDocumentLocator

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

      Copy set document locator events.
      Overrides:
        `setDocumentLocator` in class `com.icl.saxon.output.Emitter`

    - #### setEscaping

          public void setEscaping(boolean escaping)
                           throws javax.xml.transform.TransformerException

      Copy set escaping events.
      Overrides:
        `setEscaping` in class `com.icl.saxon.output.Emitter`
      Throws:
        `javax.xml.transform.TransformerException`

    - #### setNamePool

          public void setNamePool(com.icl.saxon.om.NamePool namePool)

      Copy set name pool events.
      Overrides:
        `setNamePool` in class `com.icl.saxon.output.Emitter`

    - #### setUnparsedEntity

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

      Copy set unparsed entity events.
      Overrides:
        `setUnparsedEntity` in class `com.icl.saxon.output.Emitter`
      Throws:
        `javax.xml.transform.TransformerException`

    - #### setWriter

          public void setWriter(java.io.Writer writer)

      Copy set writer events.
      Overrides:
        `setWriter` in class `com.icl.saxon.output.Emitter`

    - #### startDocument

          public void startDocument()
                             throws javax.xml.transform.TransformerException

      Copy start document events.
      Specified by:
        `startDocument` in class `com.icl.saxon.output.Emitter`
      Throws:
        `javax.xml.transform.TransformerException`

    - #### startElement

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

      Copy start element events.
      Specified by:
        `startElement` in class `com.icl.saxon.output.Emitter`
      Throws:
        `javax.xml.transform.TransformerException`