You're doing something else wrong then. This works just fine.
#!/usr/bin/env perl use strict; use warnings; use XML::Twig (); my $twig = XML::Twig->new; $twig->parse( qq{<img src="/foo/bar.jpg" />\n} ); for my $img ( $twig->get_xpath( "//img" ) ) { $img->change_att_name( 'src', 'links' ); } $twig->print; exit 0; __END__ ## Outputs: <img links="/foo/bar.jpg"/>
In reply to Re: change attribute name using XML::Twig
by Fletch
in thread change attribute name using XML::Twig
by aakikce
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |