Package: groovy.xml

## [Java] Class XmlNodePrinter.NamespaceContext

- groovy.xml.XmlNodePrinter.NamespaceContext

-     protected static class XmlNodePrinter.NamespaceContext
      extends Object

  Tracks namespace declarations already emitted while printing a subtree.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `NamespaceContext()` Creates an empty namespace context.
    `NamespaceContext(XmlNodePrinter.NamespaceContext context)` Creates a namespace context initialized from an existing context.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public String` | `getNamespace(String prefix)` Returns the namespace URI currently registered for the supplied prefix.
    `` | `public boolean` | `isPrefixRegistered(String prefix, String uri)` Checks whether a prefix is already registered for the supplied namespace URI.
    `` | `public void` | `registerNamespacePrefix(String prefix, String uri)` Records a namespace prefix mapping if it has not already been registered.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### public NamespaceContext()

      Creates an empty namespace context.

    - #### public NamespaceContext(XmlNodePrinter.NamespaceContext context)

      Creates a namespace context initialized from an existing context.

      Parameters:
        `context` - the context to copy

  - ### Method Detail

    - #### public String getNamespace(String prefix)

      Returns the namespace URI currently registered for the supplied prefix.

      Parameters:
        `prefix` - the namespace prefix to resolve
      Returns:
        the registered namespace URI, or `null` if none is registered

    - #### public boolean isPrefixRegistered(String prefix, String uri)

      Checks whether a prefix is already registered for the supplied namespace URI.

      Parameters:
        `prefix` - the namespace prefix to look up
        `uri` - the namespace URI to compare against
      Returns:
        `true` if the prefix is already registered for that URI

    - #### public void registerNamespacePrefix(String prefix, String uri)

      Records a namespace prefix mapping if it has not already been registered.

      Parameters:
        `prefix` - the namespace prefix to register
        `uri` - the namespace URI to associate with `prefix`