I am trying to load the example schema provided by xerces (personal.xsd) using
an absolute path,
However it always fails to load it
void ValidateSchema(const char* schemaFilePath, const char* xmlFilePath)
{
XercesDOMParser domParser;
if (domParser.loadGrammar(schemaFilePath, Grammar::SchemaGrammarType) ==
NULL)
{
fprintf(stderr, "couldn't load schema\n");
return;
}
ParserErrorHandler parserErrorHandler;
domParser.setErrorHandler(&parserErrorHandler);
domParser.setValidationScheme(XercesDOMParser::Val_Auto);
domParser.setDoNamespaces(true);
domParser.setDoSchema(true);
domParser.setValidationConstraintFatal(true);
domParser.parse(xmlFilePath);
if (domParser.getErrorCount() == 0)
printf("XML file validated against the schema successfully\n");
else
printf("XML file doesn't conform to the schema\n");
}
domParser.loadGrammar(schemaFilePath, Grammar::SchemaGrammarType) returns null
when the absolute path of personal.xsd is given to it
The XML I'm using to test is also the one provided in the samples,
personal.xml, though since the schema isn't loaded it returns errors if allowed
to continue pass the loadGrammar function.
What am I doing wrong?
Thank you.