[TYPO3-dev] EM problems
Martin Kutschker
Martin.Kutschker at n0spam-blackbox.net
Thu Apr 6 09:46:28 CEST 2006
Dimitri Tarassenko schrieb:
>
> Any ideas?
From the PHP docs for xml_parse:
"A document may be parsed piece-wise by calling xml_parse() several times
with new data, as long as the is_final parameter is set and TRUE when the
last data is parsed."
Maybe it is better to feed the xml-file chunkwise to the parser:
class.em_index.php:
t3lib_div::writeFile(PATH_site.'typo3temp/extensions.xml.gz', $extXML);
unzip_the_file(PATH_site.'typo3temp/extensions.xml.gz');
$this->xmlhandler->initExtensionsParser();
$file = fopen(PATH_site.'typo3temp/extensions.xml','r');
while (!feof($file)) {
$this->xmlhandler->parseExtensions(fread($file,1048576));
}
$this->xmlhandler->endExtensionsParser();
class.em_xmlhandler.php:
function initExtensionsParser() {
global $TYPO3_CONF_VARS;
$this->parser = xml_parser_create();
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
// etc
}
function parseExtensions($string) {
xml_parse($this->parser,$string);
}
function endExtensionsParser() {
xml_parse($this->parser,'',TRUE);
xml_parser_free($this->parser);
}
Something like that. Or you do do whole fread-loop in parseExtensionsXML
which then has not a content-string but a file name as parameter:
function parseExtensionsXML($file) {
$parser = xml_parser_create();
// etc
$file = fopen(PATH_site.'typo3temp/extensions.xml','r');
while (!feof($file)) {
xml_parse(fread($file,1048576));
}
// etc
}
Masi
More information about the TYPO3-dev
mailing list