NamespaceEmitter
Date: 2016-07-03

com.icl.saxon.output

## Class NamespaceEmitter

- java.lang.Object
- - com.icl.saxon.output.Emitter
  - - com.icl.saxon.output.ProxyEmitter
    - - com.icl.saxon.output.NamespaceEmitter

- All Implemented Interfaces:
    javax.xml.transform.Result

      public class NamespaceEmitter
      extends ProxyEmitter

  NamespaceEmitter is a ProxyEmitter responsible for removing duplicate namespace declarations. It also ensures that an xmlns="" undeclaration is output when necessary.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected NamePool` | `namePool`
    `protected int` | `nscodeNull`
    `protected int` | `nscodeXML`

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

      `baseEmitter, outputProperties`

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

      `locator, 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
    `NamespaceEmitter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `endElement(int nameCode)` endElement: Discard the namespaces declared on this element.
    `void` | `setNamePool(NamePool pool)` Set the name pool to be used for all name codes
    `void` | `startElement(int nameCode, org.xml.sax.Attributes attList, int[] namespaceCodes, int nrOfCodes)` startElement.

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

      `characters, comment, endDocument, processingInstruction, setDocumentLocator, setEscaping, setOutputProperties, setUnderlyingEmitter, setUnparsedEntity, setWriter, startDocument`

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

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

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

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

- - ### Field Detail

    - #### namePool

          protected NamePool namePool

    - #### nscodeXML

          protected int nscodeXML

    - #### nscodeNull

          protected int nscodeNull

  - ### Constructor Detail

    - #### NamespaceEmitter

          public NamespaceEmitter()

  - ### Method Detail

    - #### setNamePool

          public void setNamePool(NamePool pool)

      Set the name pool to be used for all name codes
      Overrides:
        `setNamePool` in class `ProxyEmitter`

    - #### startElement

          public void startElement(int nameCode,
                          org.xml.sax.Attributes attList,
                          int[] namespaceCodes,
                          int nrOfCodes)
                            throws javax.xml.transform.TransformerException

      startElement. This call removes redundant namespace declarations, and possibly adds an xmlns="" undeclaration.
      Overrides:
        `startElement` in class `ProxyEmitter`
        `namespaceCodes` - Array of namespace codes identifying the namespace prefix/uri pairs associated with this element
        `nrOfCodes` - Number of significant entries within namespaces array
      Throws:
        `javax.xml.transform.TransformerException`

    - #### endElement

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

      endElement: Discard the namespaces declared on this element.
      Overrides:
        `endElement` in class `ProxyEmitter`
      Throws:
        `javax.xml.transform.TransformerException`