Methods Summary |
---|
public java.lang.String | getAttribute(java.lang.String name)
Attr attr = getAttributeNode(name);
if (attr == null) {
return "";
}
return attr.getValue();
|
public java.lang.String | getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
Attr attr = getAttributeNodeNS(namespaceURI, localName);
if (attr == null) {
return "";
}
return attr.getValue();
|
public org.w3c.dom.Attr | getAttributeNode(java.lang.String name)
int i = indexOfAttribute(name);
if (i == -1) {
return null;
}
return attributes.get(i);
|
public org.w3c.dom.Attr | getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
int i = indexOfAttributeNS(namespaceURI, localName);
if (i == -1) {
return null;
}
return attributes.get(i);
|
public org.w3c.dom.NamedNodeMap | getAttributes()
return new ElementAttrNamedNodeMapImpl();
|
org.w3c.dom.Element | getElementById(java.lang.String name)
if (name.equals(getAttribute("id"))) {
return this;
}
for (NodeImpl node : children) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element = ((ElementImpl) node).getElementById(name);
if (element != null) {
return element;
}
}
}
return null;
|
public org.w3c.dom.NodeList | getElementsByTagName(java.lang.String name)
NodeListImpl list = new NodeListImpl();
getElementsByTagName(list, name);
return list;
|
void | getElementsByTagName(NodeListImpl list, java.lang.String name)
if (matchesName(name, true)) {
list.add(this);
}
for (NodeImpl node : children) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
((ElementImpl) node).getElementsByTagName(list, name);
}
}
|
public org.w3c.dom.NodeList | getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
NodeListImpl list = new NodeListImpl();
getElementsByTagNameNS(list, namespaceURI, localName);
return list;
|
void | getElementsByTagNameNS(NodeListImpl list, java.lang.String namespaceURI, java.lang.String localName)
if (matchesNameNS(namespaceURI, localName, true)) {
list.add(this);
}
for (NodeImpl node : children) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
((ElementImpl) node).getElementsByTagNameNS(list, namespaceURI,
localName);
}
}
|
public java.lang.String | getLocalName()
return namespaceAware ? localName : null;
|
public java.lang.String | getNamespaceURI()
return namespaceURI;
|
public java.lang.String | getNodeName()
return getTagName();
|
public short | getNodeType()
return Node.ELEMENT_NODE;
|
public java.lang.String | getPrefix()
return prefix;
|
public java.lang.String | getTagName()
return (prefix != null ? prefix + ":" : "") + localName;
|
public boolean | hasAttribute(java.lang.String name)
return indexOfAttribute(name) != -1;
|
public boolean | hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
return indexOfAttributeNS(namespaceURI, localName) != -1;
|
public boolean | hasAttributes()
return !attributes.isEmpty();
|
private int | indexOfAttribute(java.lang.String name)
for (int i = 0; i < attributes.size(); i++) {
AttrImpl attr = attributes.get(i);
if (attr.matchesName(name, false)) {
return i;
}
}
return -1;
|
private int | indexOfAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
for (int i = 0; i < attributes.size(); i++) {
AttrImpl attr = attributes.get(i);
if (attr.matchesNameNS(namespaceURI, localName, false)) {
return i;
}
}
return -1;
|
public void | removeAttribute(java.lang.String name)
int i = indexOfAttribute(name);
if (i != -1) {
attributes.remove(i);
}
|
public void | removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
int i = indexOfAttributeNS(namespaceURI, localName);
if (i != -1) {
attributes.remove(i);
}
|
public org.w3c.dom.Attr | removeAttributeNode(org.w3c.dom.Attr oldAttr)
AttrImpl oldAttrImpl = (AttrImpl) oldAttr;
if (oldAttrImpl.getOwnerElement() != this) {
throw new DOMException(DOMException.NOT_FOUND_ERR, null);
}
attributes.remove(oldAttr);
oldAttrImpl.ownerElement = null;
return oldAttrImpl;
|
public void | setAttribute(java.lang.String name, java.lang.String value)
Attr attr = getAttributeNode(name);
if (attr == null) {
attr = document.createAttribute(name);
setAttributeNode(attr);
}
attr.setValue(value);
|
public void | setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value)
Attr attr = getAttributeNodeNS(namespaceURI, qualifiedName);
if (attr == null) {
attr = document.createAttributeNS(namespaceURI, qualifiedName);
setAttributeNodeNS(attr);
}
attr.setValue(value);
|
public org.w3c.dom.Attr | setAttributeNode(org.w3c.dom.Attr newAttr)
AttrImpl newAttrImpl = (AttrImpl) newAttr;
if (newAttrImpl.document != this.getOwnerDocument()) {
throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null);
}
if (newAttrImpl.getOwnerElement() != null) {
throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, null);
}
AttrImpl oldAttrImpl = null;
int i = indexOfAttribute(newAttr.getName());
if (i != -1) {
oldAttrImpl = attributes.get(i);
attributes.remove(i);
}
attributes.add(newAttrImpl);
newAttrImpl.ownerElement = this;
return oldAttrImpl;
|
public org.w3c.dom.Attr | setAttributeNodeNS(org.w3c.dom.Attr newAttr)
AttrImpl newAttrImpl = (AttrImpl) newAttr;
if (newAttrImpl.document != this.getOwnerDocument()) {
throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, null);
}
if (newAttrImpl.getOwnerElement() != null) {
throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, null);
}
AttrImpl oldAttrImpl = null;
int i = indexOfAttributeNS(newAttr.getNamespaceURI(), newAttr.getLocalName());
if (i != -1) {
oldAttrImpl = attributes.get(i);
attributes.remove(i);
}
attributes.add(newAttrImpl);
newAttrImpl.ownerElement = this;
return oldAttrImpl;
|
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)) {
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;
|