| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Namespace
defines both a factory for
creating XML namespaces, and a namespace itself. This class
represents an XML namespace in Java.
Elements and Attributes containing Namespaces can be serialized;
however the Namespace class itself does not implement
java.io.Serializable
. This works because the Element and
Attribute classes handle serialization of their Namespaces manually.
The classes use the getNamespace() method on deserialization to ensure
there may be only one unique Namespace object for any unique
prefix/uri pair, something needed for efficiency reasons.
Field Summary | |
final static Namespace | NO_NAMESPACE Define a Namespace for when not in a namespace |
final static Namespace | XML_NAMESPACE |
Method Summary | |
boolean | equals(Object ob) This tests for equality - Two Namespaces
are equal if and only if their URIs are byte-for-byte equals
and their prefixes are equal. |
static Namespace | getNamespace(String prefix, String uri) This will retrieve (if in existence) or create (if not) a Namespace for the supplied prefix and URI. |
static Namespace | getNamespace(String uri) This will retrieve (if in existence) or create (if not) a Namespace for the supplied URI, and make it usable
as a default namespace, as no prefix is supplied. |
String | getPrefix() This returns the prefix mapped to this Namespace . |
String | getURI() This returns the namespace URI for this Namespace . |
int | hashCode() This returns a probably unique hash code for the Namespace . |
String | toString() This returns a String representation of this
Namespace , suitable for use in debugging. |
Field Detail |
public final static Namespace NO_NAMESPACE
Namespace
for when not in a namespacepublic final static Namespace XML_NAMESPACE
Method Detail |
public boolean equals(Object ob)
This tests for equality - Two Namespaces
are equal if and only if their URIs are byte-for-byte equals
and their prefixes are equal.
Object
to compare to this Namespace
.boolean
- whether the supplied object is equal to
this Namespace
.public static Namespace getNamespace(String prefix, String uri)
This will retrieve (if in existence) or create (if not) a
Namespace
for the supplied prefix and URI.
Note: Because the prefix of an XML namespace is both
non-normative and not an intrinsic part of the
Namespace
, it is possible that the
supplied uri
is already attached to a
Namespace
, and a different prefix is used by it.
In this case, the existing Namespace
is returned, with the different prefix, and the supplied
prefix
is ignored. This is perfectly legal XML namespace behavior.
String
prefix to map to
Namespace
.String
URI of new Namespace
.Namespace
- ready to use namespace.public static Namespace getNamespace(String uri)
This will retrieve (if in existence) or create (if not) a
Namespace
for the supplied URI, and make it usable
as a default namespace, as no prefix is supplied.
String
URI of new Namespace
.Namespace
- ready to use namespace.public String getPrefix()
This returns the prefix mapped to this Namespace
.
String
- prefix for this Namespace
.public String getURI()
This returns the namespace URI for this Namespace
.
String
- URI for this Namespace
.public int hashCode()
This returns a probably unique hash code for the Namespace
.
If two namespaces have the same URI, they are equal and have the same
hash code, even if they have different prefixes.
int
- hash code for this Namespace
.public String toString()
This returns a String
representation of this
Namespace
, suitable for use in debugging.
String
- information about this instance.Association Links |
to Class java.util.HashMap
to Class org.jdom.Namespace
Namespace
for when not in a namespaceto Class org.jdom.Namespace
to Class java.lang.String
to Class java.lang.String
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |