Re: [xml] SAX HTML still stuck.



At 02:30 PM 10/04/01 -0400, Daniel Veillard wrote:
[...] 
    ctxt = htmlCreatePushParserCtxt(
        SAXHandler, &abort, buf, res, argv[1], 0);

    while ( !abort && (res = fread(buf, 1, 2048, f)) > 0)
        htmlParseChunk(ctxt, buf, res, 0);

    htmlParseChunk(ctxt, buf, 0, 1);

 why are you calling htmlParseChunk(ctxt, buf, 0, 1); if you have
aborted ??? 

Sorry I'm so damn dumb.

All I'm doing is setting a flag that says there's no more input.  Just as
if the file was truncated.  How do I know *not* to call
htmlParseChunk(ctxt, buf, 0, 1)?  I'm at the end of the file, there's no
more input, that's all I know.

I tried to follow the example in testHTML.c, (e.g. where it calls
endElementDebug() ), and James Henstridge's examples, and
http://www.xmlsoft.org/#interface for the push parser, and the docs.  I'm
not trying to build a tree, so I'm not following why you are referring to
DOM.  I'm trying to use the push interface with SAX:

   "Note also that the push interface can be limited to SAX: just use 
    the two first arguments of xmlCreatePushParserCtxt()."

Which is what I'm doing.  At least that's the plan.

 At the very least call endElement() from your replacement routine,

Can you point me to examples of documentation that explains this?  Again,
I'm using SAX, and I thought the point was to set my own callbacks...  You
are saying I need to call endElement() in my SAX callback?


Sorry for the boring and non-sexy answer, but you need to debug your code
when you start messing with the SAX callbacks.

I don't mind boring and non-sexy answers -- I just need help understanding
what exactly is wrong with my example code, as I think I'm following the
examples and docs as best I can understand them.  If I'm not, the what I
need is a clear explanation of why, and perhaps a pointer to more info.

Thanks,



Bill Moseley
mailto:moseley hank org




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