Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

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




Messages by Day
April 30th 2008
April 29th 2008
April 28th 2008
April 27th 2008
April 26th 2008
April 25th 2008
April 24th 2008
April 23rd 2008
April 22nd 2008
April 21st 2008
April 20th 2008
April 19th 2008
April 18th 2008
April 17th 2008
April 16th 2008
April 15th 2008
April 14th 2008
April 13th 2008
April 12th 2008
April 11th 2008
April 10th 2008
April 9th 2008
April 8th 2008
April 7th 2008
April 6th 2008
April 5th 2008
April 4th 2008
April 3rd 2008
April 2nd 2008
April 1st 2008


Messages by Month
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000