sloth456 Posted November 30, 2010 Share Posted November 30, 2010 I have an xml file thats about 20MB, I want to parse it all into an array. SimpleXML seems to have trouble processing it, I just get "Fatal error: Balloc() failed to allocate memory". I've googled this topic and can't seem to find a straight forward solution. There must be someone here who has had to do this before. Is there an easy way to parse this? Quote Link to comment https://forums.phpfreaks.com/topic/220243-simple-way-to-parse-large-xml-files/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 30, 2010 Share Posted November 30, 2010 The XML Parser - http://us2.php.net/manual/en/book.xml.php allows you to parse an XML document line by line. I do however recommend that you wrap the call-back functions in a OOP/Class so that you can share class variables as necessary between the call-back functions to 'remember' the present state/current tag name... Quote Link to comment https://forums.phpfreaks.com/topic/220243-simple-way-to-parse-large-xml-files/#findComment-1141365 Share on other sites More sharing options...
sloth456 Posted November 30, 2010 Author Share Posted November 30, 2010 I really appreciate your input, I've seen this page before but I'm finding it really hard to understand. Is there a good tutorial you can point me to? Or even better, a ready made function/class? Sorry to be such a noob, I'm finding this hard! Quote Link to comment https://forums.phpfreaks.com/topic/220243-simple-way-to-parse-large-xml-files/#findComment-1141395 Share on other sites More sharing options...
eo92866 Posted November 30, 2010 Share Posted November 30, 2010 i agree with PFMaBiSmAd... the link provided has a lot of information if you sit down and read all of it... but you want something fast... so... read the following links and you should get to where you'd like. http://php.net/manual/en/ref.simplexml.php this one will get you the tutorial that you are looking for http://www.ibm.com/developerworks/library/x-pullparsingphp.html Quote Link to comment https://forums.phpfreaks.com/topic/220243-simple-way-to-parse-large-xml-files/#findComment-1141418 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.