aspose file tools*
The moose likes XML and Related Technologies and the fly likes SAX Parser How to break once i get required values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "SAX Parser How to break once i get required values" Watch "SAX Parser How to break once i get required values" New topic
Author

SAX Parser How to break once i get required values

Sanjay Ra
Ranch Hand

Joined: Nov 05, 2004
Posts: 31
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
You could just throw some custom RuntimeException and catch it outside the call to parse(). Certainly not too pretty but at least it works.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Sanjay Ra
Ranch Hand

Joined: Nov 05, 2004
Posts: 31
is this the only way ?

thanks!
Sanjay
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SAX Parser How to break once i get required values