Copying a node from one doc to another

Hi,
I have a template in one XML doc. I want to retrieve an Element from
that template and insert it into the another Document I am working on in
the DOM.

I have verified that the Nodes have the correct parent so I can call
appendChild() but I am getting the following exception.

Exception in thread "main" com.sun.xml.tree.DomEx: That node doesn't
belong in this document.
 at com.sun.xml.tree.ParentNode.checkDocument(ParentNode.java:264)
 at com.sun.xml.tree.ParentNode.appendChild(ParentNode.java:347)

This error code is DOMException.WRONG_DOCUMENT_ERR.
I tried both cloneNode(true) and without cloning the Element. When I
clone, the parentNode is
null as it should be.

Does this have to do with the DocumentOwner property?

How can I get around this error?

Thanks,
Eric

Received on Tuesday, 14 March 2000 14:35:12 UTC