I am having trouble appending a document fragment from one
document to a different document. In the following code, I
am trying to append all the children of document r to document
s. It fails with

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

Here is the code:

Range rdf = ((DocumentImpl)r).createRange();
rdf.setStartBefore(r.getLastChild());
rdf.setEndAfter(r.getLastChild());
DocumentFragment df= rdf.extractContents(); // doesn't this allow the document fragment s.getFirstChild().appendChild(df); // to be appended to a different document?


Your assistance would be greatly appreciated.

Incidentally, I can disable the error by modifying the code in CoreDocumentImpl.java, but
I would prefer to use the library in the manner which was intended.

Ron Addie.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to