Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Swaping xml elements using XML::Twig

by Samy_rio (Vicar)
on Apr 27, 2007 at 09:43 UTC ( #612342=note: print w/ replies, xml ) Need Help??


in reply to Swaping xml elements using XML::Twig

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.


eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';


Comment on Re: Swaping xml elements using XML::Twig
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://612342]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-08-31 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls