Name
QName
Synopsis
public class QName implements java.io.Serializable { // Public Constructors public QName( StringlocalPart
); public QName( StringnamespaceURI
, StringlocalPart
); // Public Class Methods public static QName valueOf( Strings
); // Public Instance Methods public String getLocalPart( ); public String getNamespaceURI( ); // Public Methods Overriding Object public final boolean equals( Objectobj
); public final int hashCode( ); public String toString( ); }
This class represents an
XML-qualified name. The two-argument
constructor creates a QName
object with a given
local part and namespace URI. The one-argument constructor creates a
QName
object that does not have an explicitly
specified namespace. An XML element associated with a
QName
that does not have an explicit namespace is
considered to be in the default namespace that is in force for that
element. The URI for the default namespace is determined by an
xmlns
attribute with no associated prefix, placed
either on that element or on one of its ancestors.
The getLocalPart( )
and getNamespaceURI( )
methods return the local part and the namespace URI
associated with the QName
. In the case of a
QName
that does not have a namespace URI, the
latter method returns an empty string. The toString( )
method creates a string representation of the
QName
as follows:
If the name does not have a namespace URI, then the value returned by
toString( )
is just the local part of the name.Otherwise, the value returned is
{URI}localPart
.
Get Java Web Services in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.