<root> <test> <name att="abc">file</name> <href>file.txt</href> </test> <test> <name att="cde">file1</name> <href>file1.txt</href> </test> </root> Now I want to modify the value of the "name" tag inside "test" node wh +ich has att=abc only. #!usr/bin/perl use XML::Twig; use Data::Dumper; my $t= XML::Twig->new( twig_roots => { name => \&convert, }, twig_print_outside_roots => 1, ); $t->parsefile_inplace( 'data.xml'); sub convert { my( $t, $name)= @_; $name->set_text( 'sriram'); $name->print; } I have written this code but it is replacing the text of all name tags + but I want to do it specific to it.I am new to perl ...wants your he +lp....Thanks in advance....:)
In reply to XML::Twig parsing Problem by saurabh.x.pandey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |