@@ -303,8 +303,8 @@ struct XMLDocument: public unique_free_d<xmlFreeDoc>, public XMLNode
303303 d = {};
304304 }
305305
306- XMLDocument (std::string_view path, const XMLName &n = {}) noexcept
307- : XMLDocument(path.empty() ? nullptr : xmlParseFile(path.data ()), n)
306+ XMLDocument (const std::string & path, const XMLName &n = {}) noexcept
307+ : XMLDocument(path.empty() ? nullptr : xmlParseFile(path.c_str ()), n)
308308 {}
309309
310310 static XMLDocument openStream (std::istream &is, const XMLName &name = {}, bool hugeFile = false )
@@ -314,27 +314,26 @@ struct XMLDocument: public unique_free_d<xmlFreeDoc>, public XMLNode
314314 is->read (buffer, len);
315315 return is->good () || is->eof () ? int (is->gcount ()) : -1 ;
316316 }, nullptr , &is, XML_CHAR_ENCODING_NONE ));
317- #if VERSION_CHECK(XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR) >= VERSION_CHECK(1, 3, 0)
318- ctxt->options |= xmlSecParserGetDefaultOptions () & ~XML_PARSE_HUGE ;
319- #else
320317 ctxt->options |= XML_PARSE_NOENT |XML_PARSE_DTDLOAD |XML_PARSE_DTDATTR |XML_PARSE_NONET |XML_PARSE_NODICT ;
321- #endif
318+ #if LIBXML_VERSION >= 21300
319+ ctxt->options |= XML_PARSE_NO_XXE ;
320+ #else
322321 ctxt->loadsubset |= XML_DETECT_IDS |XML_COMPLETE_ATTRS ;
322+ #endif
323323 if (hugeFile)
324324 {
325325 ctxt->options |= XML_PARSE_HUGE ;
326326#if LIBXML_VERSION < 21300
327327 if (ctxt->sax )
328- ctxt->sax ->entityDecl = 0 ;
328+ ctxt->sax ->entityDecl = nullptr ;
329329#endif
330330 }
331331 auto result = xmlParseDocument (ctxt.get ());
332332 if (result != 0 || !ctxt->wellFormed )
333333 {
334334 if (const xmlError *lastError = xmlCtxtGetLastError (ctxt.get ()))
335335 THROW (" %s" , lastError->message );
336- else
337- THROW (" Failed to parse XML document from stream" );
336+ THROW (" Failed to parse XML document from stream" );
338337 }
339338 return {ctxt->myDoc , name};
340339 }
0 commit comments