You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Anjello <An...@gmail.com> on 2011/06/11 18:14:30 UTC
using createDocument() to read an SVG file with new lines
Hello,
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
java.lang.ClassCastException: org.apache.batik.dom.GenericText cannot be
cast to org.w3c.dom.Element
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
Re: using createDocument() to read an SVG file with new lines
Posted by th...@kodak.com.
Hi Anjello,
Anjello <An...@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
>