Jump to content

Need Help Converting Text to XML

So, at work, we just found out that a software we use to manage our databases will be making some major changes in the next year. One major change is how we upload raw data to the database. Currently, we can upload text (tab delimited) files and/or .csv and everything works fine, but they are changing it to only accept .xml files. It won't be a big deal to start creating them as these files, the problem is that we now need to convert years worth of raw data into xml format.

 

Is there terminal based tool (or anything else in Linux) that can handle the conversion?

Link to comment
Share on other sites

Link to post
Share on other sites

From here theres 

Quote

On the community website on converting there is a link to a command line tool called csv2xml. Since it is unmaintained you might want to choose another option.

There is also mention of a java tool called csv2xml (warning: website is in German) and a command line tool called ff-extractor.

The link also has references to Python, Perl, PHP, XSLT but that means you need to code the converter yourself.

Assuming you know the basic format of the files as well as the structure of the files/folders then you should be able to use a bash/sh script to work through the txts and convert them using the command line tool or which ever language you prefer. My bash is too rusty to even attempt the code right now, but just a script to recursively check the folder system for the text files, run the program/tool on it as called for, and save it with the appropriate name. In windows, something like this 

Quote

for /r %%a in ("*data.txt") do convert "%%a" "%%~na.xml"

 

                     .
                   _/ V\
                  / /  /
                <<    |
                ,/    ]
              ,/      ]
            ,/        |
           /    \  \ /
          /      | | |
    ______|   __/_/| |
   /_______\______}\__}  

Spoiler

[i7-7700k@5Ghz | MSI Z270 M7 | 16GB 3000 GEIL EVOX | STRIX ROG 1060 OC 6G | EVGA G2 650W | ROSEWILL B2 SPIRIT | SANDISK 256GB M2 | 4x 1TB Seagate Barracudas RAID 10 ]

[i3-4360 | mini-itx potato | 4gb DDR3-1600 | 8tb wd red | 250gb seagate| Debian 9 ]

[Dell Inspiron 15 5567] 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×