Hello List!
I want to export an org.w3c.dom.Node from a SVGGraphics2D object.
What I'm currently trying to do is:
DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
Document doc = domImpl.createDocument(svgNS, "svg", null);
ImageHandler imageHandler = new DefaultImageHandler();
ExtensionHandler extensionHandler = new DefaultExtensionHandler();
SVGGeneratorContext ctx = SVGGraphics2D.buildSVGGeneratorContext(doc,
imageHandler, extensionHandler);
SVGGraphics2D g = new SVGGraphics2D(ctx, false);
Dimension dim = [...];
g.setSVGCanvasSize(dim);
[paint something]
Element rootNode = doc.getDocumentElement();
g.getRoot(rootNode);
g.dispose();
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.
Now my question: Is there a more elegant solution to my problem? Am I
probably thinking too complicated here?
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.
Thanks a lot!
André
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]