Hi all,

I have re-engineered a VC++(6) application to a multithreaded design and now
find that calls to xerces functions (v1.5) crash.

The thread sits and monitors a directory for XML file and then creates an
object (CStateMachine) to process the file (the file is represented as a
CDataFile object in the code below).

The first XML file collected and processed seams to work, then the
(CStateMachine) object is destoryed, but when the second attempt is made to
create the object, the application crashs when it goes to creae a new
SAXParser object.

Am I doing something wrong ???


Sid Young
QML Pathology
Brisbane


bool CStateMachine::CommandProcess(CDataFile *pDF)
{

    pLog->log_function("CommandProcess(CDataFile)");
    try
    {
        XMLPlatformUtils::Initialize();
                cout<<"XML init"<<endl;
    }
    catch (const XMLException& toCatch)
    {
        cout<<"Error during initialization! - "<<toCatch.getMessage()<<endl;
                pLog->log("ERROR - Unable to initialize XML sub system");
        return false;
    }
    SAXParser * parser = new SAXParser();
        parser->setValidationScheme(SAXParser::Val_Never);
        parser->setDoValidation(false);
        parser->setDoNamespaces(false);
        SAXHandler *saxObj = new SAXHandler( pLog );
        saxObj->makeDocument( pDF );
        ErrorHandler *errHandler = (ErrorHandler*) saxObj;
        parser->setDocumentHandler(saxObj);
        parser->setErrorHandler(errHandler);

    try
    {
                pLog->log("Begin XML SAX parse of: ", pDF->getFullFilePath()
);
                parser->parse( pDF->getFullFilePath().c_str() );
    }
        catch (const XMLException &toCatch)
    {
        cout<<"SAX Processing error has occured:
"<<toCatch.getMessage()<<endl;
                pLog->log("ERROR - SAX Processing Exception ");
        return false;
    }
        catch (const SAXParseException &toCatch)
    {
        cout<<"SAX Processing error has occured:
"<<toCatch.getMessage()<<endl;
                pLog->log("ERROR - SAX Parsing Exception ");
        return false;
    }

        XMLPlatformUtils::Terminate();

        cout<<"End of SAX parser"<<endl;
        return true;
}


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

Reply via email to