cancel
Showing results for 
Search instead for 
Did you mean: 

Receiver File channel for XML files: with carriage return

Former Member
0 Kudos

Hi all,

we are using a receiver FILE channel to generate an XML file that is sent to an external partner.

The XML file looks good in a parser (IExplorer). But in fact there are not carriage return / line feeds between the XML tags

of the XML payload in the file.

Our partner now requires the XML file in a more vertical structure which means: for every tag a separate line (like it is displayed in a parser)

Does anybody know a more general way to convert to a vertical XML structure (so with carriage return line feed).

There is one entry in the SDN dealing with this topic but suggesting using an UDF. I think this is a very specific way.

I don't think it is a good way to change/enhance the message mapping just because of a general formating change.

Is it better to use an XSLT mapping as a second step in the interface mapping or a JAVA adapter module to convert ?

any experiences? suggestions? examples?

Thank you very much

best regards

Hans

examples:

original by XI receiver FILE adapter

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

<MT_batchStatus><type>BS</type><header><message><messageSender>SENDER</messageSender><messageDate>20090723143720</messageDate> ... and so on

required:

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

<MT_batchStatus>

<type>BS</type>

<header>

<message>

<messageSender>SENDER</messageSender>

<messageDate>20090723143720</messageDate>

... and so on

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Hans,

Here's a generic example if you decide to use xslt:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes" />

     <xsl:template match="@*|node()">
         <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
         </xsl:copy>
     </xsl:template>
    
</xsl:stylesheet>

-Russ

Former Member
0 Kudos

Hi Russel,

thank you very much. This XSLT solved the problem.

Best regards

Hans

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi!

I think the best way is to use an adapter module. SAP has built such a sample for the inbound case. But it should also be possible to adapt this sample to the outbound case. It is part of the adapter module development how to guide.

Presentation: https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/00838345-708c-2a10-1199-9514c0b0a91c

Guide: ... cannot find it anymore for PI 7.1. Please search for thing like this: "How To Module Adapter Engine"

Regards,

Volker

Shabarish_Nair
Active Contributor
0 Kudos

>

> Is it better to use an XSLT mapping as a second step in the interface mapping or a JAVA adapter module to convert ?

> any experiences? suggestions? examples?

In such a case, the best is to write an generic XSLT or Java mapping that will attempt to do the pretty printing/formatting of the xml.

The advantage of a generic one is that you can reuse the same class/jar for many other scenarios.

so the flow will be as below in your interface mapping;

1. your specific source to target mapping

2. the generic formatting class