ClassCast:troubles: getContent(index).clone() 2004-03-10 - By Robert Stukey
Back
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@(protected)] Sent: Wednesday, March 10, 2004 5:22 PM To: jdom-interest@(protected) 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
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected) .com
|
|