Re: Gaining access to the return code of XML_Parse ()

"Wayne W. Ziebarth" wrote:
> 
> Unfortunately, this does not help. If I use the expat library directly and
> call XML_Parse(), I can easily evaluate if it passed or failed. However,
> when used as part of libwww, it isn't called directly by my application and
> I can't see how to get its return value when the HTEventList_loop() exits.
> 
> Thanks anyway,
> 
> WWZ

Hi,
Looking at the functions available from xmlparse.h
the following might work (though I have not tried it)...

Since you are using expat in the libwww framework,
when you go to setup your handlers you have access to
XML_Parser xmlparser.
When you are setting up your handlers you can also call
XML_UseParserAsHandlerArg(XML_Parser parser).

This way you will have the XML_Parser instance you are using in all your
xml callbacks. You can then within these methods check
XML_GetErrorCode to see if an error occurred.

But an even simpler method might be to hold on to a reference
to the XML_Parser instance when your HTXMLCallback_registerNew
is called and then in your terminate_hander for the eventloop you
can check the XML_Parser for an error. You could even set the XML_Parser
instance
as the param element of the callback too, instead of using a global var,
by specifying
the XML_Parser instance when you add your terminate_handler callback
using 
 HTNet_addAfter(terminate_handler, NULL, xmlParser, HT_ALL,
HT_FILTER_LAST)

Not sure if any of these suggestions help

Jeff

Received on Wednesday, 31 January 2001 11:57:55 UTC