Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SAX Parser How to break once i get required values

 
Sanjay Ra
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using a SAX Parser (xerces) .
I dont need to parse the entire XML and would like to stop parsing once i get certain values.
How could i do this?

thanks
Sanjay
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could just throw some custom RuntimeException and catch it outside the call to parse(). Certainly not too pretty but at least it works.
 
Sanjay Ra
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is this the only way ?

thanks!
Sanjay
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic