You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by "Judd, Chris" <cj...@rpaworldwide.com> on 2000/02/16 20:24:06 UTC

Copy DOM elements

Is there a reason to prevent the coping of elements from one DOM to another?

I would like to be able to deep copy a DOM element from one DOM to another
DOM.  When I attempt to do :

((DocumentImpl)docOne).setErrorChecking(false);
((DocumentImpl)docTwo).setErrorChecking(false);

Node newNode = docTwo.getFirstChild().cloneNode(true);
docOne.getFirstChild().appendChild(newNode);

I get a org.apache.xerces.dom.DOMExceptionImpl: WRONG_DOCUMENT_ERR.  I
expected the setErrorChecking with a false parameter to prevent the
ownerDocument check.