|Just another Perl shrine|
Re: Easy XML-parser that can handle large file?by Discipulus (Abbot)
|on Sep 11, 2014 at 07:32 UTC||Need Help??|
I was in your same situation 2 years ago, facing for the first time the shaggy thing that XML is..
I tried many modules starting with the XML::Simple, which name was intriguing. Here in the monastery there are at many parties about XML parsing: XML::Parser XML::LibXML XML::Rules XML::XSH2 (a wrapper around XML::LibXML) and XML::Twig
I finally choosed XML::Twig and naw i'm very happy of the choice.
The central problem is the ability to parse XML by chunks, instead of reading the whole file. This feature (shared by best modules) let you to parse huge files without memory problems.
XML::Twig has many resources and maaany method to parse XML. You can find infos on CPAN or in the home site of Twig wher you find also good tutorials
so, 1) forget XML::Simple, 2) choose a module of those suggested or jump directly on XML::Twig here some sparse links about Perl and XML
speed comparison http://www.robinclarke.net/archives/xml-parsing-with-perl
ambrus's Do not reinvent the wheel: real-world example using XML::Twig and also http://perl-xml.sourceforge.net/faq/ and choroba about XML
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.