Hi André,
[EMAIL PROTECTED] wrote on 11/03/2006 04:51:12 AM:
> Batik works great for me except one little problem that I'm unable to
solve:
> I'd like to apply the 'svg:' prefix to all the elements that Batik
creates.
Well the SVGGraphics2D isn't really designed to do this. I should also
say that this really shouldn't be needed, the root of the SVG tree
it generates sets the default namespace (namespace's and prefixes can
change through out a document).
That all said, the easiest way to do this would be to create a
subclass of our batik.dom.svg.SVGOMDocument class and override the
'createElementNS(String ns, String tag)' to pre-pend "svg:" to 'tag'
before calling the baseclass 'createElementNS' function.
> What I currently do is:
>
> DOMImplementation domImpl =
SVGDOMImplementation.getDOMImplementation();
> String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
> org.w3c.dom.Document doc = domImpl.createDocument(svgNS, "svg:svg",
null);
> ImageHandler imageHandler = new DefaultImageHandler();
> ExtensionHandler extensionHandler = new DefaultExtensionHandler();
> SVGGeneratorContext ctx = SVGGraphics2D.buildSVGGeneratorContext(
> doc, imageHandler, extensionHandler);
> SVGGraphics2D g = new SVGGraphics2D(ctx, false);
> // draw shapes
>
> I played a bit with DOMImplementation.createDocument() and tried several
> variants ("svg", "svg:svg", ...) for the qualifiedName-Parameter, but
> nothing did work.
This is just setting the root SVG Element's tag name....
> I'm going to integrate the output in further transformations and I'm
having
> trouble with namespaces. I would highly appreciate if someone could help
me
> setting the prefix correctly.
>
> Thanks a lot for your help! (And sorry for the bad English...)
The Engish was fine.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]