From 3b964ebbd283a49d1497c3f024c9ec934dbd2895 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 14 Mar 2012 00:33:23 +0000 Subject: [PATCH] - fixed xerces crash with version 3 and higher --- source/shared_lib/sources/xml/xml_parser.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/shared_lib/sources/xml/xml_parser.cpp b/source/shared_lib/sources/xml/xml_parser.cpp index f81fd3392..b2934018c 100644 --- a/source/shared_lib/sources/xml/xml_parser.cpp +++ b/source/shared_lib/sources/xml/xml_parser.cpp @@ -144,10 +144,9 @@ XmlNode *XmlIo::load(const string &path, std::map mapTagReplaceme else { config->setParameter(XMLUni::fgXercesSchema, false); config->setParameter(XMLUni::fgXercesSchemaFullChecking, false); - //config->setParameter(XMLUni::fgDOMValidateIfSchema, true); - config->setParameter(XMLUni::fgDOMValidate, false); - config->setParameter(XMLUni::fgSAX2CoreValidation, true); - config->setParameter(XMLUni::fgXercesDynamic, true); + config->setParameter(XMLUni::fgXercesLoadExternalDTD, false); + config->setParameter(XMLUni::fgXercesCacheGrammarFromParse, true); + config->setParameter(XMLUni::fgXercesUseCachedGrammarInParse, true); } #endif XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *document= parser->parseURI(path.c_str()); @@ -165,8 +164,11 @@ XmlNode *XmlIo::load(const string &path, std::map mapTagReplaceme return rootNode; } 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)); - throw runtime_error("Exception while loading: " + path + ": " + XMLString::transcode(ex.msg)); + char szBuf[8096]=""; + 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); } }