Skip to main content

import a node/subtree to any node from distinct document

No replies
Joined: 2010-08-26


I trying to import a node- subtree into another noder from one document to another.

If I insert in a document node , there is no problem but when I tried to import in a node not document an error is reported (

WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.)

I saw in other list the following post but no response

we could use importNode() to copy a node of

subtree from one document to another. However, this method only comes with

the Document interface which refers to the root of a document. If i want

to insert a node/subtree to any node in the DOM tree, how to do that? The

Node interface doesn't have this method to support node copy.

Btw, is there any way to change the owner of the document?

Can anybody help me ?