W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2000

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>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT