cancel
Showing results for 
Search instead for 
Did you mean: 

Remove a line from payload in file to file scenario

Former Member
0 Kudos

Hi

I got this strange problem in a file to file scenario.

A customer is sending an xmlfile. I need to do content based routing on this payload in receiver determination. I have NO mapping required.

I have two target systems.

Here comes the issue:

the file the customer is sending has the xmltag <?xml-stylesheet...> on the second line of each single xml file. This causes the content based routing (using XPATH) to error (naturally).

My initial thought is to remove the second line of each single payload in the adapter via a module. Is that possible and how?

See the xml her:

really appreciate any help

Cheers

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Booby,

You could use an XSL-mapping for this purpose:

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

    <xsl:template match="/">

        <xsl:copy-of select="."/>

    </xsl:template>

</xsl:stylesheet>

Sorry, i didn't read that you dont want a map, if you dont find the adapter solution you can use this map

I've seen this option in the module adapter, but i dont test it:

Regards

Message was edited by: Iñaki Vila

Former Member
0 Kudos

Thx

Tried your XSLT - that just copies EVERYTHING, I need to exclude the <?xml-stylesheet... line.

Also I tried codepageconversion bean. That did not work either.

Anyone who can help with xslt that does the job? I would really appreciate it

iaki_vila
Active Contributor
0 Kudos

Hi,

You are right, sorry.

If you root element is AKNOWLEDGEMENT:

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

    <xsl:template match="/">

        <xsl:copy-of select="AKNOWLEDGEMENT"/>

    </xsl:template>

</xsl:stylesheet>

This time i've tried the option

Regards.

Former Member
0 Kudos

Hi,

Java mapping is also an option ..but code suggested above will also work.

http://scn.sap.com/thread/3184205

Thanks

Amit Srivastava

Former Member
0 Kudos

Thanks Inaki. Did the job

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi, I think it my be a bit risky to remove the second line all the time. What if the XML file comes all together in a single line or something like that?

Why don't you just create a very simple XSLT mapping to do this?

Thanks,

Pablo

Former Member
0 Kudos

Well I do not want any mapping. High performance/throughput is required