> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> 
> [EMAIL PROTECTED] wrote on 11/10/2006 06:54:25 AM:
> 
> > 
> > Hello List!
> > 
> > I want to export an org.w3c.dom.Node from a SVGGraphics2D object.
> > 
> > What I'm currently trying to do is:
> 
> [ code that looks ok deleted ]
> 
> >     Element rootNode = doc.getDocumentElement();
> >     g.getRoot(rootNode);
> 
> >     return rootNode;
> > 
> > The problem with this is that getRoot() seems to overwrite doc's 
> > already
> set
> > namespace and I've to manually do a rootNode.setAttributeNS(null,
> "xmlns",
> > svgNS) to set the namespace correctly.
> 
>     I don't think I follow.  AFAIK 'getRoot(rootNode)' 
> appends the SVG content as children of the rootNode, it 
> doesn't touch the attributes on 'rootNode'. Also I think it 
> always set's the xmlns attribute on the node it appends.

You're right. It turned out that the testing code for storing the element
was incorrect.

> 
> > Now my question: Is there a more elegant solution to my 
> problem? Am I 
> > probably thinking too complicated here?
> 
>    This depends a lot on what you are trying to do.  The 
> SVGGraphics2D is really designed to act as a sort of 'print 
> to SVG' engine, not a 'simple' factory interface for SVG. 
>    If you are only interested in creating simple 'rect', 
> 'circles' or 'lines', you may be better off just writing the 
> code yourself, but if you have a big blob of existing Java 
> drawing code and you just want to spit out a high quality SVG 
> version of that drawing SVGGraphics2D is a great tool.

There's a lot of drawing going on and the resulting SVGs grow up to several
MBs so I'm stuck with SVGGraphics2D whicj is a great too indeed.

> 
> > A further question would be if it's possible to generate SAX-events 
> > for
> a
> > SVGGraphics2D object. I'm currently converting the dom to 
> sax events 
> > for further transformations.
> 
>    No the SVGGraphics2D (for a variety of good reasons) is 
> fairly well tied to outputing DOM.
> 

No Problem. I'm converting the DOM to SAX.


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

Reply via email to