File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Product and Other Certifications and the fly likes Simple ErrorHandler doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Product and Other Certifications
Reply Bookmark "Simple ErrorHandler doubt" Watch "Simple ErrorHandler doubt" New topic
Author

Simple ErrorHandler doubt

Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
hi,
Am learning SAX2. I set the validation feature to true. In one of the event call backs i threw an application specific exception wrapped in
SAXParseException.
I have extended DefaultHandler and overridden certain methods.
These include fatalError ,error and warning.
error() is getting called for undeclared elements because i don't have a DTD.
But none of the 3 mehtods got called when i threw my applcn specific exception.
How is the SAX2 parser supposed to behave?
When it encounters SAXException, is it supposed to call our ErrorHandler implementation?.
Then we decide to abort or carry on parsing?
But my fatalError()/ error() is not getting called when an application exception gets thrown.
thanks
karthik
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
I was just wondering if this is right?:
Any exception thrown from a event callback terminates the parse(). Errorhandler has nothing to do with it.
Though I might consume a fatalError() which could be stupid, even a normal return from the fatalError() method is treated as a signal to stop parsing.
if this is correct then that probably answers my question. thanks.
 
 
subject: Simple ErrorHandler doubt
 
Threads others viewed
servlets and xml
Errors when parsing an XML doc...
Help!!!!! IllegalMonitorException thrown!!!
WSAD5 - Struts ActionErrors
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture