

Copying a node from one doc to another

From: Eric Richardson <maxwell@telesoft.com>
Date: Tue, 14 Mar 2000 12:33:04 -0700
Message-ID: <38CE93F0.72D37176@telesoft.com>
To: DOM <www-dom@w3.org>
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?

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