Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 scrutinizing the Monastery: (10)
As of 2015-05-28 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (550 votes), past polls