Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

parsing of huge xml files

parsing of huge xml files

9:32 am on Jan 5, 2009 (gmt 0)

New User

5+ Year Member

joined:Nov 12, 2008
posts: 4
votes: 0

I have a large xml file(around 50mb).I have tried many xml parsing codes
but all give me memory error.
I have even changed the memory limit to 256mb and above using ini_set command,but in vain.
I need a memory efficient parser.Could you please help me.
10:27 am on Jan 5, 2009 (gmt 0)

Full Member

10+ Year Member

joined:Nov 28, 2002
votes: 0

If you are using a pre-written script you may find it is putting everything from the xml into an array. For an xml file this size that might be what's leading to your memory problem. Modify it to only store the data you need and see if that helps.

Also, try using a stream-oriented method this should be much more memory efficient. Use XML Parser in php, documentation can be found here: [uk.php.net ]

12:16 pm on Jan 5, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Dec 7, 2008
votes: 0

Dear flexi,

You can read it as small chunk in a loop.