W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2001

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

From: Jeff Adams <jeffa@coursewave.com>
Date: Wed, 31 Jan 2001 11:00:15 -0600
Message-ID: <3A78449F.C25F7D59@coursewave.com>
To: www-lib@w3.org
"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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:38 GMT