Like xml_parse()
(see xml_parse No memory error PHP ) the function xml_parse_into_struct()
seems to have memory troubles.
Parsing an XML file (size over 9MB) gives me the error 'No memory' on the last line, last char.
$report_errors = true;
$parser = xml_parser_create('UTF-8');
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_parse_into_struct($parser, $data, $vals);
if ($report_errors) {
$errorcode = xml_get_error_code($parser);
echo xml_error_string($errorcode) . ' line ' .
xml_get_current_line_number($parser) . ' column ' .
xml_get_current_column_number($parser) . PHP_EOL;
// No memory line 3876 column 8
}
xml_parser_free($parser);
When I do not ask for errors, everything is fine: (But I do not trust it)
$report_errors = false;
Is there a way to implement chunk loading (as in link mentioned above) with
xml_parse_into_struct()
?
( Debian 9.5 amd64, PHP 7.0.30, libxml2 2.9.4 )