in reply to Re: XML::XPath and processing multiple files
in thread XML::XPath and processing multiple files
For some reason I thought I'd added chomp before and it didn't work:use XML::XPath; use XML::XPath::XMLParser; my $filelist = shift; #Process file list open(FILELIST, "$filelist") or die("Unable to open file"); my @files = <FILELIST>; close(FILELIST); foreach $page (@files) { my $xp = XML::XPath->new(filename => $page); my $nodeset = $xp->find('//DCR'); # find all DCRs my @nodelist = $nodeset->get_nodelist; #@dcrs = map($_->string_value, @nodelist); @dcrs = map {$_->string_value ? $_->string_value : ()} @nodeli +st; foreach my $dcr(@dcrs) { print "$dcr\n"; } }
chomp($page);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: XML::XPath and processing multiple files
by Corion (Patriarch) on Jul 15, 2013 at 14:48 UTC | |
by ATLien (Initiate) on Jul 15, 2013 at 14:53 UTC | |
by Corion (Patriarch) on Jul 15, 2013 at 14:57 UTC | |
|
Re^3: XML::XPath and processing multiple files
by poj (Abbot) on Jul 15, 2013 at 15:36 UTC | |
|
Re^3: XML::XPath and processing multiple files
by ATLien (Initiate) on Jul 15, 2013 at 14:50 UTC | |
by Corion (Patriarch) on Jul 15, 2013 at 14:51 UTC | |
by ATLien (Initiate) on Jul 15, 2013 at 14:55 UTC | |
by Anonymous Monk on Jul 15, 2013 at 23:43 UTC |