You could define an ErrorHandler and then try something like this before parsing :
parser->setErrorHandler(myErrorHandler);
parser->setValidationScheme(XercesDOMParser::Val_Always);
parser->setValidationSchemaFullChecking(true);
parser->setDoNamespaces(true);
parser->setDoSchema(true);
parser->setExitOnFirstFatalError(true); // exception si le schema n'est pas trouve
parser->setValidationConstraintFatal(true);
parser->setIncludeIgnorableWhitespace(false);
parser->setCreateCommentNodes(false);
parser->setExternalSchemaLocation( ... );
We use XercesDomParser this way and get the parsing errors as exceptions.
Regards,
Kevin Belhumeur wrote:
How do I validate XML against a schema when parsing using DOM as in:
pDomDocument = pDOMBuilder->parse( domInputSource );
I have schemas for the simple XML files in the domInputSource and am mainly interested in getting useful structure/content error messages at parse time.
Thanks,Kevin
Kevin M. Belhumeur, Software Engineer
X-Rite Incorporated
[EMAIL PROTECTED]
ph: 616-257-2478
cell: 616-644-2851
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-- Philippe Haution EDF R&D Département Méthodes d'Optimisation et de Simulation 1 Av du Général de Gaulle 92141 Clamart CEDEX
