• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem to read RSS with SAX  RSS feed

 
Tobias Tangfelt
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to read an RSS feed but I can´t get it to work. My problem is that I can´t convert my List object to an element. And I don´t now what my problem is. Please tell me if someone here got some tip.
Here is my Code:


Here is my error:
Exception in thread "main" java.lang.ClassCastException: org.dom4j.tree.DefaultElement cannot be cast to javax.lang.model.
 
Paul Clapham
Sheriff
Posts: 22379
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's really the whole error message? You didn't cut off the last part, where it tells you the name of the class you can't cast to?

You should also look at the top of the class, where you imported something ending with Element. Make sure you imported the right Element.
 
Tobias Tangfelt
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, here is the whole message:
Exception in thread "main" java.lang.ClassCastException: org.dom4j.tree.DefaultElement cannot be cast to javax.lang.model.element.Element
at Labb78del3.readRSS.<init>(readRSS.java:41)
at Labb78del3.main.main(main.java:19)
Java Result: 1
 
Paul Clapham
Sheriff
Posts: 22379
42
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. Then don't import javax.lang.model.element.Element at the top of your code, import org.w3c.dom.Element instead.
 
Tobias Tangfelt
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you s much!
The problem is solved.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!