If you want to parse multi-megabyte text nodes, you have to use the XML_PARSE_HUGE
option. So instead of xmlNewTextReaderFilename
, use the xmlReaderForFile
constructor which allows to pass parser options:
reader = xmlReaderForFile(filename, NULL, XML_PARSE_HUGE);
This option is disabled by default to prevent DoS attacks.