You are initializing it twice. Pull XMLPlatformUtils::Initialize(); out of your constructor.
-----Original Message----- From: BARUCH Deborah FTRD/DMR/LON [mailto:deborah.baruch@;rd.francetelecom.com] Sent: Friday, October 18, 2002 12:27 PM To: [EMAIL PROTECTED] Subject: RE: Help ! can not parse twice Many thanks here is my code: in my main program I do: XmlCAMethods* xmlCA = new XmlCAMethods; string xmldoc (""); xmldoc += "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; xmldoc += "<test>\n"; xmldoc += "</test>\n"; cout<<"document to parse: \n"<<xmldoc; xmlCA->readxmldoc(xmldoc.c_str()); xmldoc = ""; xmldoc += "<test2>\n"; xmldoc += "</test2>\n"; xmlCA->readxmldoc(xmldoc.c_str()); now in xmlCAMethods I do: /**Constructor*/ XmlCAMethods::XmlCAMethods() { try { cout<<"initialising the XML platform \n"; XMLPlatformUtils::Initialize(); } catch (const XMLException& toCatch) { cerr << "Error during initialization! :\n" << toCatch.getMessage() << endl; } } /**Destructor*/ XmlCAMethods::~XmlCAMethods() { XMLPlatformUtils::Terminate(); } Information* XmlCAMethods::readxmldoc(const char* xmldoc) { cout<<"reading xml doc..."<<endl; MemBufInputSource* pMemBufIS = NULL; Information* info; int errorCount = 0; // // Create a SAX parser object and sets it to the parameters as defined at the beginning // of this file. // cout<<"create sax parser \n"; SAXParser* parser = new SAXParser; //Error on this line cout<<"set parsing parameters \n"; parser->setValidationScheme(valScheme); parser->setDoNamespaces(doNamespaces); parser->setDoSchema(doSchema); parser->setValidationSchemaFullChecking(schemaFullChecking); // // Create the handler object and install it as the document and error // handler for the parser-> Then parse the file and catch any exceptions // that propogate out // try { cout<<"create the handler object\n"; SAXIPMMHandlers handler(encodingName, unRepFlags); cout<<"setting the handler of the parser\n"; parser->setDocumentHandler(&handler); parser->setErrorHandler(&handler); cout<<"transform doc \n"; pMemBufIS = transformInputXml(xmldoc); cout<<"parse doc \n"; parser->parse(*pMemBufIS); cout<<"out of parser \n"; errorCount = parser->getErrorCount(); cout<<"error count \n"; //get info here info = handler.getInformation(); handler.~SAXIPMMHandlers(); cout<<"destroying handler \n"; } catch (const XMLException& toCatch) { cout << "catching error\n"; cerr << "\nAn error occurred\n Error: " << toCatch.getMessage() << "\n" << endl; XMLPlatformUtils::Terminate(); //return -1; return NULL; } //cout<< "out of parser"<<endl; // // Delete the parser itself. Must be done prior to calling Terminate, below. // delete parser; delete pMemBufIS; cout<<"parser deleted.."<<endl; // And call the termination method if (errorCount > 0) return NULL; else return info; } *-----Original Message----- *From: Gareth Reakes [mailto:gareth@;decisionsoft.com] *Sent: 18 October 2002 17:13 *To: [EMAIL PROTECTED] *Subject: Re: Help ! can not parse twice * * *Hi, * post the code you are using and I will take a look. * *Gareth * * *On Fri, 18 Oct 2002, BARUCH Deborah FTRD/DMR/LON wrote: * *> Hi, *> *> sorry to send this email once again but I've definitely have *a problem with the use of the xerces library. I can not manage *to parse successively two documents using a sax parser *(parsing once works fine) although I am initialising the *XmlPlatformsUtil only once in the process...Has anyone *encountered the same problem ? Any help would be greatly appreciated . *> *> Thanks *> *> Deborah *> *> *> * *-- *Gareth Reakes, Head of Product Development *DecisionSoft Ltd. http://www.decisionsoft.com *Office: +44 (0) 1865 203192 * * * *--------------------------------------------------------------------- *To unsubscribe, e-mail: [EMAIL PROTECTED] *For additional commands, e-mail: [EMAIL PROTECTED] * * --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
