Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Swaping xml elements using XML::Twig

by Samy_rio (Vicar)
on Apr 27, 2007 at 09:43 UTC ( [id://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';

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-20 00:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found