xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alberto Massari <amass...@progress.com>
Subject Re: Geting errors
Date Fri, 09 Apr 2004 12:44:32 GMT
At 14.27 09/04/2004 +0200, Milan Tomic wrote:

>         This is how I pare file:
>
>bool errorsOccured = false;
>int errorCount = 0;
>try
>{
>   parser->parse(argv[argc - 1]);
>   errorCount = parser->getErrorCount();
>   if (errorCount > 0)
>     errorsOccured = true;
>} catch (const XMLException& e) {
>   cerr << "An error occured during parsing\n   Message: "  << 
> e.getMessage() << endl;
>   errorsOccured = true;
>} catch (const DOMException& e) {
>   cerr << "A DOM error occured during parsing\n   DOMException code: " <<

> e.code << endl;
>   errorsOccured = true;
>} if (errorsOccured) {
>   cout << "Errors during parse" << endl;
>   exit (1);
>}
>
>         Is there a way to get discription of error if errorsOccured == true?

You need to install an error handler; look at how DOMPrint works

     ...
     DOMCountErrorHandler errorHandler;
     parser->setErrorHandler(&errorHandler);

Alberto


>Thank you,
>Milan



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Mime
View raw message