Skip to content

Commit

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

IB-8164

Signed-off-by: Raul Metsma <raul@metsma.ee>
  • Loading branch information
metsma authored and klemensn committed Nov 12, 2024
1 parent 7abc057 commit dd2f776
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 dd2f776

Please sign in to comment.