Hello Georg,

After you used the getRoot method, the 'content' of the SVGGraphics2D has been moved over to your doc2's document element and is no longer contained in the SVGGraphics2D internal DOM structures.

What you could do is stream method on SVGGraphics2D that takes an Element parameter and pass your doc2's document element.

Vincent.

Georg A. wrote:
I have created a SVGDocument from an existing svg file and I added something to the
DOM Tree (using SVGGraphics2D),
-----
try {
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
String uri = "file:" + new File("/0_Samples/world8.svg").getAbsolutePath();
Document doc2 = f.createDocument(uri);
g = new SVGGraphics2D(doc2);
double left = 99;
double top = 222;
int width = 10;
int height = 10;
Shape circle = new Ellipse2D.Double(left,top,width,height);
g.setPaint(Color.red);
g.fill(circle);
g.translate(10,0);//distance, ancle


      // The following populates the document root with the
      // generated SVG content.
      Element root = doc2.getDocumentElement();
      g.getRoot(root);

doc = (SVGDocument)doc2;
svgCanvas.setSVGDocument(doc);// invokes the rendering
//this works splendid and is rendered just as I want it, the file plus the red dot
streamsvg(g);
}
catch (Exception ex) {}
-----
now I want to stream out the SVGDocument.


When I do so using a FileWriter, the file just contains the parts I added with the SVGGraphics2D and not the
original DOM Tree from my svg file
----
public void streamsvg(SVGGraphics2D out){
try
{
boolean useCSS = true;
Writer raus = new OutputStreamWriter(System.out, "UTF-8");
out.stream(raus, useCSS);
Writer file = new FileWriter("bert.svg");
out.stream(file, useCSS);
System.out.println("geschrieben");


      }
        catch(Exception ex){}

    }
-----

thanks a lot for any suggestions!!!!

cheers

Georg



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to