Class Namespace

java.lang.Object
org.zkoss.idom.Namespace
All Implemented Interfaces:
Serializable, Cloneable

public final class Namespace extends Object implements Serializable, Cloneable
Represents the namespace. A namespace is immutable, so you have to get a new one
Author:
tomyeh
See Also:
  • Field Details

    • 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 Details

    • Namespace

      public Namespace(String prefix, 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 Details

    • getSpecial

      public static Namespace getSpecial(String prefix)
      Returns the special namespace if prefix is special, or null if not.
    • tagNameOf

      public final String tagNameOf(String name)
      Gets the tag name of the giving local name.
    • getPrefix

      public final String getPrefix()
      Gets the prefix mapped to this Namespace.
    • getURI

      public final 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 Object clone()
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object o)
      Note: equals() is based on URI only.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Note: hashCode() is based on URI only.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object