• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple ErrorHandler doubt

 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!