|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.xml.namespace.QName
public class QName
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.
Constructor Summary | |
---|---|
QName(java.lang.String pLocalPart)
Creates a new QName with the given
pLocalPart , the namespace URI "" (empty string),
and the prefix "" (empty string). |
|
QName(java.lang.String pNamespaceURI,
java.lang.String pLocalPart)
Creates a new QName with the given
pNamespaceURI and pLocalPart . |
|
QName(java.lang.String pNamespaceURI,
java.lang.String pLocalPart,
java.lang.String pPrefix)
Creates a new QName with the given
pNamespaceURI , pLocalPart , and
pPrefix . |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object pOther)
Returns true, if pOther instanceof QName
getNamespaceURI().equals(pOther.getNamespaceURI())
getLocalPart().equals(pOther.getLocalPart())
Note: The prefix is ignored. |
java.lang.String |
getLocalPart()
Returns the local part of the QName . |
java.lang.String |
getNamespaceURI()
Returns the namespace URI. |
java.lang.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(java.lang.String pQName)
Parses the given string representation of a pQName . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public QName(java.lang.String pNamespaceURI, java.lang.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.
java.lang.IllegalArgumentException
- The local part was null.public QName(java.lang.String pNamespaceURI, java.lang.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.
java.lang.IllegalArgumentException
- The local part or the prefix was null.public QName(java.lang.String pLocalPart)
Creates a new QName
with the given
pLocalPart
, the namespace URI "" (empty string),
and the prefix "" (empty string).
pLocalPart
- The local part.
java.lang.IllegalArgumentException
- The local part or the prefix was null.Method Detail |
---|
public java.lang.String getNamespaceURI()
Returns the namespace URI.
public java.lang.String getLocalPart()
Returns the local part of the QName
.
public java.lang.String getPrefix()
Returns the namespace prefix.
public boolean equals(java.lang.Object pOther)
Returns true, if
pOther
instanceof QName
equals
in class java.lang.Object
public int hashCode()
Returns the QName
's hash code.
The prefix is ignored when calculating the hash code.
hashCode
in class java.lang.Object
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.
toString
in class java.lang.Object
public static QName valueOf(java.lang.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()
.
java.lang.IllegalArgumentException
- The given pQName
was null or empty.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |