public final class QName extends Object implements XMLSerializable, Immutable<QName>, 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(Object obj)
Instances of this class are unique; object's equality can be
replaced object identity (
==). |
CharSequence |
getLocalName()
Returns the local part of this qualified name or the full qualified
name if there is no namespace.
|
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.
|
CharSequence |
subSequence(int start,
int end)
Returns a new character sequence that is a subsequence of this sequence.
|
String |
toString()
Returns the
String representation of this qualified name. |
QName |
value()
Returns the constant value held by this object.
|
static QName |
valueOf(CharSequence name)
Returns the qualified name corresponding to the specified character
sequence representation (may include the "{namespaceURI}" prefix).
|
static QName |
valueOf(CharSequence namespaceURI,
CharSequence localName)
Returns the qualified name corresponding to the specified namespace URI
and local name.
|
static QName |
valueOf(String name)
Equivalent to
valueOf(CharSequence) (for J2ME compatibility). |
public static QName valueOf(CharSequence name)
name - the qualified name lexical representation.toString()public static QName valueOf(String name)
valueOf(CharSequence) (for J2ME compatibility).name - the qualified name lexical representation.toString()public static QName valueOf(CharSequence namespaceURI, CharSequence localName)
namespaceURI - the URI reference or null if none.localName - the local name.toString()public CharSequence getLocalName()
public CharSequence getNamespaceURI()
null
if none (the local name is then the full qualified name).nullpublic boolean equals(Object obj)
==).public String toString()
String representation of this qualified name.toString in interface CharSequencetoString in class Objectpublic int hashCode()
Note: Returns the same hashCode as java.lang.String
(consistent with equals(java.lang.Object))
public char charAt(int index)
charAt in interface CharSequenceindex - the index of the character starting at 0.IndexOutOfBoundsException - if ((index < 0) ||
(index >= length))public int length()
length in interface CharSequencepublic CharSequence subSequence(int start, int end)
subSequence in interface 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.IndexOutOfBoundsException - if (start < 0) || (end < 0) ||
(start > end) || (end > this.length())Copyright © 2005-2013 Javolution. All Rights Reserved.