Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: how to convert tab separated text lines into xml files

by Corion (Pope)
on Feb 19, 2012 at 18:11 UTC ( #954903=note: print w/ replies, xml ) Need Help??


in reply to how to convert tab separated text lines into xml files

You don't tell us what XML schema you intend to output, nor do you show any code you have attempted to write yourself.

My approach would be:

#!perl -wle while (<>) { s!^!<row><value>!; s!\t!</value><value>!g; s!$!</value></row>!; print; };

If you need more structure in your XML, you will have to tell us what structure.


Comment on Re: how to convert tab separated text lines into xml files
Download Code
Re^2: how to convert tab separated text lines into xml files
by mirod (Canon) on Feb 19, 2012 at 19:10 UTC
    You would also need to escape & and < in the text, and make sure you get the encoding right.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://954903]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (18)
As of 2014-07-10 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (210 votes), past polls