cancel
Showing results for 
Search instead for 
Did you mean: 

Java Mapping XML Encoding Error.

Former Member
0 Kudos

Hi All,

I hav an IDoc XML coming out of R/3 whose encoding technique is UTF-8. I hav to change it to ISO-8859-1 before parsing the xml in the java mapping program. i have seen this problem repeating among many people but i cud not find any solution on the SDN. Can any one help me out in this regard?

Thnx in Adv.

Anil

Accepted Solutions (0)

Answers (1)

Answers (1)

udo_martens
Active Contributor
0 Kudos

Hi Anil,

put following XSLT a first place of interface mapping:

<?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 encoding="ISO-8859-1"/>
	<xsl:template match="/">
		<xsl:copy-of select="*"/>
	</xsl:template>
</xsl:stylesheet>

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

Thnx for the help. But how can i put that XSLT in the interface mapping? I'm using a java mapping (java class) for my functionality. Help wud b really appreciated.

Thnx

Anil

udo_martens
Active Contributor
0 Kudos

Hi Anil,

no problem. Refer first my mapping then your java mapping in the interface mapping. During Runtime both will be executed. First my and with the result of mine yours. So your Java mapping is running with a XML encoded in latin code

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

Thnx a lot.I'll give a try. If doesn't work, then i'll ping u.....

Cheers

Anil.

Former Member
0 Kudos

Hi Udo,

The Solution Din't work. Any other alternative solution?

I appreciate ur help.

Thnx

Anil

udo_martens
Active Contributor
0 Kudos

Hi Anil,

i tested the script. The output is XML latin encoded. What is your problem? What does it mean exactly "didnt work"?

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

I copied ur code into a notepad file and saved it as .xsl file and zipped the archive. I imported the archive into the Intg Builder and imported into the interface mapping just before my java mapping class. but when i pushed the IDoc from R/3 and opened sxmb_moni, i din't see the encoding converted to 'ISO-8859-1'. it is still reporting the same error that Commander tag(my output xml root node) is not closed. but when i remove those special charecter from my IDoc, the same is working fine. Any help Udo?

Thnx.

Anil

udo_martens
Active Contributor
0 Kudos

Hi Anil,

i'm 99% shure my mapping is also working in XI. Make a test: Copy the XML from IDoc adapter. Go to the inteface mapping in repository and delete the java mapping from it and test it there (dont activate your change list, just delete the change list after testing). How does the result look like? I assume it is latin encoded. That means, my script is ok, but you have to work at your java code. If the result is UTF-8 encoded, my script is working in XML Spy but not in XI. Then we need to look for another solution. Plz inform me about the result of your test.

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

It worked. Really a great help.I will award u some points.

Anil.

udo_martens
Active Contributor
0 Kudos

Hi Anil,

good news just before the weekend. Little success appreciates a depressing week

Regards,

Udo

Former Member
0 Kudos

Hi,

The xsl is creating a new problem. It is inserting a space befor the XML tag in the begining and that blank space is leading to the parser exception. when i tried testing in the Intg Design, it is working properly. but when i execute the scenario, it is creating problems. Any help in this regard?

Thnx

Anil