Hi! I'm starting working on a Batik application and I have a few questions I'm hoping someone can answer (or at least point me in the right direction so I find my own).
I'm trying to write an app that loads an existing SVG, adds to it, and then saves it out. So far I've taken and modified the JSVGCanvas example from the Batik homepage: I have a swing app that has a button for loading an SVG (it uses the demo code for all this). I added a save button as well, thinking that it would be a good idea to first get that figured out. After trying a couple of things (like trying to pass svgCanvas.getSVGDocument() to an SVGGraphics2D object and stream that out -- no go, I get a blank SVG), I happened across an example in the mailing list archives using org.apache.batik.dom.util.DOMUtilities' writeDocument() method. While this does create a valid SVG document based off the loaded one, it saves it out in an odd manner: no end of lines! The result is that not even the Batik loader can read it back in, even if the SVG renderer in my browser (Adobe SVG Viewer) can. So my first question is: how can I save out the contents of the JSVGCanvas is such a way that it's readable? Now, as I said, I'm trying to write an app that reads in an SVG, *modifies* it (read: adds to it) and saves it out. So using the DOMUtilities may not be the way to go. The reason I tried the SVGGraphics2D manner first was because if that had worked, I thought I could use the SVGGraphics2D methods to paint on my new SVG objects, stream it out and be happy. Now complicate this by adding in that I need to be able to add some custom object attributes to my added SVG objects. Given that I'm not even sure if I should be using SVGGraphics2D, assuming I *can*. I may need to be manipulating the DOM tree directly, though I'm hoping there's an easier way to do this, hopefully by something along the lines of the SVGGeneratorContext example from the site (that used the setAttributeNS() method). At any rate, I've been trying various methods without too much success so far, so I'm hoping someone out there on this list will take pity on me and lend me a hand :) Thanks in advance! Wood Shavings! - Andrew --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
