in reply to How to parse a xml file using XML::DOM??

Personally i think XML::DOM is not going to be the right solution, if your input xml file is very large. My perfered choice for parsing xml is XML::Twig. I am using it to parse very large files, and it is doing it quickly with a low memory usage. The same may apply for other modules, however i am most familiar with XML::Twig.

I whipped up a short example, on how you can do the parsing with XML::Twig. Since i do not know exactly what you intend to do, i added several example method calls to get you on the right track (in case you ever decide to use it).
use strict; use warnings; use Data::Dumper; #use Data::Dumper::Concise; # i prefer Data::Dumper::Concise use XML::Twig; # individually process each <signal> element sub signal_handler { my ($data, $twig, $elem) = @_; # get the attributes of $elem (<signal>) my $atts = $elem->atts(); if ($atts->{'sigid'} == 3464) { print "Found <signal> with sigid == 3464:\n",$elem->sp +rint(),"\n"; print "<PRESS ENTER TO CONTINUE>";<STDIN>; } # if you want to access the element in a way similar to XML::S +imple: my $xml_simple_style_elem = $elem->simplify(); # check out the simplified structure: print Dumper($xml_simple_style_elem); print "<PRESS ENTER TO CONTINUE>";<STDIN>; # Example for Data Collection: my ($sigid, $id) = @{$atts}{qw/sigid id/}; if (defined $sigid and defined $id) { $data->{sigid_id_count}{$sigid}{$id}++; } # get all elements below <signal> which are called <foo> my @foo_subelements = $elem->descendants('foo'); $twig->purge; # explicitly free the memory }; sub main { my $fn = shift @ARGV; my %collected_data; my $twig = XML::Twig->new( twig_roots => { 'signal' => sub {signal_handler(\%collect +ed_data, @_);}, }, ); eval { $twig->parsefile($fn); }; if ($@) { print STDERR "Failed to parse '$fn' ($@)\n"; } if (%collected_data) { print "I collected the following data:\n",Dumper(\%col +lected_data); } } main();