Re: [xml] Aborting html sax parsing from python



On Thu, Oct 27, 2005 at 10:59:33AM -0400, Stefan Seefeld wrote:
Daniel Veillard wrote:
On Thu, Oct 27, 2005 at 02:54:37PM +0200, Cesar Ortiz wrote:

Hi all,

I am trying to use the python bindings of libxml in order to parse html 
with
SAX.
I would like to be able to stop the parsing of a document from a 
callback. I
have tried to do it but the parser complains.
How I could do that?


 the routine at the C level is

void
xmlStopParser(xmlParserCtxtPtr ctxt);

We had a discussion some months ago concerning handling of python exceptions
raised in callbacks. The idea was to pass exceptions through the C layer
such that they could be caught at (python) application level.

Is this now supported ? That might be the simplest way to achieve what the 
OP
wants without the need to touch any low-level API.

  ECANTWORK (unless I misunderstand the proposal)
  you would leak all the structures allocated in the C layers between
the point getting the exception and the point raising it, and since it's
likely to include a call to reading than means an really large leak

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]