xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Douthart <charles.douth...@trifolium.com>
Subject Re: DOM Problems
Date Wed, 20 Sep 2000 11:58:12 GMT


Michael,

You must first import the node into the destination document. See the
docs for org.w3c.dom.Document

Node importedNode = targetDocument.importNode(sourceDocumentNode,true);
targetDocument.appendChild(importedNode);


-charles douthart-


Michael Kraus wrote:
> 
> Hello,
> 
> I'm experiencing a problem with the DOM (I'm using the Xerces-J DOM
> implementation). I'm writing a kind of XML editor where the user is able
> to select and copy nodes from one document tree and paste is into
> another. But when I try to add the copied nodes to the new document
> tree, I receive the following exception:
> 
> org.apache.xerces.dom.DOMExceptionImpl: DOM005 Wrong document
> 
> I use some code like this:
> 
> targetDocument.appendChild(sourceDocumentNode.cloneNode(true));
> 
> How can I copy nodes from one document to another? Is there any solution
> within the DOM or within Xerces?
> 
> Michael
> 
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org

-- 
----------------------------------------
Charles Douthart
Trifolium, Inc
(919)854-4920 x264
charles.douthart@trifolium.com

Mime
View raw message