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.CloneableRepresents 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 NamespaceNO_NAMESPACETheNamespacefor when not in a namespacestatic NamespaceXML_NAMESPACEThe xml namespace.static NamespaceXMLNS_NAMESPACEThe 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.Objectclone()booleanequals(java.lang.Object o)Note: equals() is based on URI only.booleanequalsAll(Namespace ns)Tests whether two namespace are the same in both prefix and namespace URI.java.lang.StringgetPrefix()Gets the prefix mapped to this Namespace.static NamespacegetSpecial(java.lang.String prefix)Returns the special namespace if prefix is special, or null if not.java.lang.StringgetURI()Gets the namespace URI for this Namespace.inthashCode()Note: hashCode() is based on URI only.java.lang.StringtagNameOf(java.lang.String name)Gets the tag name of the giving local name.java.lang.StringtoString()
-
-
-
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:
clonein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
Note: equals() is based on URI only.- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Note: hashCode() is based on URI only.- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-