Marsel has asked for the wisdom of the Perl Monks concerning the following question:
I have to parse an XML file which is ... 1,8 Go large ! My first try was with a simple XML::Parser::Wrapper and of course, it worked perfectly with an example, but ended with 'out of memory' with the real one !!
I then found on the net an article from Kip Hampton from 2001 (on XML.com) which starts with : "The Problem : The XML documents you have to parse are getting too large to load the entire document tree into memory; performance is suffering. The solution : use SAX". So i drop into XML::SAX, and after a while, understood (i hope) how to code my own handler package with common 'start_element', 'end_element', 'characters', ... methods to do the job.
Again everything is going well with the test file, but when i launch the script with the big one, memory usage starts to reach 100%, then it's the swap usage, and then ... i killed it.
Do you think it could comme from a bad way of coding, or is the module inapropriated, for such a big file ? And if so, would you know a module i could use to read the file inline, without loading all into memory ?
Thanks
julien
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to Parse Huge XML Files ?
by marto (Cardinal) on May 31, 2006 at 17:17 UTC | |
|
Re: How to Parse Huge XML Files ?
by samtregar (Abbot) on May 31, 2006 at 17:54 UTC | |
|
Re: How to Parse Huge XML Files ?
by davido (Cardinal) on May 31, 2006 at 17:55 UTC | |
|
Re: How to Parse Huge XML Files ?
by jsegal (Friar) on May 31, 2006 at 17:46 UTC | |
by Marsel (Sexton) on Jun 01, 2006 at 04:21 UTC | |
by jsegal (Friar) on Jun 01, 2006 at 16:05 UTC | |
|
Re: How to Parse Huge XML Files ?
by ambrus (Abbot) on Jun 01, 2006 at 13:28 UTC | |
|
Re: How to Parse Huge XML Files ?
by toma (Vicar) on Jun 02, 2006 at 23:58 UTC |