public Node cloneNode(boolean deep) { IIOMetadataNode newnode = new IIOMetadataNode(name); newnode.parent = null; newnode.obj = obj; if (deep) { for (int i=0; i < children.size(); i++) newnode.children.add(((Node)children.get(i)).cloneNode(deep)); } // clone attrs for (Iterator it = attrs.values().iterator(); it.hasNext();) { IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr)it.next(); newnode.attrs.put(attr.name, attr.cloneNode(deep)); attr.owner = newnode; } return newnode; }
public Node setNamedItem(Node arg) throws DOMException { if (arg instanceof IIOMetadataNodeAttr) { IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr) arg; // The only code that can successfully do this is in this package. if (attr.owner != null) throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, ""); return (Node)attrs.put(attr.name, attr); } // Anything else gets treated as an invalid op. throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, ""); }
public Attr getAttributeNode(String name) { String val = getAttribute(name); if (val != null) return new IIOMetadataNodeAttr(this, name, val); return null; }
public void setAttribute(String name, String value) { Attr attr = getAttributeNode(name); if (attr != null) attr.setValue(value); else attrs.put(name, new IIOMetadataNodeAttr(this, name, value)); }