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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to