RE: Cut/Paste from one document to another

Yes, that is right. A document will only accept node that are created using
ist createX operations. This means that you have to clone the node you will
cut and paste, like this pseudo code:

newNode = newDocument.createNode(...);
newNode.setAttribute(oldNode.getAttribute());
...
newDocument.appendChild(newNode);

As you can see this is conseptual code, but the point is that first you
create a new node similar to the old one, but connected to the new document
(although not part of the tree after the createNode statement). Then you
copy all attributes that are copyable, that is attributes that you can set
on the new node, and then you add the new node to your document (makes it
part of the tree)

Sp1

PS! Does someone know whether this has changed in DOM 2.0? I think I have
seen something in the new interfaces in the spec that has this effect
DS!

-----Original Message-----
From: Daniel Glazman [mailto:Daniel.Glazman@der.edf.fr]
Sent: 24. august 1999 10:55
To: www-dom@w3.org
Subject: Cut/Paste from one document to another


Using DOM1, I can't find a way to "cut" a Node from one
document and "paste" it into another one. All methods are
supposed to raise an exception if I try to do that.

Can someone help me ? Thanks !!!

</Daniel>

Received on Tuesday, 24 August 1999 05:13:19 UTC