Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What am I doing wrong?

 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to use TreeWalker to simply print out each element name and I keep getting this error message.
java.lang.ClassCastException
at AccessElement.parseXML(AccessElement.java:35)
at AccessElement.main(AccessElement.java:17)
Here is the code:
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't used TreeWalker my self, but it appears that the following casting is illegal.
((DocumentTraversal)document
document is of type Document but can you cast that to DocumentTraversal type?
 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The sad thing about this is this is parts from an example in a Book I bought. Go Figure. Thanks for your help. I'll try to figure it out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic