logo       

Re: TranscoderInput(Document doc) throws ClassCastException: msg#00107

Subject: Re: TranscoderInput(Document doc) throws ClassCastException
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@xxxxxxxxxxxxxx
For additional commands, e-mail: batik-users-help@xxxxxxxxxxxxxx



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe