diff --git a/src/Container.cpp b/src/Container.cpp index 427b6e8c..34c4667c 100644 --- a/src/Container.cpp +++ b/src/Container.cpp @@ -104,10 +104,6 @@ void digidoc::initialize(const string &appInfo, const string &userAgent, initCal m_userAgent = userAgent; LIBXML_TEST_VERSION - xmlLineNumbersDefaultValue = 1; - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - xmlSubstituteEntitiesDefault(1); - xmlIndentTreeOutput = 1; if(xmlSecInit() < 0) THROW("Error during initialisation of xmlsec."); if(xmlSecCheckVersion() != 1) diff --git a/src/XMLDocument.h b/src/XMLDocument.h index a71c2d8e..de656d70 100644 --- a/src/XMLDocument.h +++ b/src/XMLDocument.h @@ -252,11 +252,9 @@ struct XMLNode: public XMLElem XMLNode& operator=(sv text) noexcept { - if(!d || text.empty()) + if(!d) return *this; - xmlChar *content = xmlEncodeSpecialChars(d->doc, pcxmlChar(text.data())); - xmlNodeSetContent(d, content); - xmlFree(content); + xmlNodeSetContent(d, pcxmlChar(text.data())); return *this; } @@ -325,8 +323,10 @@ struct XMLDocument: public unique_xml_t, public XMLNode return is->good() || is->eof() ? int(is->gcount()) : -1; }, nullptr, &is, XML_CHAR_ENCODING_NONE), xmlFreeParserCtxt); ctxt->linenumbers = 1; + ctxt->options |= XML_PARSE_NOENT|XML_PARSE_DTDLOAD|XML_PARSE_DTDATTR|XML_PARSE_NONET; + ctxt->loadsubset |= XML_DETECT_IDS|XML_COMPLETE_ATTRS; if(hugeFile) - ctxt->options = XML_PARSE_HUGE; + ctxt->options |= XML_PARSE_HUGE; auto result = xmlParseDocument(ctxt.get()); if(result != 0 || !ctxt->wellFormed) THROW("%s", ctxt->lastError.message);