xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: using createDocument() to read an SVG file with new lines
Date Tue, 14 Jun 2011 09:54:44 GMT
Hi Anjello,

Anjello <Anjelloatoz@gmail.com> wrote on 06/11/2011 12:14:30 PM:

> I use the createDocument() method to read in an SVG file.
> When I read a file with tags separated with new lines, and then try to
> access the last element of the document element, i get the exception
 
        The problem is that the last 'node' of your document is not an
Element.  It's a text element (probably containting your newline).  You
should simply use "getPreviousSibling" until you get a Node that is
an "instanceof" Element.

> java.lang.ClassCastException: org.apache.batik.dom.GenericText cannot be
> cast to org.w3c.dom.Element

Thomas DeWeese | CDG Advanced Development | 
Eastman Kodak Company | 343 State Street | Rochester, NY 14650-0128 | 
Thomas.DeWeese@Kodak.com | 585 724-0294 | 
www.kodak.com 

> 
> but if the same file didnt have any newlines or spaces between the tags,
> everything works perfectly. is this a problem of encoding? How can I 
solve
> this problem?
> 
> Thanks in advance..
> Anjello
> 
> --
> View this message in context: http://batik.2283329.n4.nabble.com/
> 
using-createDocument-to-read-an-SVG-file-with-new-lines-tp3590714p3590714.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


Mime
View raw message