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

Re: Cut/Paste from one document to another

From: Daniel Glazman <Daniel.Glazman@der.edf.fr>
Date: Tue, 24 Aug 1999 11:26:05 +0200
Message-ID: <37C2652D.E5451161@der.edf.fr>
To: Espen Frimann Koren <efk@objsys.no>
CC: www-dom@w3.org
Espen Frimann Koren wrote:

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

Thanks for that answer. I have to say that this is really a bad surprise.
XML well-formed documents provide an easy way of fragment manipulation and
encapsulation into other XML w-f documents but DOM1 does not allow that :-(
In that case, DOM1 cannot be easily used out of the browser world, manipulating
one document only at a time.

> 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

I hope you are right !!!!

</Daniel>
Received on Tuesday, 24 August 1999 05:26:57 GMT

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