Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; use XML::XPath; my $file = $ARGV[0]; my $xp = XML::XPath->new(filename=>$file); for my $n (1 .. 32812) { my $wnposnodeset = $xp->find('/e/p//w[@id='.$n.']/a[@name="wn"]'); my @wns; if (my @wnnodelist = $wnnodeset->get_nodelist) { @wns = map($_->string_value, @wnnodelist);} my $lnodeset = $xp->find('/e/p//w[@id='.$n.']/a[@name="l"]'); my @ls; if (my @lnodelist = $lnodeset->get_nodelist) { @ls = map($_->string_value, @lnodelist);} print "@ls#@wns\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: large XML file in using XPATH
by ikegami (Patriarch) on Nov 05, 2009 at 16:49 UTC | |
|
Re: large XML file in using XPATH
by oha (Friar) on Nov 05, 2009 at 16:11 UTC | |
by Anonymous Monk on Nov 05, 2009 at 16:18 UTC | |
by mattk1 (Acolyte) on Nov 05, 2009 at 21:02 UTC | |
|
Re: large XML file in using XPATH
by happy.barney (Friar) on Nov 05, 2009 at 16:29 UTC | |
by Anonymous Monk on Nov 05, 2009 at 16:47 UTC | |
by happy.barney (Friar) on Nov 06, 2009 at 06:36 UTC | |
|
Re: large XML file in using XPATH
by mirod (Canon) on Nov 07, 2009 at 07:34 UTC | |
by Anonymous Monk on Jun 03, 2013 at 00:37 UTC |