Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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
Replies are listed 'Best First'.
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 surveying the Monastery: (6)
As of 2015-08-02 11:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found
    past polls