Withdata Software

Convert XML to CSV with node path as header

I see a post Convert XML to CSV (with node path as header) using XSLT, the poster have this XML data:

<tXML>
    <Header>
        <Source>XPTO</Source>
        <User_ID>127</User_ID>
        <Message_Type>Ship</Message_Type>
        <Company_ID>105</Company_ID>
        <Msg_Locale>English (United States)</Msg_Locale>
        <Version>2017</Version>
    </Header>
    <Message>
        <Ship>
            <ShipSummary>
                <ComName>XPTO 123</ComName>
                <FacName>6</FacName>
            </ShipSummary>
        </Ship>
    </Message>
</tXML>

He want to convert to CSV like this:

tXML/Header/Source,tXML/Header/User_ID,tXML/Header/Message_Type,tXML/Header/Company_ID,tXML/Header/Msg_Locale,tXML/Header/Version,tXML/Message/Ship/ShipSummary/ComName,tXML/Message/Ship/ShipSummary/FacName
XPTO,127,Ship,105,English (United States),2017,XPTO 123,6

I don’t like using XSLT, I like my tool Data File Converter, so I test, it can do this, in a minute.

1. Open XML file, set XML options.

2. set CSV options.

3. “Next” and “Next”, convert, get output CSV file.