Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2016-12-08 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (142 votes). Check out past polls.