in reply to Re^2: Open a zip file content question!
in thread Open a zip file content question!

use Archive::Zip::MemberRead; my $xmlfile = XML::XPath->new(ioref => $xml[0]->readFileHandle );

Replies are listed 'Best First'.
Re^4: Open a zip file content question!
by Anonymous Monk on Mar 04, 2011 at 13:55 UTC
    Almost, but still giving an error:
    my $zipfile = "test.zip"; my $zip = Archive::Zip->new( $zipfile ) || die; my @xml = $zip->membersMatching( '.*\.XML' ); my $xmlfile = XML::XPath->new(ioref => $xml[0]->readFileHandle ); #error: not well-formed (invalid token) at line 1, column 24, byte 24: Archive::Zip::MemberRead=HASH(0x2063604) =======================^
      Almost, but still giving an error:

      Keep going?

        The problem still remains, that's what I meant. Here is the code I am tying with your recommendations, any suggestions?
        #!/usr/bin/perl use strict; use warnings; use Archive::Zip; use Archive::Zip::MemberRead; 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); my $xmlfile = XML::XPath->new(ioerf => $xml[0]->readFileHandle ); 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"; } } } }
        That's the frustrating error:
        not well-formed (invalid token) at line 1, column 24, byte 24: Archive::Zip::MemberRead=HASH(0x2061dfc) =======================^ at C:/Perl/lib/XML/Parser.pm line 187