So dom style http://xmltwig.org
#!/usr/bin/perl -- use strict; use warnings; use XML::Twig; my $t = XML::Twig->new( pretty_print => 'indented' ); $t->xparse(q{<roooooo> <citreference id="mycite"> <linktext> <keyword conref="ds"/> support for IPv6 addresses</linktext> </citreference> <moops></moops> </roooooo>}); $t->print; my( @links ) = $t->findnodes( '//linktext' ); my( $moops ) = $t->findnodes( '//moops' ); for my $link ( @links ){ print $link->path, "\n"; $link->cut->paste( $moops ); } $t->print; __END__ <roooooo> <citreference id="mycite"> <linktext><keyword conref="ds"/> support for IPv6 addresses</linkt +ext> </citreference> <moops></moops> </roooooo> /roooooo/citreference/linktext <roooooo> <citreference id="mycite"></citreference> <moops> <linktext><keyword conref="ds"/> support for IPv6 addresses</linkt +ext> </moops> </roooooo>
In reply to Re^2: XML::Twig - setting text and elements ( reparent move cut detach )
by Anonymous Monk
in thread XML::Twig - setting text and elements
by slugger415
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |