I want to load an XML document in Xerces-C++ (version 2.8, under Linux), and validate it using a DTD schema not referenced from the document. I tried the following:
XercesDOMParser parser;
parser.loadGrammar("grammar.dtd", Grammar::DTDGrammarType);
parser.setValidationScheme(XercesDOMParser::Val_Always);
parser.parse("xmlfile.xml");
But it doesn't indicate an error if the document is not valid. What am I missing?
You'll need to set an error handler before calling parse if you want to see anything:
Handler handler;
parser.setErrorHandler( &handler );
where Handler is a class derived from ErrorHandler