|
|
 |
Re: FN-FORUM: php xml_parser
date posted 15th April 2008 14:43
Quoting Martin Wheatley [EMAIL REMOVED]
>
> On 15/04/2008 15:34, Steven wrote:
>>
>> Hi Guys,
>>
>> I'm really pulling my hair out here. I am using the following class to
>> parse a number of xml files that I am retrieving from a remote server.
>> Each xml file has 1000 row tags E.G. ... etc. I can parse the
>> first xml file fine, no problems however when I try to get the next xml
>> file. I get the following error (I have set php.ini to use 48MB of memory=
).
>>
>> *Fatal error*: Allowed memory size of 50331648 bytes exhausted (tried to
>> allocate 32 bytes) in
>> */var/www/rainbow/public_html/php/classes/merlin.class.php* on line *139
>>
>> in each loop i use the following code.
>>
>> while(glob("*.xml") as $filename) {
>> $xml_data =3D $this->getXmlData($filename);
>> $xml_parser =3D new xml();
>> $xml_parser->parse($xml_data);
>> $dom =3D $xml_parser->dom;
>> * }
>>
>> If I change the code and move the * $xml_parser =3D new xml(); line to
>> before the while loop, I do not get the fatal error, however the
>> contents of $dom remain as the previous loop xml contents.
>>
>> Does any one have any ideas to over come this?
>>
>> Steve
>> *
>
I'd suggest opening the file in smaller chunks, if poss. It looks to =20
me like your XML file is huge, and is being loaded in all at once.
As a first step, you could try the inbuilt simplexml_load_file ( =20
http://uk.php.net/simplexml_load_file ) directive, which might give =20
you some more clues.
Alex
http://www.ozbon.com
|
 |
|