Re: HText HTML element callbacks

Rick Kwan wrote:
> 
> I am finally back to looking at the HText interface, particularly
> the usage of the callbacks.
> 
> In looking at the callbacks for handling HTML elements,
> HText_beginElement() and HText_endElement(), they appear to be
> a means for providing counterparts to HTML_start_element() and
> HTML_end_element() in HTML.c.  But these two routines are invoked
> by way of
>     SGML_write() calls start_element() calls HTML_start_element()
>     SGML_write() calls end_element() calls HTML_end_element()
> Thus, to get at these by way of callbacks, I would have to provide
> my own customized SGML.c as well.
> 
> Have I overlooked something?  It seems like it shouldn't be necessary
> to rewrite SGML.c in order to get at the element callbacks.
Well, I didn't really look at the source, but comments in header say
you should register your callbacks, and it worked just like that:

// these are my callbacks
void HandleStartTag(HText *text,
    int	element_number,
    const BOOL *present,
    const char **value);
void HandleEndTag(HText *text,
    int element_number);

    // somewhere between libwww initialization and document loading
    HText_registerElementCallback(HandleStartTag, HandleEndTag);

Other callbacks will be invoked for beginning and end of document,
chunks of text etc. (if you register them, of course).

	Bye
		Vasek
--
I have a web spider, too!
http://www.locus.cz/linkcheck/

Received on Tuesday, 22 June 1999 14:30:43 UTC