Dear Monks
I have already asked same type of the doubt earlier. I have asked for converting the text splitted with tab space to elements.
Now im facing 2 problems. Even though i some what managed the first one, im unable to solve the second.
First one is:
Im having the input file separated by tabspaces
Input: <thead> abc bcd def abc bcd def abc bcd def </thead> OUTPUT: <thead> <row><col>abc</col><col>bcd</col><col>def</col></row> <row><col>abc</col><col>bcd</col><col>def</col></row> <row><col>abc</col><col>bcd</col><col>def</col></row> </thead>
I have done it by using subs_text(qr{(.+?)\n}m,"row") and then for each row again doing subs_text(qr{(.+?)\t}m,"col"). the problem im getting is first two columns are get converted but not the last column because of absence of tab at last. I have managed to convert last column with "col" by getting last child of the row which is text and then wrap it with "col" value. Am I doing right. I think this will be done more easier than what i have done. If so How?
My second question is:
If i already have some elements inside the same content given above. For example,
Input: <thead> abc <ex>bcd</ex> <lp>def</lp> abc <ex>bcd</ex> def abc bcd def </thead> OUTPUT: <thead> <row><col>abc</col><col><ex>bcd</ex></col><col><lp>def</lp></col></row +> <row><col>abc</col><col><ex>bcd</ex></col><col>def</col></row> <row><col>abc</col><col>bcd</col><col>def</col></row> </thead>
For the above code each "\n" is for the row separation but i m not able to convert the input into the required output. I dont know how to select the content upto tab space. I face problem only when a tab space is between two elements.
Please give me suggestions for the above questions.
Thanks in advance
--Murugesan.
In reply to AGAIN XML::Twig tag conversion by murugu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |