• 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.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!