cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent problem with invalid char in XML

Former Member
0 Kudos

Hello experts,

I need help for the following problem:

I read a text file via File Sender using Content Conversion. An XML will be generated. But this XML includes invalid files, and my mapping throws an exception:

The illegal character is:

<DOCUMENTTYPE>��Value2</DOCUMENTTYPE>

Runtime exception occurred during application mapping com/sap/xi/tf/_MM_PSTest_TO_IDOC_; com.sap.aii.utilxi.misc.api.BaseRuntimeException:Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Invalid char #0x0 (:main:, row:4, col:2~

How can I solve this issue, without using Java Mapping? I use as File Encoding UTF-8 for the File Sender.

Thanks for your support,

Erkan

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Erkan,

                  Either the sender has to remove those characters before sending the file or you need a java mapping before the message mapping to remove special characters.  If you want to go with second alternative then please publish the exact ASCII value of the characters you want to remove from XML and the version of PI you are working in.

Regards

Anupam

Former Member
0 Kudos

Hello all,

thanks for your answers.

@Anupam

I will use XSLT mapping. Our PI Version is 7.11 The invalid characters is as follows:

<DOCUMENTTYPE>ÿþValue2</DOCUMENTTYPE>

The invalid character is highlighted.

The File Encoding which the file sender use is ISO-8859-1 .

Kind regards,

Erkan

Former Member
0 Kudos

Hello all,

thanks for your answers.

@Anupam

I will use XSLT mapping. Our PI Version is 7.11 The invalid characters is as follows:

<DOCUMENTTYPE>ÿþValue2</DOCUMENTTYPE>

The invalid character is highlighted.

The File Encoding which the file sender use is ISO-8859-1 .

Kind regards,

Erkan

stefan_grube
Active Contributor
0 Kudos

This is a byte order mark http://en.wikipedia.org/wiki/Byte_order_mark

It does not make sense in ISO-8859-1

Request a file without this BOM.

XSLT mapping would not help, as it would fail also.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Erkan,

                From your response , it seems you decided to remove the characters using mapping than request the sender to remove such characters before sending the files. In such case XSLT mapping will not help. you need a java mapping here. When I say ascii value of characters you can find it out by downloading this HEX editor http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm .

View the xml containing invalid characters using hex editor , you will get the ASCII values of characters you want to remove. Then you need a java mapping to actually remove the characters.

Regards

Anupam 

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello all,

thanks for you support. I will ask the provider to fix this file as Stefan Grube suggested.

Kind regards,

Erkan

Former Member
0 Kudos

Hi Erkan,

Hope you have set the following for your file sender adapter :

1. Transfer Mode is set to Binary,

2. File Type Text,

3. Encoding ISO-8859-1( for Western European Latin ).

Your sender file after coming into Pi has XML encoding declaration 'UTF-8'.

Write a simple XSLT mapping to change the value of the attribute "encoding" to "ISO-8859-1" in the output XML of message mapping . Include this XSLT map as the second mapping step in your interface mapping.

First step in your interface mapping will be your already existing message mapping.

Please follow this doc http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79f...

Best Regards,

Sagarika

naveen_chichili
Active Contributor
0 Kudos

Hi,

Ask your source side to correct the data with out any special charecters.

Regards,

Naveen    

stefan_grube
Active Contributor
0 Kudos

The provider of the file has to fix it. An ascii 00 value is not allowed in a text file.