/** * Call user data handlers when a node is deleted (finalized) * @param n The node this operation applies to. * @param c The copy node or null. * @param operation The operation - import, clone, or delete. */ protected void callUserDataHandlers(Node n, Node c, short operation) { if (userData == null) { return; } //Hashtable t = (Hashtable) userData.get(n); if(n instanceof NodeImpl){ Hashtable t = ((NodeImpl)n).getUserDataRecord(); if (t == null || t.isEmpty()) { return; } callUserDataHandlers(n, c, operation,t); } }
/** * Deep-clone a document, including fixing ownerDoc for the cloned * children. Note that this requires bypassing the WRONG_DOCUMENT_ERR * protection. I've chosen to implement it by calling importNode * which is DOM Level 2. * * @return org.w3c.dom.Node * @param deep boolean, iff true replicate children */ public Node cloneNode(boolean deep) { CoreDocumentImpl newdoc = new CoreDocumentImpl(); callUserDataHandlers(this, newdoc, UserDataHandler.NODE_CLONED); cloneNode(newdoc, deep); return newdoc; } // cloneNode(boolean):Node
ownerDocument().callUserDataHandlers(this, newnode, UserDataHandler.NODE_CLONED);
((ElementNSImpl) el).rename(namespaceURI, name); callUserDataHandlers(el, null, UserDataHandler.NODE_RENAMED); el.rename(name); callUserDataHandlers(el, null, UserDataHandler.NODE_RENAMED); callUserDataHandlers(at, null, UserDataHandler.NODE_RENAMED); callUserDataHandlers(at, null, UserDataHandler.NODE_RENAMED); callUserDataHandlers(at, nat, UserDataHandler.NODE_RENAMED);
callUserDataHandlers(el, nel, UserDataHandler.NODE_RENAMED);
callUserDataHandlers(source, newnode, UserDataHandler.NODE_IMPORTED,userData);
callUserDataHandlers(source, null, UserDataHandler.NODE_ADOPTED,userData);