Hi,
I am trying to validate an XML Document to an external schema. Even
though there are errors in the file & does not confirm to the schema I get
no such error messages.
-----------------------------------------
using namespace xercesc;
int main()
{
// Initialize the XML4C2 system
try{
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch){
cerr << "Error during initialization! :\n"
<< toCatch.getMessage() << endl;
return 1;
}
cout<<"Creating the parser "<<endl;
SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
cout<<"Built the xml reader factory "<<endl;
XMLCh* propertyValue = XMLString::transcode("my_schema.xsd");
//ArrayJanitor<XMLCh> janValue(propertyValue);
cout<<"setting the external schema location "<<endl;
parser->setExitOnFirstFatalError(true);
parser->setValidationConstraintFatal(true);
parser->setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation,
propertyValue);
try {
parser->parse("my_xmlfile.xml");
}
catch (const XMLException& toCatch) {
cout << "Error during parsing! :\n"
<< toCatch.getMessage() << "\n";
}
cout<<"Error count is = "<<parser->getErrorCount();
return 0;
}
------------------------------------
Any suggestions ?
Thanks
Suchit.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]