Larry,

As you noticed, you can use getRoot, then manipulate your DOM tree,
then use stream(Element, Writer) method on SVGGraphics2D to steam
to your page.

Hope this helps.
V.


larry fredrickson wrote:
> 
> I'm trying to output SVG graphics to jsp and add javascript
> functionality to the elements.  This is what I'm starting with:
> 
> // create a Dimension object and specify the canvas size
> Dimension size = new Dimension(1024,768);
> 
> // Get a DOMImplementation
> DOMImplementation domImpl =
> GenericDOMImplementation.getDOMImplementation();
> 
> // Create an instance of org.w3c.dom.Document
> Document document = domImpl.createDocument(null,"svg",null);
> 
> // Create an instance of the SVGGrapics2D
> // this requires an X server running on the box
> SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
> 
> // set the canvas size; default is Integer.MAX_VALUE
> svgGenerator.setSVGCanvasSize(size);
> 
> // do some graphics stuff with the instance of SVGGraphics2D
> svgGenerator.drawLine(100,100,200,200);
> 
> StringWriter sw = new StringWriter();
> BufferedWriter outB = new BufferedWriter(sw);
> 
> boolean useCSS = true;
> svgGenerator.stream(outB,useCSS);
> 
> My output is a stream which gets written to the jsp file.  I'd like the
> output to be a DOM tree so I can get at the elements and attach
> javascript to them.  I know I can do an svgGenerator.getRoot() to return
> the top level element.  But then what?  Thanks.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to