on 06-23-2020 6:00 PM
Hello,
I am using XML to CSV Converter in my Integration process in SAP CPI landscape
I have the input XML format (attached file- inputxml.txt) to XML-CSV Converter
Configuration at the XML-CSV converter
Path to source element: File/Recordset
Field Seperator: n . Rest all the remaining boxes are unchecked
After XML-CSV Converter I am receiving output in below format-
"123,ABC,abc@testing.com"
"456,DEF,def@testing.com"
"789,XYZ,xyz@testing.com"
I am unsure why I am getting " enclosure sign at the start and end of the value. Can anyone help me in understanding why this " sign is appearing?
Thanks
Hi omkar_p,
Based on your input, the output you are receiving is the expected output. This is the standard behaviour.
Any elements under what you configure as 'Path to Source Element in XSD' are copied as individual columns. In your input of /File/Recordset, there is a single element named 'Record', so values of 'Record' are copied one after the other.
If you expect the output like below, perhaps, an XSL transformation might be a better option:
123,ABC,abc@testing.com
456,DEF,def@testing.com
789,XYZ,xyz@testing.com
Here's the XSLT:
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:for-each select="/File/Recordset">
<xsl:value-of select="Record" />
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet><br>
While, this would resolve the issue in this particular case, recommendation would be to redesign the source data model to send individual value in its own tag instead of like this. Example data model could generate data like:
<?xml version='1.0' encoding='UTF-8'?>
<File>
<Recordset>
<Id>123</Id>
<Name>ABC</Name>
<Email>abc@testing.com</Email>
</Recordset>
<Recordset>
<Id>456</Id>
<Name>DEF</Name>
<Email>def@testing.com</Email>
</Recordset>
<Recordset>
<Id>789</Id>
<Name>XYZ</Name>
<Email>xyz@testing.com</Email>
</Recordset>
</File>
In this case, you would be able to configure XML to CSV converter as /File/Recordset and it would generate output like:
"123","ABC","abc@testing.com"
"456","DEF","def@testing.com"
"789","XYZ","xyz@testing.com"
Hope this helps,
Bala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just change the Path to source element:to File/Recordset/Record, it should pick up the elements under Record as columns.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Omkar,
Could you please provide exact input data and expected output data With field separator ( field separator you have provided is not part of the input data in above example ).
Regards,
Sriprasad Shivaram Bhat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sriprasad,
This is my input XML data inputxml.txt to XML-CSV convertor
Path to Source Element in XSD: File/Recordset
Field Separator in CSV: n (New Line)
Expected Output:
123,ABC,abc@testing.com
456,DEF,def@testing.com
789,XYZ,xyz@testing.com
Thanks,
Omkar
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.