# generate SVG with java



## mern (10. Apr 2006)

Hi all!

I want to generate and manipulate a SVG-file with Java, accoding to analyzed data from another java program. Should i see a SVG-file as a normal xml-file und do the task with normal DOM, or with Batik Toolkit from Apache? I tried to use Batik, but his Java Doc ist to bad, there are no informations about the classes and his fields and methods, so that i can't understand them. For example, what does this class "SVGPathSegArcRel" mean and how can i use it?

So i think, it is probably to use the normal DOM-Schnittstelle to generate an d manipulate the SVG, as SVG is XML-file. Is that correct? Or could someone give me any tipps?

Thanks in advance!

Di


----------



## mern (10. Apr 2006)

SVG knowledge is the foundation and i have already got basic knowledge about SVG. But the problem is that there are still a lot of classes in Batik, that i can't understand und i can't get a good overview about the useful classes for my need (for example there are over 100 classes only in the package org.apache.batik.dom.svg).

Because of that i want to know if there are any advantages to use Batik? Is it much more efficient and easier to generate and manipulate SVG with Batik than with generic DOM? Is it with more complexity to use generic one in compare to Batik?


----------



## AlArenal (11. Apr 2006)

I only used Batik once to test something (integrating an SVG into a graph app). I played around a little bit with modifying its XML, re-rasterize and redraw it which worked fine for me.
I used DOM to achieve this. Taking a quick glimpse at the documentation I would say that this is also the intended way of dynamically creating SVG. If you only had to transform Java2D into SVG you'd be better off using the generator, but as I understood you want to create standard compliant SVG by yourself. 

It may be useful to you to search the net for SVG editors based on Batik to get an idea of how others use it. 

http://www.buildap.com/Subprojects/netbeans


----------

