QNamepublic class QName extends Object implements CloneableA structure that holds the components of an XML Namespaces qualified
name.
To be used correctly, the strings must be identical references for
equal strings. Within the parser, these values are considered symbols
and should always be retrieved from the SymbolTable . |
Fields Summary |
---|
public String | prefixThe qname prefix. For example, the prefix for the qname "a:foo"
is "a". | public String | localpartThe qname localpart. For example, the localpart for the qname "a:foo"
is "foo". | public String | rawnameThe qname rawname. For example, the rawname for the qname "a:foo"
is "a:foo". | public String | uriThe URI to which the qname prefix is bound. This binding must be
performed by a XML Namespaces aware processor. |
Constructors Summary |
---|
public QName()Default constructor.
clear();
| public QName(String prefix, String localpart, String rawname, String uri)Constructs a QName with the specified values.
setValues(prefix, localpart, rawname, uri);
| public QName(QName qname)Constructs a copy of the specified QName.
setValues(qname);
|
Methods Summary |
---|
public void | clear()Clears the values of the qname components.
prefix = null;
localpart = null;
rawname = null;
uri = null;
| public java.lang.Object | clone()Returns a clone of this object.
return new QName(this);
| public boolean | equals(java.lang.Object object)Returns true if the two objects are equal.
if (object instanceof QName) {
QName qname = (QName)object;
if (qname.uri != null) {
return uri == qname.uri && localpart == qname.localpart;
}
else if (uri == null) {
return rawname == qname.rawname;
}
// fall through and return not equal
}
return false;
| public int | hashCode()Returns the hashcode for this object.
if (uri != null) {
return uri.hashCode() +
((localpart != null) ? localpart.hashCode() : 0);
}
return (rawname != null) ? rawname.hashCode() : 0;
| public void | setValues(org.apache.xerces.xni.QName qname)Convenience method to set the values of the qname components.
prefix = qname.prefix;
localpart = qname.localpart;
rawname = qname.rawname;
uri = qname.uri;
| public void | setValues(java.lang.String prefix, java.lang.String localpart, java.lang.String rawname, java.lang.String uri)Convenience method to set the values of the qname components.
this.prefix = prefix;
this.localpart = localpart;
this.rawname = rawname;
this.uri = uri;
| public java.lang.String | toString()Returns a string representation of this object.
StringBuffer str = new StringBuffer();
boolean comma = false;
if (prefix != null) {
str.append("prefix=\"").append(prefix).append('"");
comma = true;
}
if (localpart != null) {
if (comma) {
str.append(',");
}
str.append("localpart=\"").append(localpart).append('"");
comma = true;
}
if (rawname != null) {
if (comma) {
str.append(',");
}
str.append("rawname=\"").append(rawname).append('"");
comma = true;
}
if (uri != null) {
if (comma) {
str.append(',");
}
str.append("uri=\"").append(uri).append('"");
}
return str.toString();
|
|