问题
I am pretty sure the answer is no but of course there are cleverer guys than me!
Is there a way to construct a lazy SAX based XML parser that can be stopped (e.g. raising an exception is a possible way of doing this) but also resumable ?
I am looking for a possible solution for Python >= 2.6 with standard XML libraries. The "lazy" part is also trivial: I am really after the "resumable" property here.
回答1:
Expat can be stopped and is resumable. AFAIK Python SAX parser uses Expat. Does the API really not expose the stopping stuff to the Python side??
EDIT: nope, looks like the parser stopping isn't available from Python...
来源:https://stackoverflow.com/questions/2059455/lazy-sax-xml-parser-with-stop-resume