xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tracey Zellmann" <tracey.zellm...@comcast.net>
Subject Re: Making a copy of an SVG Document in memory
Date Tue, 07 Feb 2006 01:05:41 GMT
Thank you very much! That was exactly what I was looking for. 


----- Original Message ----- 
From: "Cameron McCormack" <cam-batik-users@aka.mcc.id.au>
To: <batik-users@xmlgraphics.apache.org>
Sent: Monday, February 06, 2006 7:56 PM
Subject: Re: Making a copy of an SVG Document in memory


> Hi Tracey.
> 
> Tracey Zellmann:
>> I want to make deep copies of an SVG document that has been read into
>> memory.What is an efficient idiom for doing this - rather than reading
>> the image in repeatedly from file? My application has several sets of
>> data. Each set will be mapped onto the same SVG image and then printed
>> out in a PDF report.
> 
> If you want to make copies of the document so you can change each one,
> you can use create a new document and then use Node.importNode to copy
> the content across (untested):
> 
>  Document doc = ...;   // your original document
>  DOMImplementation impl = doc.getDOMImplementation();
>  Document doc2;        // your new document
>  doc2 = impl.createDocument("http://www.w3.org/2000/svg", "svg", null);
>  doc2.replaceChild(doc2.importNode(doc.getDocumentElement(), true),
>                    doc2.getDocumentElement());
> 
> -- 
> Cameron McCormack ICQ: 26955922
> cam (at) mcc.id.au MSN: cam (at) mcc.id.au
> http://mcc.id.au/ JBR: heycam (at) jabber.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
>


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message