Re: Copying from one DOM to another

Hi, Juan,

As far as I know, XercesJ as well as XML4J parser have adoptNode()
function which allows to move a node from one document to another. I
believe you should first use Document.importNode() to get a copy of your
node and when use DocumentImpl.adoptNode() to actually move a node to a
DOM tree.

Please, note that adoptNode() is still in 'experimental' stage (it might
be available in DOM Level 3) so adoptNode() might fail (depending on the
content). But you should at least try it out .. 

Hope it helps.
Elena


"Juan J. Merelo" wrote:
> 
> Hi,
>     I'm trying to convert a document from the org.w3c.tidy.dom format to the
> org.apache.xerces.dom format, and I can't find the way. The only thing I
> have found is that it should be possible with DOM 2.0 implementation, but,
> as things are now, what would be the easiest and more direct way of
> converting nodes from one implementation to another? I have tried deep copy,
> node-by-node copy, and no way. I get runtime or compilation errors. Any
> hint?
> 
> Name: Juan J. Merelo
> Title: Consultant
> Civista
> Telephone:   +44 (0) 20 84086.....
> Mobile:        +34 627 397239
> Facsimile:    +44 (0) 20 84086399
> Email:jj.merelo@civista.com
> http://www.civista.com
> 
> Services and Applications for a Wireless World
> This e-mail and the information that it contains may be confidential and
> protected by law and is for access by the intended recipient only. Any
> liability (in negligence or otherwise) arising from any third party acting,
> or refraining from acting, on any information contained in this e-mail is
> hereby excluded. If you are not the intended recipient, please notify the
> sender immediately and do not disclose the contents to any other person, use
> it for any purpose, or store or copy the information in any medium.
> Copyright in this e-mail and any attachments belongs to Civista Limited
> and/or its subsidiary companies.
> While this message is virus checked, Civista can not be held responsible for
> its integrity.

Received on Tuesday, 7 November 2000 10:17:46 UTC