1 #include <xercesc/util/PlatformUtils.hpp>
2 #include <xercesc/util/TransService.hpp>
3 #include <xercesc/sax2/SAX2XMLReader.hpp>
4 #include <xercesc/sax2/XMLReaderFactory.hpp>
9 cout <<
"\nUsage: myParser <xml_file> <out_put_file_name>"<< endl;
12 int main(
int argC,
char* argV[]) {
13 const char* encodingName =
"LATIN1";
14 const char* fileName =
"example" ;
15 const char* xmlFile = 0;
17 XMLFormatter::UnRepFlags unRepFlags = XMLFormatter::UnRep_CharRef;
23 catch (
const XMLException& toCatch) {
24 cerr <<
"Error during initialization! :\n"
25 <<
StrX(toCatch.getMessage()) << endl;
32 XMLPlatformUtils::Terminate();
38 xmlFile = argV[parmInd++];
39 fileName = argV[parmInd];
44 SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
51 outFile.open(fileName, ios::out);
55 MySAXHandler myhandler(encodingName, unRepFlags, outFile);
56 parser->setContentHandler(&myhandler);
57 parser->setErrorHandler(&myhandler);
58 parser->parse(xmlFile);
59 errorCount = parser->getErrorCount();
62 catch (
const XMLException& toCatch) {
63 cerr <<
"\nAn error occurred\n Error: "
64 <<
StrX(toCatch.getMessage())<< endl;
65 XMLPlatformUtils::Terminate();
74 XMLPlatformUtils::Terminate();
static void Initialize(GLwDrawingAreaWidget req, GLwDrawingAreaWidget neww, ArgList args, Cardinal *num_args)
int main(int argC, char *argV[])