Hi,

I'm currently using Xerces 2.7.0 and I'm having some difficulty to setup my XML parser to validate the schema while parsing a file.
The current behavior is that even though the XML file contains some invalid schema, but the parser will parse it without flagging it or throwing an exception.

Below is a portion of my code.  Can someone take a look and see if there's anything wrong inside my code that causes the schema validation fail?

XMLPlatformUtils::Initialize();

static const XMLCh gLS[] = {chLatin_L, chLatin_S, chNull };

DOMBuilder::DOMBuilder *domParser_;

DOMImplementation *impl = DOMImplementationRegistry:
:getDOMImplementation(gLS);
domParser_ = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
domParser_->setFeature(XMLUni::fgDOMNamespaces, false);
domParser_->setFeature(XMLUni::fgXercesSchema, true);
domParser_->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
domParser_->setFeature(XMLUni::fgDOMValidateIfSchema, true);
domParser_->setFeature(XMLUni::fgDOMVlidation, true);
domParser_->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
domParser_->setErrorHandler(&myErrorHandler);

Document *doc = 0;

try {
   domParser_->resetDocumentPool();

   doc = domParser_->parseURI(xmlFileName);
} catch (...)
{
}

Thanks for reading!

- dc

Reply via email to