Package groovy.xml

# Class NamespaceBuilder

java.lang.Object
groovy.xml.NamespaceBuilder

public class NamespaceBuilder extends Object
A helper class for creating namespaces for GroovyMarkup

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NamespaceBuilder(BuilderSupport builder)`
  Creates a helper that produces namespace-aware wrappers for the supplied builder.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `NamespaceBuilderSupport`
  `declareNamespace(Map ns)`
  Declares multiple namespace mappings at once.
  `NamespaceBuilderSupport`
  `namespace(String uri)`
  Associates a namespace URI with the default prefix.
  `NamespaceBuilderSupport`
  `namespace(String uri, String prefix)`
  Associates a namespace URI with the supplied prefix.
  `static NamespaceBuilderSupport`
  `newInstance(BuilderSupport builder)`
  Creates a namespace-aware builder wrapper without any predefined namespace mappings.
  `static NamespaceBuilderSupport`
  `newInstance(BuilderSupport builder, String uri)`
  Creates a namespace-aware builder wrapper for a single default namespace URI.
  `static NamespaceBuilderSupport`
  `newInstance(BuilderSupport builder, String uri, String prefix)`
  Creates a namespace-aware builder wrapper for a single namespace mapping.
  `static NamespaceBuilderSupport`
  `newInstance(Map nsMap, BuilderSupport builder)`
  Creates a namespace-aware builder wrapper using the supplied prefix-to-URI mappings.

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

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

- ## Constructor Details

  - ### NamespaceBuilder

    public NamespaceBuilder(BuilderSupport builder)
    Creates a helper that produces namespace-aware wrappers for the supplied builder.
    Parameters:
      `builder` - the builder to wrap

- ## Method Details

  - ### newInstance

    public static NamespaceBuilderSupport newInstance(BuilderSupport builder, String uri)
    Creates a namespace-aware builder wrapper for a single default namespace URI.
    Parameters:
      `builder` - the builder to wrap
      `uri` - the namespace URI to associate with the default prefix
    Returns:
      a namespace-aware builder wrapper

  - ### newInstance

    public static NamespaceBuilderSupport newInstance(BuilderSupport builder)
    Creates a namespace-aware builder wrapper without any predefined namespace mappings.
    Parameters:
      `builder` - the builder to wrap
    Returns:
      a namespace-aware builder wrapper

  - ### newInstance

    public static NamespaceBuilderSupport newInstance(BuilderSupport builder, String uri, String prefix)
    Creates a namespace-aware builder wrapper for a single namespace mapping.
    Parameters:
      `builder` - the builder to wrap
      `uri` - the namespace URI to associate
      `prefix` - the prefix to associate with `uri`
    Returns:
      a namespace-aware builder wrapper

  - ### newInstance

    public static NamespaceBuilderSupport newInstance(Map nsMap, BuilderSupport builder)
    Creates a namespace-aware builder wrapper using the supplied prefix-to-URI mappings.
    Parameters:
      `nsMap` - the namespace mappings to declare
      `builder` - the builder to wrap
    Returns:
      a namespace-aware builder wrapper

  - ### namespace

    public NamespaceBuilderSupport namespace(String uri)
    Associates a namespace URI with the default prefix.
    Parameters:
      `uri` - the namespace URI to associate
    Returns:
      a namespace-aware builder wrapper

  - ### namespace

    public NamespaceBuilderSupport namespace(String uri, String prefix)
    Associates a namespace URI with the supplied prefix.
    Parameters:
      `uri` - the namespace URI to associate
      `prefix` - the prefix to associate with `uri`
    Returns:
      a namespace-aware builder wrapper

  - ### declareNamespace

    public NamespaceBuilderSupport declareNamespace(Map ns)
    Declares multiple namespace mappings at once.
    Parameters:
      `ns` - the prefix-to-URI mappings to declare
    Returns:
      a namespace-aware builder wrapper