Export DSS input files (csv or txt) into XML

cbimou
cbimou Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 12 Partner

Hi dear,

I need to output a dataset into an XML format.

Here my input file : people.csv

Id; firstname ; lastname ; age ;date

PERSONID1 ; LUNA;HUANG ;10 ;31/01/2022

PERSONID2 ; PATRICK;FALL;90 ;11/01/2012

PERSONID3 ; KENDAL;CASANOVA;90 ;12/06/2009

I want my output file look like this:

<?xml version="1.0"?>

<document date="2021-12-31">

<people filename="peoples.csv" people_id="PERSONID1">

<FIELD fieldname="firstname" value="LUNA"/>

<FIELD fieldname="lastname" value="HUANG"/>

<FIELD fieldname="age" value="10"/>

<FIELD fieldname="date" value="31/01/2022"/>

</people>

<people filename="people.csv " people_id="PERSONID2">

<FIELD fieldname="firstname" value="PATRICK"/>

<FIELD fieldname="lastname" value="FALL"/>

<FIELD fieldname="age" value="90"/>

<FIELD fieldname="date" value="11/01/2012"/>

</people>

<people filename="people.csv " people_id="PERSONID3">

<FIELD fieldname="firstname" value="KENDAL"/>

<FIELD fieldname="lastname" value="CASANOVA"/>

<FIELD fieldname="age" value="90"/>

<FIELD fieldname="date" value="12/06/2009"/>

</people>

</document>

I have tried this script (input.png)

the output I get does not suit me. It looks like this (output.png)

Is there any way to do this in DataIku?

Tagged:

Best Answer

  • cbimou
    cbimou Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 12 Partner
    Answer ✓

    Hi @CoreyS

    Thanks for the suggestion. I finally found a solution by using folders as input for my flat file and as output for the xml. This way I get the Folder_IDs to easily use a python script to convert csv to xml.


    Thanks

Answers

  • CoreyS
    CoreyS Dataiker Alumni, Dataiku DSS Core Designer, Dataiku DSS Core Concepts, Registered Posts: 1,150 ✭✭✭✭✭✭✭✭✭

    Hi @cbimou
    while you wait for a more complete response, here are some resources you may find helpful

    • XML (Documentation)

    I hope this helps!

Setup Info
    Tags
      Help me…