[Expat-discuss] How to stop parsing a block at a appl-level error
Andre Luis Monteiro
andrelsm at iname.com
Wed Oct 4 06:17:37 CEST 2006
I'm one more Expat newbie just amazed by the conceptual simplicity and roubustness of this lib / API. Great work!
I'm building a C parser state machine on top of Expat, targeting config XML files. It was quite easy to code, and it's working fine and fast.
But I'm not satisfied with it's error handling, since the "semantic errors" -- XML structure errors or application-level errors derived from config actions -- must be "postponed" to the next XML document block to parse; I have not found a (fancy) manner to handle them as soon as they are found, stopping further parsing and returning the XML_Parser info (like line number and column etc.).
I didn't understand why the XML handler typedefs (like XML_StartElementHandler) do not declare a return value that could signal "user errors", in such a way that applications (XML parsers) could tell Expat to "get away with the shit" in a simple manner. Please explain the reasons why, ok? I'm a novice, just learning XML, SAX, Expat.
Moreover, please tell me how to stop the parsing and return as soon as an application-level error could be found (in a XML_StartElementHandler or a XML_EndElementHandler, for ex.).
PS: sorry for my bad English...
Play 100s of games for FREE! http://games.mail.com
More information about the Expat-discuss