in reply to Re: How to read compressed (gz) file in xml::twig
in thread How to read compressed (gz) file in xml::twig
Thanks Hauke for the solution! That works but script takes a lot time in providing the output. Can this be reduced? Gzipped file is of 45MB. Total children (Offer) are 158K.
And, second question wasn't related to the first; that was different. Here is the code snippet.my $file = 'Offerfeed_11742413_uk.full.xml.gz'; my $z = IO::Uncompress::Gunzip->new($file) or die "gunzip failed: $IO: +:Uncompress::Gunzip::GunzipError\n"; my $twig = new XML::Twig; ## Get twig object $twig->parse($z); ## parse the file to build twig my $root = $twig->root; ## Get the root element of twig my @elements = $root->children; ## Get elements list of twig my $ct = 0; foreach my $e (sort @elements){ my $cpc = ($e->first_child('EstimatedCPC')->text)*100; print $cpc,"\n"; $ct++; } print $ct,"\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to read compressed (gz) file in xml::twig
by marto (Cardinal) on Feb 20, 2017 at 12:11 UTC | |
|
Re^3: How to read compressed (gz) file in xml::twig
by haukex (Archbishop) on Feb 20, 2017 at 16:07 UTC | |
by CSharma (Sexton) on Feb 22, 2017 at 03:08 UTC |