From: Monika Mevenkamp <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: semantic error reporting in SAXParser ? Date: Mon, 17 Apr 2000 11:51:25 -0500 (CDT)
Dr. Xerces:
I am trying to figure the best way out to handle semantic errors in a SAXParser. I did not find how I get to the positioning information (i.e. file,line,char position) from within a HandlerBase method (in my case start/endElement);
In case you need a little more context, here is how I set my parser up:
----------------------------------------------------------------------------
Driver driver; // one of my own data structures
DriverXMLHandler handler(&driver); // DriverXMLHandler derives
// from SAXHandlerBase which in turn
// derives from HandlerBase
SAXParser parser;
parser.setDoValidation(true);
parser.setDocumentHandler(&handler);
parser.setErrorHandler(&handler);
try {
parser.parse(configurationFile);
}
catch (const SAXException& toCatch) {
ReportException("Error:", toCatch);
return 1;
}
catch (const XMLException& toCatch) {
String msg = String("Can't open '") + args.configurationFile + "'.";
ReportException(msg, toCatch);
return 1;
}
---------------------------------------------------------------------------- SAXHandlerBase implements error, fatalError, and warning.
DriverXMLHandler implements startElement and endElement. it updates the Driver instance that it received upon construction according to what is found in the file that is being parsed.
Whenever there is a semnatic error in the parsed file DriverXMLHandler::start/endElement should report it in terms of file and line number and go on. ----------------------------------------------------------------------------
I'd appreciate any help.
Monika
-- Mail: Computer Science Dept., MS 132 Office: 3054 Duncan Hall Rice University Voice: (713) 348-5693 6100 South Main Street Fax: (713) 348-5136 Houston, TX 77005-1892 email: [EMAIL PROTECTED] c
______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
