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)
_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: arch...@mail-archive.com

Reply via email to