xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karen Chen" <kc...@itee.uq.edu.au>
Subject How to add an element before generating the SVG image?
Date Mon, 20 Jan 2003 07:14:30 GMT
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 style="fill-opacity:1; color-rendering:auto; color-interpolation:auto; text-rendering:auto;
stroke:black; stroke-linecap:square; stroke-miterlimit:10; shape-rendering:auto; stroke-opacity:1;
fill:black; stroke-dasharray:none; font-weight:normal; stroke-width:1; font-family:&apos;sansserif&apos;;
font-style:normal; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0; image-rendering:auto;"
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
Mime
View raw message