Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 (Archbishop) 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?
[ELISHEVA]: \Disciplus : lol
[Discipulus]: and ELISHEVA we waait one your post since ~2years... ;=)
[ELISHEVA]: has it really been that long?
[Discipulus]: it seems..
[Discipulus]: more: just one thread in the last ~5 years
[Discipulus]: but Dumas is waiting for me in the bed.. luckly as book author.. see you!
[ELISHEVA]: Sleep well!
[ELISHEVA]: Or read well
[Discipulus]: thanks, best dreams to you all

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2017-05-28 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?