Hello.
I tried this but I saw this script works just fine. How do you invoke the program? I did like this.
perl this_pg.pl target.xml SOMETHING 1
With XML::Twig, similar things would go like this.
use strict;use warnings;
use XML::Twig;
my $xmlfile=$ARGV[0];
my $values_flag=$ARGV[0] || 0;
my $twig =XML::Twig->new(
twig_handlers => {'//*' => sub {
my($twig,$elt)=@_;
if ( $elt->descendants == 1 ){
print $elt->path;
print " := " . $elt->first_child_text if ( $values_fla
+g );
print "\n";
}
}
},
)->parsefile($xmlfile);
|