W3C home > Mailing lists > Public > www-dom@w3.org > July to September 1999

RE: Cut/Paste from one document to another

From: Espen Frimann Koren <efk@objsys.no>
Date: Tue, 24 Aug 1999 11:12:19 +0200
Message-ID: <017C167A392ED211ACE900A0C906AB530AC111@zevs.objsys.no>
To: www-dom@w3.org
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 GMT

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