- fixed xerces crash with version 3 and higher

This commit is contained in:
Mark Vejvoda
2012-03-14 00:33:23 +00:00
parent 63dbea6af7
commit 3b964ebbd2

View File

@@ -144,10 +144,9 @@ XmlNode *XmlIo::load(const string &path, std::map<string,string> mapTagReplaceme
else { else {
config->setParameter(XMLUni::fgXercesSchema, false); config->setParameter(XMLUni::fgXercesSchema, false);
config->setParameter(XMLUni::fgXercesSchemaFullChecking, false); config->setParameter(XMLUni::fgXercesSchemaFullChecking, false);
//config->setParameter(XMLUni::fgDOMValidateIfSchema, true); config->setParameter(XMLUni::fgXercesLoadExternalDTD, false);
config->setParameter(XMLUni::fgDOMValidate, false); config->setParameter(XMLUni::fgXercesCacheGrammarFromParse, true);
config->setParameter(XMLUni::fgSAX2CoreValidation, true); config->setParameter(XMLUni::fgXercesUseCachedGrammarInParse, true);
config->setParameter(XMLUni::fgXercesDynamic, true);
} }
#endif #endif
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *document= parser->parseURI(path.c_str()); XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *document= parser->parseURI(path.c_str());
@@ -165,8 +164,11 @@ XmlNode *XmlIo::load(const string &path, std::map<string,string> mapTagReplaceme
return rootNode; return rootNode;
} }
catch(const DOMException &ex) { catch(const DOMException &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while loading: [%s], %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(ex.msg)); char szBuf[8096]="";
throw runtime_error("Exception while loading: " + path + ": " + XMLString::transcode(ex.msg)); sprintf(szBuf,"In [%s::%s Line: %d] Exception while loading: [%s], msg:\n%s",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(ex.msg));
SystemFlags::OutputDebug(SystemFlags::debugError,"%s\n",szBuf);
throw runtime_error(szBuf);
} }
} }