|
I try to create a simple project to using the
following code but encounter exception when the program exit.
#include
<xercesc/util/PlatformUtils.hpp>
//#include <xercesc/sax/SAXException.hpp> //#include <xercesc/sax/SAXParseException.hpp> #include <xercesc/parsers/DOMParser.hpp> //#include <xercesc/dom/DOM_DOMException.hpp> //#include "DOMCount.hpp" #include <string.h> #include <stdlib.h> //#include <fstream.h> #include "iostream.h" int main(int argc, char* argv[]) { XMLPlatformUtils::Initialize(); const
char*
xmlFile = "e:\\temp\\LogConfiguration.xml";
// Instantiate the DOM parser.
DOMParser* parser = new DOMParser; // And create our error handler and install
it
//DOMCountErrorHandler errorHandler; //parser->setErrorHandler(&errorHandler); parser->parse(xmlFile); DOM_Document doc = parser->getDocument(); //unsigned int elementCount = doc.getElementsByTagName("*").getLength(); // Print out the stats that we collected and time
taken.
//cout << xmlFile << ": " << elementCount << " elems)." << endl; //
// Delete the parser itself. Must be done prior to calling Terminate, below. // delete parser; parser = NULL; // And call the termination method
//crush, why????? XMLPlatformUtils::Terminate(); return 0;
} logConfiguration.xml
==========================================================
<?xml version="1.0"
encoding="UTF-8"?>
<LogConfiguration> <General> <filename>1.txt</filename> </General> <CMRCallLog> <PhoneNo>123</PhoneNo> </CMRCallLog> </LogConfiguration> When the program terminates, it will encounter exception. However, removal
of XMLPlatformUtils::Terminate() fix the problems.
Why?
Thanks
|
- Re: exception using visual C++ meng-kim
- Re: exception using visual C++ Alberto Massari
