I can't really see what your code is supposed to do, what's with the zipcodes?
Here is an example of how to get data from a file using XML::XPath:
#!/usr/bin/perl -w use strict; use XML::XPath; my $file = 'available_batchnyyn.xml'; my $xp = XML::XPath->new(filename=>$file); # /AvailableBatch/Available is faster than //Available my @available = $xp->findnodes('/AvailableBatch/Available'); foreach my $available (@available) { my $part= $available->findvalue( './Part[1]'); # the [1] is not re +ally needed my $qty= $available->findvalue( './Qty[1]'); $part=~ s{\s+$}{}; # you might need to + trim all values print "part $part - qty: $qty\n"; }
In reply to Re: XML::XPath tricks and tips
by mirod
in thread XML::XPath tricks and tips
by dstefani
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |