[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-c-dev
Subject: xml problem
From: "Jason Jesso" <jjesso () global-matrix ! com>
Date: 2001-11-30 17:20:58
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic