[
Lists Home |
Date Index |
Thread Index
]
> One of the most basic facilities of SAX parsers, I'd expect it to allow
the
> parse process to stop and do it's clean up, etc... and proceed with a
> program. Parsing large docs, once you get the info you need, it's a total
> waste of resources for it to keep parsing the document.
Exactly right.
> I can seem to find in docs or other groups any information on how that
would
> be accomplished. I mean, yes in some languages you can I guess throw an
> exception and the gargabe collection routine will clean stuff up as needed
> later. But I'm worried about C/C++ and say Perl/XS combination, where I
can
> kill the parser and catch the exception and continue with my program, but
> the memory will never be cleaned up?
Still throw (or raise) an exception. This should be caught by the parser,
endDocument will be called and then it will be either re-thrown or ignored
(depending on the implementation or exception type). The SAX specs requires
the parser to call endDocument regardless of anything else (for cleanup
purposes expressly). I haven't used the perl modules but in C++ and in
Pascal this is how you should handle it.
HTH,
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting
|