Monks i need to cut a element with children and paste in another location. I tried using XML::Twig. But i could not able to get correct output. I have shown below what i tried and sample example. where am i going wrong?
input: ------ <test> <author> <name><snm>surname</snm><fnm>firstname</fnm></name> </author> <player> <name><snm>surname</snm><fnm>firstname</fnm></name> </player> <some> <here>here some text</here> </some> </test> output: ------- <test> <player> <name><snm>surname</snm><fnm>firstname</fnm></name> </player> <some> <here>here some text</here> <author> <name><snm>surname</snm><fnm>firstname</fnm></name> </author> </some> </test> my $twig = new XML::Twig( pretty_print = +> 'indented' + ); $twig->parse($input); my $pl = XML::Twig::Elt->new("$place"); for ($twig->get_xpath($path)) { $_->cut ; $_->paste('last_child', $pl) ; } $input = $twig->sprint;
In reply to XML::Twig 'cut' and 'paste' by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |