Skip to content

Commit

Permalink
Allow to set empty content to node and remove deprecated api usage (#612
Browse files Browse the repository at this point in the history
)

IB-8164

Signed-off-by: Raul Metsma <raul@metsma.ee>
  • Loading branch information
metsma authored Aug 15, 2024
1 parent 79d7001 commit ae91b69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 4 deletions src/Container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/XMLDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,9 @@ struct XMLNode: public XMLElem<xmlNode>

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;
}

Expand Down Expand Up @@ -325,8 +323,10 @@ struct XMLDocument: public unique_xml_t<decltype(xmlFreeDoc)>, 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);
Expand Down

0 comments on commit ae91b69

Please sign in to comment.