XMLSyntaxError: Maximum entity amplification factor exceeded, see xmlCtxtSetMaxAmplification when parsing large DITA files with DTD validation enabled.

I am getting following error when trying to parse large DITA/DITAMAP files with DTD validation enabled. Seems this is caused by xmlCtxtSetMaxAmplification setting of libxml2 (https://github.com/GNOME/libxml2/blob/master/NEWS) A new API function xmlCtxtSetMaxAmplification was added to allow parsing of files that would otherwise trigger the billion laughs protection. /** * xmlTextReaderSetMaxAmplification: * @reader: an XML reader * @maxAmpl: maximum amplification factor * * Set the maximum amplification factor. See xmlCtxtSetMaxAmplification. */ void xmlTextReaderSetMaxAmplification(xmlTextReaderPtr reader, unsigned maxAmpl) { if (reader == NULL) return; xmlCtxtSetMaxAmplification(reader->ctxt, maxAmpl); } Is it possible to avoid triggering the XMLSyntaxError in the LXML? The parser I am usinbg is constructed as below: dtd_xml_parser = et.XMLParser(dtd_validation=True, no_network=False, huge_tree=True)
participants (1)
-
83lordko ___