1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| #!/usr/bin/perl
use warnings;
use strict;
use XML::Simple;
my $file = "test.xml";
open (Entree_Tmp, "$file");
my $parser = XML::Simple->new( KeepRoot => 1 );
my $doc = $parser->XMLin($file);
foreach my $Personne( @{ $doc->{racine}->{Personne}}) {
if (exists $Personne->{Individu}->{LieuNaissance}->{'content'}){
my $Vil_Nai =$Personne->{Individu}->{LieuNaissance}->{'content'}; print $Vil_Nai ;}
if (exists $Personne->{Individu}->{LieuNaissance}->{'code'}){
my $Code_Nai =$Personne->{Individu}->{LieuNaissance}->{'code'}; print $Code_Nai ;}
}
close(Entree_Tmp); |