cancel
Showing results for 
Search instead for 
Did you mean: 

XML to CSV Conversion

Former Member
0 Kudos

Hi,

I have a xml file which i need to convert to CSV file.

I am able to do it for a single node but when i try to do it for 2 nodes ,then its not happening.both the rows are coming in the same line but I want it to come in separate lines.I have gone thru the sdn and sap documentation .There I could find only the properties of Content Conversion or conversion for only one node.

Could anyone help me with the content conversion parameters to be maintained on the recevier side.

Xml Input ---

<?xml version="1.0" encoding="UTF-8"?>

<ns0:File2CSV_Src_MT xmlns:ns0="http://Rohit_File2CSV">

<Result>

<Student>

<Name>Rohit</Name>

<English>34</English>

<Maths>34</Maths>

<Hindi>5</Hindi>

</Student>

<Student>

<Name>Das</Name>

<English>34</English>

<Maths>34</Maths>

<Hindi>5</Hindi>

</Student>

</Result>

</ns0:File2CSV_Src_MT>

The output I want is -


Rohit,34,34,5

Das,34,34,5

Regards,

Rohit

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rohit,

You need to configure Content converstion at reciver file adapter.

Recordset structure as : Result,Student

Change the parameters as:

Result.addHeaderline: 0

Result.fieldSeperator : nl

Student.fieldSeperator: ,

Student.endSeperator: nl

Ref: /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion

Thanks,

Ravi

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Thanks to all for helping me out.

regards,

rohit

Former Member
0 Kudos

Hi,

I am getting the output in 2 rows in wordPad and XML editor but not in NotePad.

Output in WordPad/XML editor -


Rohit,34,34,5

Das,34,34,5

Notepad -


Rohit,34,34,5Das,34,34,5

So what should I do to get hte same output in Notepad..

regards,

Rohit

Former Member
0 Kudos

Hi,

Its not required.

Your Output as per your requirement is correct.

In notepad the contents of multipleline is merged and displayed and not so in the Wordpad.

Babu

Former Member
0 Kudos

Notepad and Wordpad are differently processing/displaying the special symbol of new line. If you use CRLF as the line separator, then the result will look the same for both the editors.

So that should be something like: \r\n (carriage return + new line/line feed).. in the content conversion that would become => '0x45''0x42'.

Former Member
0 Kudos

Hi Babu,

Thanks a lot...........

Regards,

Rohit

RKothari
Contributor
0 Kudos

Hi,

Have you used below parameter in your FCC?

Student.endSeparator 'nl'

Former Member
0 Kudos

Hi Rahul,

Yes I have used the parameter --Student.endSeparator 'nl'.

Former Member
0 Kudos

Hi Rohit,

Reactivate the Channel in ID and try. Also, check for the cache notification.

Regards,

Pranav