Methods Summary |
---|
public int | getLength()
return list.size();
|
public org.w3c.dom.Node | getNamedItem(java.lang.String name)
int i = indexOfItem(name);
return (i == -1 ? null : item(i));
|
public org.w3c.dom.Node | getNamedItemNS(java.lang.String namespaceURI, java.lang.String localName)
int i = indexOfItemNS(namespaceURI, localName);
return (i == -1 ? null : item(i));
|
private int | indexOfItem(java.lang.String name)
for (int i = 0; i < list.size(); i++) {
NodeImpl node = list.get(i);
if (node.matchesName(name, false)) {
return i;
}
}
return -1;
|
private int | indexOfItemNS(java.lang.String namespaceURI, java.lang.String localName)
for (int i = 0; i < list.size(); i++) {
NodeImpl node = list.get(i);
if (node.matchesNameNS(namespaceURI, localName, false)) {
return i;
}
}
return -1;
|
public org.w3c.dom.Node | item(int index)
return list.get(index);
|
public org.w3c.dom.Node | removeNamedItem(java.lang.String name)
int i = indexOfItem(name);
if (i == -1) {
throw new DOMException(DOMException.NOT_FOUND_ERR, null);
}
return list.remove(i);
|
public org.w3c.dom.Node | removeNamedItemNS(java.lang.String namespaceURI, java.lang.String localName)
int i = indexOfItemNS(namespaceURI, localName);
if (i == -1) {
throw new DOMException(DOMException.NOT_FOUND_ERR, null);
}
return list.remove(i);
|
public org.w3c.dom.Node | setNamedItem(org.w3c.dom.Node arg)
// Ensure we only accept nodes of the correct type.
if (!type.isAssignableFrom(arg.getClass())) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null);
}
// All nodes in the map must belong to the same document.
if (list.size() != 0) {
Document document = list.get(0).getOwnerDocument();
if (document != null && arg.getOwnerDocument() != document) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null);
}
}
// TODO Theoretically we should ensure that the nodes don't have a parent.
// if (newAttrImpl.getOwnerElement() != null) {
// throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, null);
// }
int i = indexOfItem(arg.getNodeName());
if (i != -1) {
list.remove(i);
}
list.add((NodeImpl)arg);
return arg;
|
public org.w3c.dom.Node | setNamedItemNS(org.w3c.dom.Node arg)
// Ensure we only accept nodes of the correct type.
if (!type.isAssignableFrom(arg.getClass())) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null);
}
// All nodes in the map must belong to the same document.
if (list.size() != 0) {
Document document = list.get(0).getOwnerDocument();
if (document != null && arg.getOwnerDocument() != document) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, null);
}
}
// TODO Theoretically we should ensure that the nodes don't have a parent.
// if (newAttrImpl.getOwnerElement() != null) {
// throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, null);
// }
int i = indexOfItemNS(arg.getNamespaceURI(), arg.getLocalName());
if (i != -1) {
list.remove(i);
}
list.add((NodeImpl)arg);
return arg;
|