Harish Aroli wrote:
Hello,
When I tried validating a XML file against a XML schema using DOM parser, I am getting
the error (through ErrorHandler) as "An exception occurred!
Type:RuntimeException, Message:The primary document entity could not be opened". I
am not getting how to resolve this. No idea what is going wrong.
This exception means that the document could not be found; given that
you are simply specifying "sample.xsd", verify what is the current
directory, or try specifying a full path.
Alberto
Platform: AIX using xlc.
Xercesc Version " xerces-c27.0
Here is the code snippet:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
std::string xml_msg; // I was updating this variable with the xml file.
CDomErrorHandler* errorChecker = new CDomErrorHandler(); // The error handler
overrided from ErrorHandler.
m_DomTreeParser = new XercesDOMParser();
m_DomTreeParser->setErrorHandler(errorChecker);
m_DomTreeParser->setValidationScheme( XercesDOMParser::Val_Always );
m_DomTreeParser->setDoNamespaces( true );
m_DomTreeParser->setDoSchema(true );
m_DomTreeParser->setValidationSchemaFullChecking(true);
// m_DomTreeParser->setExternalNoNamespaceSchemaLocation("sample.xsd");
// I tried both this and the one in below line also.
m_DomTreeParser->loadGrammar("sample.xsd", Grammar::SchemaGrammarType, true);
m_DomTreeParser->parse( xml_msg.c_str() );
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Any help is appreciated, really.
Thanks!
Harish
Cheers!
Harish A V
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]