in reply to Is it possible to parse an XML file recursively using XML::Twig?

Yes, though you'll most probably want to process a whole twig, not just the individual leafs. Without more details about the XML it's impossible to be more specific.

Another contender would be XML::Rules. With the right handlers it can process huge files easily.

Update: I do not use XML::Twig myself. This is an example of what you could do with XML::Rules:

use strict; use XML::Rules; my $parser = XML::Rules->new( stripspaces => 7, rules => { _default => 'content', Book => sub { my ($tag,$attr) = @_; if (!$attr->{Title}) { return; }# no title, OK. ignore print "$attr->{Title} by $attr->{Author} was released $att +r->{Released}\n"; return; }, }, ); $parser->parse(\*DATA); # or $parser->parsefile('path/to/the/file');

Jenda
Enoch was right!
Enjoy the last years of Rome.

Replies are listed 'Best First'.
Re^2: Parsing a huge XML document recursively
by Ppeoc (Beadle) on Oct 20, 2015 at 04:06 UTC
    I have edited the question adding more details. Could you please help me?