cancel
Showing results for 
Search instead for 
Did you mean: 

Add Line breaks in xml output file in SAP CPI

former_member277492
Participant
0 Kudos

Hello Experts,

I am working on an Integration between SF and CPI wheres the desired output file is XML.

After generating output XML file, Client is unable to process it at their end saying Line breaks are missing in the file and seeing the whole of it in one single line.

Can someone please help me how to add the Line breaks in the XML file. Receiver end it's a SFTP server.

Thanks in advance,

Best Regards,

Sree

Accepted Solutions (1)

Accepted Solutions (1)

Hi sreekar,

You could use XSLT mapping to indent the output.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output omit-xml-declaration="yes" indent="yes"/>
	<xsl:template match="node()|@*">
		<xsl:copy>
			<xsl:apply-templates select="node()|@*"/>
		</xsl:copy>
	</xsl:template>
</xsl:stylesheet>

Hope this helps !

thanks and regards,

Praveen T

MortenWittrock
Active Contributor
0 Kudos

Agreed. I would go with the XSLT 3 identity transformation, though. It's much simpler, and XSLT 3 is supported in CPI.

Regards,

Morten

Answers (2)

Answers (2)

former_member277492
Participant
0 Kudos

Hello All,

Thank you for the quick response.

@Praveen, I have already Implemented the XSLT mapping for namespace replacement in the current design and i have included indent="yes" tag provided by you and it's working fine.

I have accepted the answer and closed the thread too.

Thank you for the support!!

Best Regards,

Sree

ajmaradiaga
Developer Advocate
Developer Advocate
0 Kudos

I've not tried this myself but it might be possible to pretty print the XML by using Groovy XmlUtil class - https://blog.mrhaki.com/2012/10/groovy-goodness-pretty-print-xml.html