Hi Cameron,
 
This is precisely what I was looking for.  Since I'm going to be using a 
JSVGCanvas for display, it doesn't sound like I need to do anything; just use 
setDocument(...) and let it do the work.  Cloning will be fine; this is 
essentially report generation, so I'll be calling it once per report.
 
I even checked DOMUtilities but didn't realize it could be used that way.  That 
class has answered quite a few of my problems.  I was afraid I'd have to go to 
a String then reparse the document, but this will work nicely.
 
Michael

________________________________

From: Cameron McCormack [mailto:[email protected]]
Sent: Wed 4/22/2009 8:26 PM
To: [email protected]
Subject: Re: org.w3c.dom.Document -> SVGDocument



Hi Michael.

Bishop, Michael W. CTR USJFCOM JFL:
> I have a lightweight API that creates a Document that contains SVG. It
> uses Java's core DOM model. I'm going to start working on a UI that
> displays this information. The API doesn't rely on Batik and I don't
> want it to have to in order to keep it small. It basically just puts
> supplied information into a template to produce its output. The UI,
> of course, will use Batik to display the content. Is there a way to
> easily go from the Document produced by the API to an SVGDocument that
> can be used with Batik UI components?

You'll need to clone the whole document as Batik's DOM objects for it
to work in the JSVGCanvas.  The JSVGComponent.setDocument() method will
do that if you pass in a Document object that isn't an SVGOMDocument,
but you can do it yourself with the same code that's in that method:

  Document myNonBatikDOMDocument = ...;
  Document myBatikDOMDocument = DOMUtilities.deepCloneDocument
    (myNonBatikDOMDocument, SVGDOMImplementation.getDOMImplementation());

--
Cameron McCormack ? http://mcc.id.au/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



<<winmail.dat>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to