http://www.perlmonks.org?node_id=1100261


in reply to Easy XML-parser that can handle large file?

Hello DreamT

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

http://www.effectiveperlprogramming.com/2011/07/rewrite-xml-with-xmltwig/
http://www.effectiveperlprogramming.com/2010/03/process-xml-data-with-xmltwig/
http://it-is-etc.blogspot.it/2012/07/perl-how-to-manipulate-xml-files-using.html
http://perlmeme.org/tutorials/parsing_xml.html
speed comparison http://www.robinclarke.net/archives/xml-parsing-with-perl
http://www.xml.com/pub/a/2001/03/21/xmltwig.html
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


HtH
L*



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.