Transform XML with meta columns to csv in PDI

22 Views Asked by At

I have the below XML structure as input (number of columns/fields and rows can change based on query)

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <results>
        <metadata>
            <column name="item" type="S" length="255"/>
            <column name="client" type="S" length="255"/>
        </metadata>
        <data>
            <row>
                <field>ACME-ITEM-01</field>
                <field>ACME</field>
            </row>
        </data>
    </results>
</response>

I want to use Pentaho Data Integration PDI (aka Kettle) or Apache HOP to convert this to a CSV file. What would be the best approach to do this?

I have no problem parsing XML files in PDI where each segment has its own name but here I am banging my head against the wall.

1

There are 1 best solutions below

0
Max B On

Just figured out that this is exactly what the Metadata injection step was built for.