Hi aakikce, Try this,
use strict; use warnings; use XML::Twig; my $twig = XML::Twig->new(pretty_print => 'nice'); $twig->parse(\*DATA); $_->move('before', $twig->get_xpath('//pagesource')) for ($twig->findn +odes('//source')); $twig->print; __DATA__ <root> <pagesource> <para>Teacher's Guide Level A</para> <para><graphic alt="title" links="Studio Logo R BW.tif"/></para> </pagesource> <source> <paragraph>ISBN-13: 978-1-4190-4181-5</paragraph> <paragraph>ISBN-10: 1-4190-4181-9</paragraph> </source> <pagesource> <para>Teacher's Guide Level A</para> <para><graphic alt="title" links="Studio Logo R BW.tif"/></para> </pagesource> <source> <paragraph>ISBN-13: 978-1-4190-4181-5</paragraph> <paragraph>ISBN-10: 1-4190-4181-9</paragraph> </source> </root>
Regards,
Velusamy R.
In reply to Re: Swaping xml elements using XML::Twig
by Samy_rio
in thread Swaping xml elements using XML::Twig
by aakikce
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |