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


in reply to xml parsers: do I need one?

Adding my own experience to what's already been said here...

XML::Parser-based solutions (including XML::Simple) basically use C code to recognize tokens, but then have to build Perl data structures for the entire data tree, even for the parts that aren't being used.

XML::LibXML (if you can get it built and working, because it can be a bit finicky) builds the DOM as a C-side data structure. It's fast. Very fast. From the Perl side, you then ask for precisely the parts of the tree you want (with either DOM or XPath syntax), and only then are the heavyweight Perl objects created for those particular elements.

I've also seen benchmarks that libxml2 (on which XML::LibXML is based) is far faster at just recognizing the tokens than expat (on which XML::Parser is based). This also helps with speed.

I've pretty much abandoned any use of expat-based solutions now. XML::LibXML is it.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.