xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Archie Cobbs <arc...@dellroad.org>
Subject Re: idea to show modified source in Batik
Date Thu, 10 Feb 2005 15:43:20 GMT
Andreas Neumann wrote:
> ASV, however, has one useful feature (available through an XML 
> processing instruction) that is currently not available on Batik: to 
> save the current state of the DOM to a new SVG file. Yes, there is the 
> DOM viewer to see the current DOM, but in some cases, it would be useful 
> to get the full modified DOM and to be able to save it to a file again.

Interesting.. we added this feature to our application's "debug menu"
and it has proven very useful. The implementation is easy, something
like:

         JSVGCanvas canvas = ...
         File file = ...

         canvas.getUpdateManager().getUpdateRunnableQueue().invokeAndWait(
             new Runnable() {
                 public void run() {
                     try {
                         TransformerFactory.newInstance().newTransformer()
                           .transform(
                             new DOMSource(canvas.getSVGDocument()),
                             new StreamResult(file));
                     } catch (Throwable t) {
                         t.printStackTrace().
                     }
                 }
             }
         );

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


*
Confidentiality Notice: This e-mail message, including any attachments, is for the sole use
of the intended recipient(s) and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies of the original
message.
*


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


Mime
View raw message