Add support to parsing large xml inputs
import logging
+from io import BytesIO
from xml.sax.saxutils import XMLGenerator
from xml.dom import XML_NAMESPACE
@@ -48,7 +49,8 @@ class XMLResult(Result):
if isinstance(xmlstring, text_type):
xmlstring = xmlstring.encode('utf-8')
try:
- tree = etree.fromstring(xmlstring)
+ parser = etree.XMLParser(huge_tree=True)
+ tree = etree.parse(BytesIO(xmlstring), parser)
except Exception as e:
log.exception("Error parsing XML results: %s"%xmlstring)
raise e
