in reply to change attribute name using XML::Twig

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"/>

Replies are listed 'Best First'.
Re^2: change attribute name using XML::Twig
by aakikce (Acolyte) on Apr 26, 2007 at 13:15 UTC

    Hello Monks,

    Sorry. It is working. please ignore this.

      Tell us what you were doing wrong. It's nice having a reference.

      Igor 'izut' Sutton
      your code, your rules.