Hi,

Where exactly does the code crash on the 2nd pass?

>From initial observations you should not call XMLPlatformUtils::Initialize()
and XMLPlatformUtils::Terminate() multiple times in a process (they should
be called once in the whole process space lifetime). I think this
functionality may have been fixed in 1.6 but try calling these functions on
startup and shutdown for the process instead.

Good luck.

> Chris Prior

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 20 December 2001 23:27
To: [EMAIL PROTECTED]
Subject: Xerces and multithreading on Win2K




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]


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


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

Reply via email to