Re: using createDocument() to read an SVG file with new lines

[email protected]
Newsgroups gmane.text.xml.batik.user
Message-ID <OF4D440433.5401C47B-ON852578AF.00361F82-852578AF.0036740E@knotes.kodak.com>
Hi Anjello,

Anjello <[email protected]> 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 | 
[email protected] | 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: [email protected]
> For additional commands, e-mail: [email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.