bonjour a tous,
je dois changer la valeur du tag 'status' dans un fichier XML.
ci joint le code
le lecture est bonne , mais pas l'affectation
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 use XML::Twig; my $ficDocXML ='C:/XML_mail/recipients.xml'; my $ficOutXML = 'C:/XML_mail/recipients_out.xml'; my $FH; open ($FH,">$ficOutXML"); my $twig= new XML::Twig; $twig->parsefile($ficDocXML); # build the twig my $root= $twig->root; # get the root of the twig (stats) my @players= $root->children; # get the player list foreach my $player (@players) { my $status = $player->first_child('status')->text; # get the text of status print "status : $status\n"; $player->first_child('status')->text = 3; # bug.... } $twig->print; $twig->print($FH); print "\n\n"; exit(0);
merci pour votre aide
Partager