Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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.

Replies are listed 'Best First'.
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: (8)
As of 2016-06-26 04:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (327 votes). Check out past polls.