Hi Justin, Justin Thomas <jus...@brynnandjustin.com> wrote on 04/14/2010 02:10:58 AM:
> As I understand it, I need to specify a namespace for the SVG tags > (that's how I've embedded some other more static images within the > xhtml directly). I can't figure out how to get Batik to generate > tags with the namespace specified (<svg:svg>, <svg:path>, etc.). Is > that possible? I tried using the "createElementNS" methods (instead > of just "createElement"), but that didn't seem to help. > Furthermore, some methods don't seem to have any NS options (like to > SVGShape.toSvg()). AFAIK, you shouldn't have to do this. As long as the outer SVG Element has an 'xmlns' attribute set to the svg namespace then the default namespace should switch to SVG for that part of the subtree. If you want to prefix the elements with 'svg:' then you need to do that when you create the element: Element e = document.createElementNS("http://....", "svg:svg"); You should also make sure that the 'svg' prefix's namespace has been set with an appropriate xmlns specification. The current DOMUtilities.writeNode/Document is capable of adding a prefix to the elements if that is what the xmlns tags say should happen. So if you can get your content as a DOM you can remove the default xmlns attribute and replace it with an xmlns:svg namespace attribute. Then if you serialize the document with the DOMUitilities it should prepend the svg: prefix.