[jdom-interest] ClassCast:troubles: getContent(index).clone()

Robert Stukey restukey at erols.com
Wed Mar 10 18:23:58 PST 2004


           Yes, it had me confused on that one. I was just trying to get a
previous element based on the index. I wasn't really sure how the casting
worked once I was using getContent(), but I did a work around with the
iterator. If someone can explain the casting please do.

-----Original Message-----
From: Robin Rosenberg [mailto:robin.rosenberg.lists at dewire.com]
Sent: Wednesday, March 10, 2004 5:22 PM
To: jdom-interest at jdom.org
Cc: Robert Stukey
Subject: Re: [jdom-interest] ClassCast:troubles:
getContent(index).clone()


On Wednesday 10 March 2004 20:30, Robert Stukey wrote:
>          I am trying to get a clone of an Element at a certain index, but
I
> am throwing some Class Cast Exceptions? I've tried it enough ways to
> consider myself beaten. Any insight on what I am doing wrong would be
> appreciated, thanks.
>
>          Element x = (Element)root.getContent(index).clone();
>
>
> java.lang.ClassCastException: org.jdom.Text
> 	BlogArchive.findElement(BlogArchive.java:127)
> 	BlogArchive.doGet(BlogArchive.java:70)

Text is-not-an Element. It seems you are not expecting Text here.

-- robin




More information about the jdom-interest mailing list