Hi,
I would like to add some new elements (<title> and <description>)before I generate the xml file using the SVGGraphics2D.
A desired output would be:
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg >
<title>Title for the generated image</title>
<desc>Image description</desc>
<!--Generated by the Batik Graphics2D SVG Generator-->
    <defs id="genericDefs" />
        <g />
        //... generated image contents
        <g />
</svg>
I  have tried using the getRoot() method from the SVGGraphics2D class, added some elements and tried to generate the svg file, but the codes to describe the images just disappeared and became empty tags. I haven't got any idea how to resolve the problem and why it happens this way. Can someone who has solved this problem before provide some help? 
 
The resultant code i got after manipulating the Element I get from the getRoot() method was:
 
<?xml version="1.0" encoding="UTF-8"?>
 
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg xmlns="http://www.w3.org/2000/svg" width="591" xmlns:xlink="http://www.w3.org/1999/xlink" height="498">
  <!--Generated by the Batik Graphics2D SVG Generator-->
  <defs id="genericDefs" />
  <g />
</svg>
Thanks in advance!
 
Karen Chen

Reply via email to