tags:

views:

168

answers:

1

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.

A: 

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...

Nicolás
Once the "parse" method is called, the "content handler" can only be stopped by raising an exception. I do not know about "Expat" hence I am asking the question here.
jldupont
Last time I tried, exceptions from a content handler don't even propagate to the caller of parse()...
Nicolás