xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: TranscoderInput(Document doc) throws ClassCastException
Date Tue, 17 Feb 2004 12:04:06 GMT
Hi Cybernd,


Cybernd wrote:

> 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 root element of an SVGDocument must always be an 'svg'
element in the svg namespace.  My suspicion given that writing
to a string and reparsing works is that while you have an 'svg'
element it is not in the svg namespace (although it may have an
appropriate xmlns attribute).

    This would indicate to me that the jdom part of the code isn't
working quite right but since I don't know anything about jdom I
can't provide pointers to how namespaces are supposed to be associated
with elements.  Perhaps someone with more knowledge of jdom can
help you here.


> 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: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message