This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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