Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

How to read multiple child elements and write into different xml format

by umesh_epub (Novice)
on Sep 13, 2011 at 13:52 UTC ( #925701=perlquestion: print w/ replies, xml ) Need Help??
umesh_epub has asked for the wisdom of the Perl Monks concerning the following question:

My input is like This

<articleorder>
<group>
<article-ref rid="1"/>
</group>
<group>
<group>
<title><![CDATAGroupI]></title>
<article-ref rid="2"/>
</group>
</group>
<group>
<group>
<title><![CDATAGroupI]></title>
<title><![CDATAGroupII]></title>
<article-ref rid="4"/>
</group>
</group>
<group>
<group>
<title><![CDATAGroupI]></title>
<title><![CDATAGroupII]></title>
<article-ref rid="8"/>
</group>
</group>
<group>
<group>
<title><![CDATAGroupI]></title>
<title><![CDATAGroupII]></title>
<title><![CDATAGroupIII]></title>
<article-ref rid="5"/>
</group>
</group>
<group>
<article-ref rid="6"/>
</group></articleorder>

Output i want like this


<group>
<article-ref rid="1"/>
<group>
<title>GroupI</title>
<article-ref rid="2"/>
<group>
<title>GroupII</title>
<article-ref rid="4"/>
<article-ref rid="8"/>
<group>
<title>GroupIII</title>
<article-ref rid="5"/>
</group>
</group>
</group>
<article-ref rid="6"/>
</group>

Comment on How to read multiple child elements and write into different xml format
Re: How to read multiple child elements and write into different xml format
by ww (Bishop) on Sep 13, 2011 at 14:00 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (14)
As of 2014-12-19 16:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (90 votes), past polls