Package groovy.xml

Class Namespace

java.lang.Object
groovy.xml.Namespace

public class Namespace extends Object
A simple helper class which acts as a factory of QName instances.
  • Constructor Details

    • Namespace

      public Namespace()
      Creates a namespace helper with no default URI or prefix.
    • Namespace

      public Namespace(String uri)
      Creates a namespace helper for the supplied URI.
      Parameters:
      uri - the namespace URI, trimmed before storage
    • Namespace

      public Namespace(String uri, String prefix)
      Creates a namespace helper for the supplied URI and prefix.
      Parameters:
      uri - the namespace URI, trimmed before storage
      prefix - the namespace prefix, trimmed before storage
  • Method Details

    • get

      public QName get(String localName)
      Returns the QName for the given localName.
      Parameters:
      localName - the local name within this
    • getPrefix

      public String getPrefix()
      Returns the prefix mapped to this namespace
      Returns:
      the prefix assigned to this namespace or null if no namespace is mapped.
    • getUri

      public String getUri()
      Returns the URI of this namespace
      Returns:
      the URI of this namespace