Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Is that a way to do this, I have a sample code that shows what I am trying g to accomplish.# After getting the XML file in @xml, how can I use it on the next lin +e. my @xml = $zip->membersMatching( '.*\.XML' ); # here is the issue! my $xml_file = XML::XPath->new(ioref => @xml);
Thanks a lot!#!/usr/bin/perl use strict; use warnings; use Archive::Zip; use XML::XPath; my @numberstocheck = qw(112334 999888 222333 999888 0008877 003344 122 +2334 00009 004443 999888); my $zipfile = "test.zip"; my $zip = Archive::Zip->new( $zipfile ) || die; my @xml = $zip->membersMatching( '.*\.XML' ); my $xmlfile = XML::XPath->new(ioref => @xml); foreach my $row ($xmlfile->findnodes('/alllist')) { my $nodeset = $row->find('phnumbers'); foreach my $node ( $nodeset->get_nodelist ) { my $numbers = $node->find( 'numbers')->string_value; print "\n 19 - $numbers \n"; foreach (@numberstocheck) { if (/^($numbers)/g) { print "$numbers - ".$_."\n"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Open a zip file content question!
by Anonymous Monk on Mar 04, 2011 at 01:14 UTC | |
by Anonymous Monk on Mar 04, 2011 at 03:03 UTC | |
by Anonymous Monk on Mar 04, 2011 at 05:12 UTC | |
by Anonymous Monk on Mar 04, 2011 at 13:55 UTC | |
by Anonymous Monk on Mar 04, 2011 at 14:06 UTC | |
| |
|
Re: Open a zip file content question!
by Anonymous Monk on Mar 04, 2011 at 14:44 UTC | |
by Anonymous Monk on Mar 04, 2011 at 15:05 UTC |