Adds support to SecXMLExternalEntity

This commit is contained in:
Felipe Zimmerle
2016-05-18 17:01:53 -03:00
parent 6a7b970fe3
commit f989ecd5cb
13 changed files with 215 additions and 30 deletions

View File

@@ -39,14 +39,6 @@ bool ValidateDTD::init(const std::string &file, const char **error) {
xmlSetGenericErrorFunc(NULL,
null_error);
m_dtd = xmlParseDTD(NULL, (const xmlChar *)m_resource.c_str());
if (m_dtd == NULL) {
std::string err = std::string("XML: Failed to load DTD: ") \
+ m_resource;
*error = strdup(err.c_str());
return false;
}
return true;
}
@@ -54,6 +46,14 @@ bool ValidateDTD::init(const std::string &file, const char **error) {
bool ValidateDTD::evaluate(Transaction *t, const std::string &str) {
xmlValidCtxtPtr cvp;
m_dtd = xmlParseDTD(NULL, (const xmlChar *)m_resource.c_str());
if (m_dtd == NULL) {
std::string err = std::string("XML: Failed to load DTD: ") \
+ m_resource;
t->debug(4, err);
return true;
}
if (t->m_xml->m_data.doc == NULL) {
t->debug(4, "XML document tree could not "\
"be found for DTD validation.");