org.apache.xerces.xni
public class: QName [javadoc |
source]
java.lang.Object
org.apache.xerces.xni.QName
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
XQName
A 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.
| Field Summary |
|---|
| public String | prefix | The qname prefix. For example, the prefix for the qname "a:foo"
is "a". |
| public String | localpart | The qname localpart. For example, the localpart for the qname "a:foo"
is "foo". |
| public String | rawname | The qname rawname. For example, the rawname for the qname "a:foo"
is "a:foo". |
| public String | uri | The URI to which the qname prefix is bound. This binding must be
performed by a XML Namespaces aware processor. |
| Method from org.apache.xerces.xni.QName Detail: |
public void clear() {
prefix = null;
localpart = null;
rawname = null;
uri = null;
}
Clears the values of the qname components. |
public Object clone() {
return new QName(this);
}
Returns a clone of this object. |
public boolean equals(Object object) {
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;
}
Returns true if the two objects are equal. |
public int hashCode() {
if (uri != null) {
return uri.hashCode() +
((localpart != null) ? localpart.hashCode() : 0);
}
return (rawname != null) ? rawname.hashCode() : 0;
}
Returns the hashcode for this object. |
public void setValues(QName qname) {
prefix = qname.prefix;
localpart = qname.localpart;
rawname = qname.rawname;
uri = qname.uri;
}
Convenience method to set the values of the qname components. |
public void setValues(String prefix,
String localpart,
String rawname,
String uri) {
this.prefix = prefix;
this.localpart = localpart;
this.rawname = rawname;
this.uri = uri;
}
Convenience method to set the values of the qname components. |
public String toString() {
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();
}
Returns a string representation of this object. |