You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
524 B
Perl

use XML::Parser;
$parser = new XML::Parser(Handlers => {Start => \&start_handler, Char => \&char_handler});
$parser->parsefile("yourXML.xml");
$customer = 0;
$data_ok = 0;
sub start_handler
{
$data_ok = 0;
if ($_[1] eq "tagName"){
$customer++;
}
if ($customer == 2){
if($_[1] eq "tagName2"){
$data_ok++;
}
}
}
sub char_handler
{
if(($_[1] =~ /[^ \n\t\r]/g) && $data_ok){
print "First name: $_[1]\n";
}
}