I am getting different results when trying to display the same svg document using JSVGCanvas.setSVGDocument() and JSVGCanvas.setURI().
I am using Xalan to apply a stylesheet to an xml file which results in an SVGDocument
object:
SVGDOMImplementation impl = (SVGDOMImplementation)
SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
SVGDocument doc = (SVGDocument) impl.createDocument(svgNS, "svg",
null);
Source xmlSrc = new StreamSource(xmlURI);
Source xslSrc = new StreamSource(stylesheetURI);
DOMResult svgResult = new DOMResult(doc.getDocumentElement());
Transformer transformer = tFac.newTransformer(xslSrc);
transformer.transform(xmlSrc,svgResult);
Then sending the SVGDocument object (doc) to the JSVGCanvas, equivalent to:
JSVGCanvas canvas = new JSVGCanvas();
canvas.setSVGDocument((SVGDocument) doc);
I consistently get this result (even with different svg data):
org.apache.batik.bridge.BridgeException: null:-1
The attribute 'd' of the element <path> is required
at org.apache.batik.bridge.SVGPathElementBridge.buildShape(Unknown Source)
at org.apache.batik.bridge.SVGShapeElementBridge.createGraphicsNode(Unknown
Source)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
at org.apache.batik.swing.svg.GVTTreeBuilder.run(Unknown Source)
For debugging purposes I took that SVGDocument and used Xalan's default copying
behavior to send it to a file. Then I used canvas.setURI() to view the SVG from that
file, and it rendered without any errors.
Why am I getting different results?
Attached is that svg file: output.svg
I am using batik 1.1, xalan 2.1.0, and crimson 1.1.3 on jdk 1.3.0.
output.svg
Description: image/svg
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
