public final class QName extends java.lang.Object implements XMLSerializable, Immutable, java.lang.CharSequence
This class represents unique identifiers for XML elements (tags) or attributes (names).
It should be noted that QName.valueOf(null, "name") and
QName.valueOf("", "name") are distinct; the first one has no
namespace associated with; whereas the second is associated
to the root namespace.
QName have a textual representation (CharSequence) which
is either the local name (if no namespace URI) or
{namespaceURI}localName (otherwise).
| Modifier and Type | Method and Description |
|---|---|
char |
charAt(int index)
Returns the character at the specified index.
|
boolean |
equals(java.lang.Object obj)
Instances of this class are unique; object's equality can be
replaced object identity (
==). |
java.lang.CharSequence |
getLocalName()
Returns the local part of this qualified name or the full qualified
name if there is no namespace.
|
java.lang.CharSequence |
getNamespaceURI()
Returns the namespace URI of this qualified name or
null
if none (the local name is then the full qualified name). |
int |
hashCode()
Returns the hash code for this qualified name.
|
int |
length()
Returns the length of this character sequence.
|
java.lang.CharSequence |
subSequence(int start,
int end)
Returns a new character sequence that is a subsequence of this sequence.
|
java.lang.String |
toString()
Returns the
String representation of this qualified name. |
static QName |
valueOf(java.lang.CharSequence name)
Returns the qualified name corresponding to the specified character
sequence representation (may include the "{namespaceURI}" prefix).
|
static QName |
valueOf(java.lang.CharSequence namespaceURI,
java.lang.CharSequence localName)
Returns the qualified name corresponding to the specified namespace URI
and local name.
|
static QName |
valueOf(java.lang.String name)
Equivalent to
valueOf(CharSequence) (for J2ME compatibility). |
public static QName valueOf(java.lang.CharSequence name)
name - the qualified name lexical representation.toString()public static QName valueOf(java.lang.String name)
valueOf(CharSequence) (for J2ME compatibility).name - the qualified name lexical representation.toString()public static QName valueOf(java.lang.CharSequence namespaceURI, java.lang.CharSequence localName)
namespaceURI - the URI reference or null if none.localName - the local name.toString()public java.lang.CharSequence getLocalName()
public java.lang.CharSequence getNamespaceURI()
null
if none (the local name is then the full qualified name).nullpublic boolean equals(java.lang.Object obj)
==).equals in class java.lang.Objectthis == objpublic java.lang.String toString()
String representation of this qualified name.toString in interface java.lang.CharSequencetoString in class java.lang.Objectpublic int hashCode()
Note: Returns the same hashCode as java.lang.String
(consistent with equals(java.lang.Object))
hashCode in class java.lang.Objectpublic char charAt(int index)
charAt in interface java.lang.CharSequenceindex - the index of the character starting at 0.java.lang.IndexOutOfBoundsException - if ((index < 0) ||
(index >= length))public int length()
length in interface java.lang.CharSequencepublic java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequencestart - the index of the first character inclusive.end - the index of the last character exclusive.start position and ending just before the specified
end position.java.lang.IndexOutOfBoundsException - if (start < 0) || (end < 0) ||
(start > end) || (end > this.length())Copyright © 2005 - 2007 Javolution.