Disable xml errors on check svg

This commit is contained in:
Oleg Korshul
2019-07-23 15:16:11 +03:00
parent 8926c52369
commit 5612c09b0c
3 changed files with 24 additions and 2 deletions

View File

@ -5587,6 +5587,8 @@ namespace SVG
return false;
#endif
bool bRet = false;
if (model)
{
m_model = model;
@ -5594,10 +5596,12 @@ namespace SVG
std::wstring sXml;
NSFile::CFileBinary::ReadAllTextUtf8(strFile, sXml);
return LoadFromString(sXml, model);
XmlUtils::IXmlDOMDocument::DisableOutput();
bRet = LoadFromString(sXml, model);
XmlUtils::IXmlDOMDocument::EnableOutput();
}
return false;
return bRet;
}
inline bool LoadFromString (const std::wstring& strXml, Storage* model)
{

View File

@ -143,6 +143,9 @@ namespace XmlUtils
virtual unsigned int AddRef();
virtual unsigned int Release();
static void DisableOutput();
static void EnableOutput();
};
class CXmlNodeBase;

View File

@ -34,6 +34,11 @@
namespace XmlUtils
{
static void libxml2_err_no(void * ctx, const char * msg, ...)
{
// none
}
IXmlDOMDocument::IXmlDOMDocument()
{
m_lRef = 1;
@ -54,6 +59,16 @@ namespace XmlUtils
delete this;
return lReturn;
}
void IXmlDOMDocument::DisableOutput()
{
xmlSetGenericErrorFunc(NULL, (xmlGenericErrorFunc)libxml2_err_no);
}
void IXmlDOMDocument::EnableOutput()
{
xmlSetGenericErrorFunc(NULL, NULL);
}
}
namespace XmlUtils