javax.xml.namespace
Class QName
java.lang.Object
javax.xml.namespace.QName
- Serializable
public class QName
extends java.lang.Object
implements Serializable
A
QName
is a qualified name, as specified by
XML Schema Part2: Datatypes specification, Namespaces in XML, Namespaces in XML Errata.
A qualified name is made up of a namespace URI, a local part, and a prefix.
The prefix is not really a part of the
QName
and
remains only to provide lexical information. It is
not
used in the
equals(Object)
or
hashCode()
methods.
Namespace URI and prefix may be omitted, in which case the
default value "" (empty string) is used.
Instances of
QName
are immutable. You may safely
store references.
QName(String pLocalPart) - Creates a new
QName with the given
pLocalPart , the namespace URI "" (empty string),
and the prefix "" (empty string).
|
QName(String pNamespaceURI, String pLocalPart) - Creates a new
QName with the given
pNamespaceURI and pLocalPart .
|
QName(String pNamespaceURI, String pLocalPart, java.lang.String pPrefix) - Creates a new
QName with the given
pNamespaceURI , pLocalPart , and
pPrefix .
|
boolean | equals(Object pOther) - Returns true, if
pOther instanceof QName- getNamespaceURI().equals(pOther.getNamespaceURI())
- getLocalPart().equals(pOther.getLocalPart())
Note: The prefix is ignored.
|
String | getLocalPart() - Returns the local part of the
QName .
|
String | getNamespaceURI() - Returns the namespace URI.
|
String | getPrefix() - Returns the namespace prefix.
|
int | hashCode() - Returns the
QName 's hash code.
|
java.lang.String | toString() - Converts the QName into a string representation.
|
static QName | valueOf(String pQName) - Parses the given string representation of a
pQName .
|
QName
public QName(String pLocalPart)
Creates a new QName
with the given
pLocalPart
, the namespace URI "" (empty string),
and the prefix "" (empty string).
pLocalPart
- The local part.
QName
public QName(String pNamespaceURI,
String pLocalPart)
Creates a new QName
with the given
pNamespaceURI
and pLocalPart
. The
prefix is set to "" (empty string).
pNamespaceURI
- The namespace URI; may be null, in which case
the default value "" (empty string) is used.pLocalPart
- The local part.
QName
public QName(String pNamespaceURI,
String pLocalPart,
java.lang.String pPrefix)
Creates a new QName
with the given
pNamespaceURI
, pLocalPart
, and
pPrefix
.
pNamespaceURI
- The namespace URI; may be null, in which case
the default value "" (empty string) is used.pLocalPart
- The local part.pPrefix
- The prefix. Must not be null. Use "" (empty string)
to indicate that no namespace URI is present or the namespace
URI is not relevant.
equals
public boolean equals(Object pOther)
Returns true, if
pOther
instanceof QName- getNamespaceURI().equals(pOther.getNamespaceURI())
- getLocalPart().equals(pOther.getLocalPart())
Note: The prefix is ignored.
getLocalPart
public String getLocalPart()
Returns the local part of the QName
.
getNamespaceURI
public String getNamespaceURI()
Returns the namespace URI.
- Namespace URI or "" (empty string) to indicate the absence
of a namespace.
getPrefix
public String getPrefix()
Returns the namespace prefix.
- The namespace prefix or "" (empty string) to indicate the
default namespace
hashCode
public int hashCode()
Returns the QName
's hash code.
The prefix is ignored when calculating the hash code.
toString
public java.lang.String toString()
Converts the QName into a string representation. The current
implementation returns the local part, if the namespace URI is
"" (empty string). Otherwise returns "{" + namespaceURI + "}" + localPart.
The prefix is ignored.
The representation is subject to changes, as there is currently no
standard representation for a
QName
. You should use this
method for debugging or logging purposes only.
valueOf
public static QName valueOf(String pQName)
Parses the given string representation of a
pQName
.
The
QName
is expected to have the same representation
than returned by
toString()
.
It is not possible to specify a prefix. The returned
QName
will always have the prefix "" (empty string).
pQName
- String representation of a QName, as generated by
toString()
.
- QName with the prefix "" (empty string)