It worked when I tried it (see below). Does $twig->get_xpath("//img") return any result?
What I tried:
#!/usr/bin/perl use strict; use warnings; use XML::Twig; my $twig= XML::Twig->parse( \*DATA); for my $item ($twig->get_xpath("//img")) { $item->change_att_name('src', 'links') } $twig->print; __DATA__ <html> <body> <p><img src="foo"/></p> <p><img src="bar"/></p> </body> </html>
In reply to Re: change attribute name using XML::Twig
by mirod
in thread change attribute name using XML::Twig
by aakikce
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |