Hi All!,

I am experiencing a confusing problem!

I am developing a windows application that makes use of the Xerces 
compiler, I am overriding the SAX error handler interface in order to 
intercept exceptions from the parser.  Within the error handling method I 
transcode the systemID in order to get the filename.  I am then responsible 
for deleting this area of memory when I have finished with it, but the 
problem is that as soon as I call delete the program crashes!

It would appear that there is a problem with the allocation of memory.

Is this a bug? or am I missing the point on how to handle error exceptions 
?

Many thanks for your time

Neil

void TransXChangeErrorHandler::warning(const SAXParseException& e)

//
//      Argument:
//              None
//

//
//      Parameters:
//              1 - Sax parse exception
//                      Entry:
//                      Exit : Unchanged
//

{

//
//      LOCAL DATA DEFINITIONS :
//

char*                               Pvl_errorFile_c;    // Error filename
char*                               Pvl_errorMesg_c;    // Error message

//
// EXECUTABLE CODE
//

//
// Set error flag
//
    fSawErrors = true;
//
// Transcode error filename
//
        Pvl_errorFile_c = XMLString::transcode(e.getSystemId());
//
// Transcode error message
//
        Pvl_errorMesg_c = XMLString::transcode(e.getMessage());
//
// Output error
//
        fprintf (Pvl_outputFile, "**ERROR**:@: Warning at file: %s\n", 
Pvl_errorFile_c);
        fprintf (Pvl_outputFile, "**ERROR**:@: Line: %d\n", e.getLineNumber());
        fprintf (Pvl_outputFile, "**ERROR**:@: Char: %d\n", e.getColumnNumber());
        fprintf (Pvl_outputFile, "**ERROR**:@: Message: %s\n", Pvl_errorMesg_c);
        cerr << "\nWarning at file: " << Pvl_errorFile_c << endl;
        cerr << "\nLine: " << e.getLineNumber() << endl;
        cerr << "\nChar: " << e.getColumnNumber() << endl;
        cerr << "\nMessage: " << Pvl_errorMesg_c << endl;
//
// Free memory
//
        delete [] Pvl_errorFile_c;                      // Crashes at this point
        delete [] Pvl_errorMesg_c;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to