cancel
Showing results for 
Search instead for 
Did you mean: 

Need to remove XML header <?xml version="1.0" encoding="utf-8" ?>

Former Member
0 Kudos

Hi Experts

Please help me to remove "<?xml version="1.0" encoding="utf-8" ?>" from output xml (XML after message mapping), I need to post the XML message having no header <?xml version="1.0" encoding="utf-8" ?> to target via SOAP.

Regards,

Raghav

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks experts for you valuable inputs..

I am closing this thread now.

Thanks

Raghav

Former Member
0 Kudos

Hi.

You can use Standard Adapter Modules without code.

Please check the below thread.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

XMLAnonymizerBean is for removing or adding namespace prefix. Here the requirement is different. This wont help. Better option is XSLT mapping or Java mapping. I'm wondering this line <?xml version="1.0" encoding="utf-8" ?> should not cause any issue.

Former Member
0 Kudos

Go for java mapping. Even XSLT will add that line because it indicates that the file is an xml and should be treated as such.

Former Member
0 Kudos

Hi raghav,

Use the below Generic XSLT code from this link,

http://sap-pi7.blogspot.com/2011/03/generic-xslt-code-to-remove-namespaces.html

I have used it. it works.

-santosh.

Former Member
0 Kudos

H.Ciochina,

The ' omit-xml-declaration="yes" 'code will omit the declaration.

So the code


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

would do it.

Regards,

Konrad

Edited by: Konrad Thalheim on Jan 26, 2012 5:23 PM; wrong spelling.

former_member184681
Active Contributor
0 Kudos

You can even connect the two: prepare a graphical mapping for the entire structure, and then pass the result to a simple XSLT mapping that will just delete the <?xml... definition. I guess it will be the simplest solution to solve your problem: you will not have to use XSLT for whole mapping (which might be difficult), but still you will be able to avoid the <?xml... tag.

Former Member
0 Kudos

Raghav,

you can always use XSLT Mapping or Java Mapping to remove the declaration.

See also for XSLT:

and for Java:

Regards,

Konrad

former_member184681
Active Contributor
0 Kudos

Hi,

I'm not sure if this is really possible, but you can try setting the "Do Not Use SOAP Envelope" indicator in receiver adapter. Unfortunately, you will have to generate the SOAP Envelope on your own, in the mapping.

Hope you find this useful,

Greg