AttrImplpublic class AttrImpl extends NodeImpl implements AttrProvides a straightforward implementation of the corresponding W3C DOM
interface. The class is used internally only, thus only notable members that
are not in the original interface are documented (the W3C docs are quite
extensive). Hope that's ok.
Some of the fields may have package visibility, so other classes belonging to
the DOM implementation can easily access them while maintaining the DOM tree
structure. |
Fields Summary |
---|
ElementImpl | ownerElement | private boolean | namespaceAware | private String | namespaceURI | private String | localName | private String | prefix | private String | value |
Constructors Summary |
---|
AttrImpl(DocumentImpl document, String namespaceURI, String qualifiedName)
super(document);
namespaceAware = true;
this.namespaceURI = namespaceURI;
if (qualifiedName == null || "".equals(qualifiedName)) {
throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName);
}
int prefixSeparator = qualifiedName.lastIndexOf(":");
if (prefixSeparator != -1) {
setPrefix(qualifiedName.substring(0, prefixSeparator));
qualifiedName = qualifiedName.substring(prefixSeparator + 1);
}
localName = qualifiedName;
if ("".equals(localName)) {
throw new DOMException(DOMException.NAMESPACE_ERR, localName);
}
if ("xmlns".equals(localName) && !"http://www.w3.org/2000/xmlns/".equals(namespaceURI)) {
throw new DOMException(DOMException.NAMESPACE_ERR, localName);
}
if (!document.isXMLIdentifier(localName)) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, localName);
}
value = "";
| AttrImpl(DocumentImpl document, String name)
super(document);
this.namespaceAware = false;
int prefixSeparator = name.lastIndexOf(":");
if (prefixSeparator != -1) {
String prefix = name.substring(0, prefixSeparator);
String localName = name.substring(prefixSeparator + 1);
if (!document.isXMLIdentifier(prefix) || !document.isXMLIdentifier(localName)) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name);
}
} else {
if (!document.isXMLIdentifier(name)) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name);
}
}
this.localName = name;
|
Methods Summary |
---|
public java.lang.String | getLocalName()
return namespaceAware ? localName : null;
| public java.lang.String | getName()
return (prefix != null ? prefix + ":" : "") + localName;
| public java.lang.String | getNamespaceURI()
return namespaceURI;
| public java.lang.String | getNodeName()
return getName();
| public short | getNodeType()
return Node.ATTRIBUTE_NODE;
| public java.lang.String | getNodeValue()
return getValue();
| public org.w3c.dom.Element | getOwnerElement()
return ownerElement;
| public java.lang.String | getPrefix()
return prefix;
| public boolean | getSpecified()
return value != null;
| public java.lang.String | getValue()
return value;
| public void | setNodeValue(java.lang.String value)
setValue(value);
| public void | setPrefix(java.lang.String prefix)
if (!namespaceAware) {
throw new DOMException(DOMException.NAMESPACE_ERR, prefix);
}
if (prefix != null) {
if (namespaceURI == null || !document.isXMLIdentifier(prefix) || "xmlns".equals(prefix)) {
throw new DOMException(DOMException.NAMESPACE_ERR, prefix);
}
if ("xml".equals(prefix) && !"http://www.w3.org/XML/1998/namespace".equals(namespaceURI)) {
throw new DOMException(DOMException.NAMESPACE_ERR, prefix);
}
}
this.prefix = prefix;
| public void | setValue(java.lang.String value)
this.value = value;
|
|