I have intentionaly added a violation(against the external schema) inside
the XML document but no error is being reported during:
parser->getErrorCount();
and
cerr << "Errors from errReporter ->"
<< errReporter->getSawErrors() << "<-\n";
Following are additional excerpts of the code that I'm using:
=====================Begin included code================================
DOMParser* parser = new DOMParser;
parser->setValidationScheme(DOMParser::Val_Always);
parser->setDoNamespaces(TRUE);
parser->setDoSchema(TRUE);
parser->setValidationSchemaFullChecking(TRUE);
parser->setExitOnFirstFatalError(TRUE);
DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter();
parser->setErrorHandler(errReporter);
parser->setExternalSchemaLocation(schLoc);
try
{
const unsigned long startMillis =
XMLPlatformUtils::getCurrentMillis();
parser->parse(input);
const unsigned long endMillis =
XMLPlatformUtils::getCurrentMillis();
duration = endMillis - startMillis;
errorCount = parser->getErrorCount();
if(fTrace)
{
cerr << "duration ->" << duration << "<- ms\n";
cerr << "got ->" << errorCount << "<- errors\n";
cerr << "Errors from errReporter ->"
<< errReporter->getSawErrors() << "<-\n";
}
}
catch (...)
{
cout << "Unexpected Exception \n" ;
rc = -1;
}
========================End included
code===========================================
DOMTreeErrorReporter is the same class provided in the DOMPrint example.
What am I missing?
How do I know if the schema validation is working? Is there another way to
accomplish schema validation? all suggestions are welcomed. Thanks.
Carlo
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]