Following code throws an Exception:
// jdom document contains an example svg document DOMOutputter domout = new DOMOutputter(); // from jdom.org org.w3c.dom.Document dom = domout.output(document);
TranscoderInput input = new TranscoderInput(dom);
OutputStream ostream = new FileOutputStream("c:\\home\\test.tif");
TranscoderOutput output = new TranscoderOutput(ostream);TIFFTranscoder t = new TIFFTranscoder(); t.transcode(input, output); // here the exception is thrown
=====
The Exception itself is thrown at:
public SVGSVGElement getRootElement() {
return (SVGSVGElement)getDocumentElement();
}Inside class SVGOMDocument
It seems like getDocumentElement() returns a node from the type org.apache.batik.dom.GenericElement, which getRootElement() tries to cast to the Interface org.w3c.dom.svg.SVGSVGElement
The GenericElement node contains the rootElement of my dom Document (the svg element of my document). It is the second time SVGOMDocument#getRootElement() is called.
====
The Exception itself:
java.lang.ClassCastException
at org.apache.batik.dom.svg.SVGOMDocument.getRootElement(SVGOMDocument.java:252)
at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:223)
at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:122)
at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:174)
at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:188)
(I recompiled todays cvs snapshot with debug = on)
====
I tried to find a workaround because im not sure if the problem itself has its cause inside my document structure.
I simply converted the same jdom Document to a string and delivered this String by mean of class StringReader into the TranscoderInput.
StringReader logoReader = new StringReader(jdomString); TranscoderInput input = new TranscoderInput(logoReader);
This attempt work proper and batik is able to render the tiff without problems.
===
So has someone an idea? Is it my own fault or is there some kind of Bug inside Batik?
I tried it with a one hour old batik cvs snapshot. Running on suns jsdk 1.4.2_03 on a Windows XP Sp1 machine.
Regards Neuhauser Bernhard
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
