Package org.zkoss.idom

## Class Namespace

- java.lang.Object
- - org.zkoss.idom.Namespace

- All Implemented Interfaces:
    `java.io.Serializable`, `java.lang.Cloneable`

      public final class Namespace
      extends java.lang.Object
      implements java.io.Serializable, java.lang.Cloneable

  Represents the namespace. A namespace is immutable, so you have to get a new one
  Author:
    tomyeh
  See Also:
    `Item`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static Namespace` | `NO_NAMESPACE` | The `Namespace` for when not in a namespace
    `static Namespace` | `XML_NAMESPACE` | The xml namespace.
    `static Namespace` | `XMLNS_NAMESPACE` | The xmlns namespace.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Namespace​(java.lang.String prefix, java.lang.String uri)` | Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.Object` | `clone()` |
    `boolean` | `equals​(java.lang.Object o)` | Note: equals() is based on URI only.
    `boolean` | `equalsAll​(Namespace ns)` | Tests whether two namespace are the same in both prefix and namespace URI.
    `java.lang.String` | `getPrefix()` | Gets the prefix mapped to this Namespace.
    `static Namespace` | `getSpecial​(java.lang.String prefix)` | Returns the special namespace if prefix is special, or null if not.
    `java.lang.String` | `getURI()` | Gets the namespace URI for this Namespace.
    `int` | `hashCode()` | Note: hashCode() is based on URI only.
    `java.lang.String` | `tagNameOf​(java.lang.String name)` | Gets the tag name of the giving local name.
    `java.lang.String` | `toString()` |

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

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### NO_NAMESPACE

          public static final Namespace NO_NAMESPACE

      The `Namespace` for when not in a namespace

    - #### XML_NAMESPACE

          public static final Namespace XML_NAMESPACE

      The xml namespace.

    - #### XMLNS_NAMESPACE

          public static final Namespace XMLNS_NAMESPACE

      The xmlns namespace.

  - ### Constructor Detail

    - #### Namespace

          public Namespace​(java.lang.String prefix,
                           java.lang.String uri)

      Constructor.
      Parameters:
        `prefix` - String prefix to map to this namespace.
        `uri` - String URI for namespace.
      Throws:
        `DOMException` - with NAMESPACE_ERR if the given prefix and uri is invalid

  - ### Method Detail

    - #### getSpecial

          public static Namespace getSpecial​(java.lang.String prefix)

      Returns the special namespace if prefix is special, or null if not.

    - #### tagNameOf

          public final java.lang.String tagNameOf​(java.lang.String name)

      Gets the tag name of the giving local name.

    - #### getPrefix

          public final java.lang.String getPrefix()

      Gets the prefix mapped to this Namespace.

    - #### getURI

          public final java.lang.String getURI()

      Gets the namespace URI for this Namespace.

    - #### equalsAll

          public final boolean equalsAll​(Namespace ns)

      Tests whether two namespace are the same in both prefix and namespace URI. On the other hand, equals check only the namespace URI.

      Note: unlike equals, it throws DOMException if prefix is the same but URI is different.

      Throws:
        `DOMException` - if they have the same prefix but with different namespace URI

    - #### clone

          public java.lang.Object clone()

      Overrides:
        `clone` in class `java.lang.Object`

    - #### equals

          public boolean equals​(java.lang.Object o)

      Note: equals() is based on URI only.
      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Note: hashCode() is based on URI only.
      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`