Hi,
This might not be the cleanest or best way, but I
sometimes need to create new Documents from fragments
other documents, the operation is pretty much the same
as what you need:
//first create an empty document:
        DocumentBuilderFactory dbf =     
DocumentBuilderFactory.newInstance()        
Document clone = dbf.newDocumentBuilder(
).newDocument( );
// import the document element or the node you are
cloning
clone.importNode(docToClone.getDocumentElement( ),
true);
clone.appendChile(docToClone.getDocumentElement( ));


--- Jean Georges PERRIN <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I'd like to clone a Document and all its subnodes.
> Is there a quick method
> to do so or do I need to do it manual or even to
> reparse the whole tree?
> 
> I'd like something like:
> Document myDoc = mySourceDoc.clone();
> 
> myDoc could be modified in any way without altering
> mySourceDoc. Of course,
> the API could be named differently or it could go
> through a Builder...
> 
> Thanks for any help...
> 
> Jean Georges PERRIN
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

Reply via email to