You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Jason Jesso <jj...@global-matrix.com> on 2001/11/30 18:20:58 UTC
xml problem
I have a simple C++ program that tries to parse an xml file. I am using
IBM's xml4c on AIX 4.3.3
The xml file is
<HELLO>
fnkjsdsf
<HELLO>
which should give me an error.
I get this
IOT/Abort trap(coredump)
#include <iostream.h>
#include "dom/DOM.hpp"
#include "parsers/IDOMParser.hpp"
#include "util/PlatformUtils.hpp"
#include "idom/IDOM_DOMException.hpp"
#include "sax/ErrorHandler.hpp"
#include "sax/HandlerBase.hpp"
int
main( int ac, char* av[] )
{
try {
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch) {
cout << "Error during initialization! :\n"
<< toCatch.getMessage() << "\n";
return 1;
}
char* xmlFile = "x1.xml";
IDOMParser* parser = new IDOMParser();
parser->setValidationScheme(IDOMParser::Val_Always); // optional.
parser->setDoNamespaces(true); // optional
ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase();
parser->setErrorHandler(errHandler);
try {
parser->parse(xmlFile);
}
catch (const XMLException& toCatch) {
cout << "\nFile not found: '" << xmlFile << "'\n"
<< "Exception message is: \n"
<< toCatch.getMessage() << "\n" ;
return -1;
}
catch (const IDOM_DOMException& e)
{
cerr << "An IDOM error occured during parsing\n IDOMException code:
" << e.code << endl;
}
return 0;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org