Answer the question
In order to leave comments, you need to log in
PHP processor for processing xml+xslt?
There is an initial xml store (or a php script that generates an xml catalog from the database)
and xslt (generated in php dynamically depending on the parameters passed to the script)
The essence of the problem: if an xml file is processed up to 10MB, then everything is fine.
but on xml ~ 17+ mb falls due to lack of memory. (on the server I set the maximum script processing time and the maximum possible allocated memory, the problem was not solved)
I do the processing through xsltprocessor
$xml = new DOMDocument;<br>
$xml->load('http://site.ru/yandex_market.php');<br><br>
$xsl = new DOMDocument;<br>
$xsl->load('http://mysite.ru/manager/template.php?a='.$_GET['a'].'&o='.$_GET['o'].'&c='.$_GET['c']);<br><br>
// Configure the transformer<br>
$proc = new XSLTProcessor;<br>
$proc->importStyleSheet($xsl); // attach the xsl rules<br><br>
echo $proc->transformToXML($xml);<br>
<?php<br><br>
// Разместить новый XSLT-процессор<br>
$xh = xslt_create();<br><br>
// Обработать документ<br>
if (xslt_process($xh, 'sample.xml', 'sample.xsl', 'result.xml')) {<br>
print "SUCCESS, sample.xml was transformed by sample.xsl into result.xml";<br>
print ", result.xml has the following contents\n<br>\n";<br>
print "<pre>\n";<br>
readfile('result.xml');<br>
print "</pre>\n";<br>
}<br>
else {<br>
print "Sorry, sample.xml could not be transformed by sample.xsl into";<br>
print "result.xml the reason is that " . xslt_error($xh) . " and the ";<br>
print "error code is " . xslt_errno($xh);<br>
}<br><br>
xslt_free($xh);<br><br>
?><br>
Answer the question
In order to leave comments, you need to log in
Without going into the wilds of the php code, I can only remind you of one thing - in case of lack of memory (the DOM is bold, it does not fit), you need to change the parser to SAX
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question