use strict;
use warnings;
use XML::LibXML;
my $parser = XML::LibXML->new();
# Uncomment next line to try it on a file.
# my $doc = $parser->parse_file( shift || die "Gimme an XML file!\n" );
my $doc = $parser->parse_fh(\*DATA); # This is just for demo.
my @target = $doc->findnodes("//something");
my $whee = "a";
$_->setAttribute("else", $whee++) for @target;
print $doc->serialize(1), $/; # For this demo.
# $doc->toFile("./fixed.xml"); # For file writing.
__DATA__
__END__