[Edinburgh-pm] XML module recommendations

Marco Fontani fontani at gmail.com
Mon Jun 6 10:40:15 PDT 2011

> I'd like to extract a list of all the hashes: ie, the content of every
> attribute matching the XPath /changelog/patch/@hash. What's the best
> CPAN module for that sort of thing?

If I have no need for the "goodies" of other XML parsers, I use XML::Bare.
It's fast, to the point and doesn't try to do too much.

See http://darkpan.com/files/xml-parsing-perl-gripes.txt for my rant on the topic.

That said,

% perl -MXML::Bare -le'
   $x   = XML::Bare->new(file => $ARGV[0]);
   $xml = $x->parse;
   print $_->{hash}->{value} for @{ $xml->{changelog}->{patch} };
' test.xml


I think the above is close to what you need?


Marco Fontani
Glasgow Perl Mongers - http://glasgow.pm.org/
Join the RackSpace Cloud at: http://www.rackspacecloud.com/277.html

More information about the Edinburgh-pm mailing list