murugu has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks
Im now doing XML conversion job from a plain text file which has been pre-edited for conversion convenience.
Im having the text file in which there are four types of lists are there.
they are numberedlist which is pre-edited with <nl>, unnumberedlist with <un>, titled numberedlist <tl> and unnumbered title list <utl>.
A part of my input file is like this:
<nl> slkjslkjslkjslks slkjslkjslkjslkjs slkslkjslkjsl <utl>lksjlkjslkjs lskjslkjslkjs slkjslkjslkjslkj </utl> <un>lkslskjlkjs <nl>lksjlksj lkjlkjl </nl> </un> </nl>
This is just a single instance of the nesting in the file. there are so many occurences are there in such a way that any list tag may consist of any number of list tags inside in any order in it, even itself inside. The above input has to be converted as :
<list type="numbered"> <listitem>slkjslkjslkjslks</listitem> <listitem>slkjslkjslkjslkjs</listitem> <listitem>slkslkjslkjsl</listitem> <listitem><list type="unnumeredtitle"><listitem>lksjlkjslkjs</listitem +> <listitem>lskjslkjslkjs</listitem> <listitem>slkjslkjslkjslkj</listitem> </list></listitem><listitem><list type="unnumbered"><listitem>lkslskjl +kjs</listitem> <listitem><list type="numbered"><listitem>lksjlksj</listitem> <listitem>lkjlkjl</listitem> </list></listitem> </list></listitem> </list>
How should i start convert this text file into valid XML file
My english is not that good.
Please Give ur suggestions.
Thanks in advance.
--Murugesan--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Recursive lists
by merlyn (Sage) on Mar 23, 2004 at 14:56 UTC | |
by chip (Curate) on Mar 23, 2004 at 15:00 UTC | |
by merlyn (Sage) on Mar 23, 2004 at 15:07 UTC | |
by murugu (Curate) on Mar 23, 2004 at 15:17 UTC | |
by dragonchild (Archbishop) on Mar 23, 2004 at 15:45 UTC | |
by pbeckingham (Parson) on Mar 23, 2004 at 15:50 UTC |