Skip to Content
avatar image
Former Member

Urgent problem with invalid char in XML

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Sep 23, 2012 at 09:36 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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 

  • Sep 22, 2012 at 08:51 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 23, 2012 at 06:26 AM

    Hi,

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

    Regards,

    Naveen    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 23, 2012 at 03:04 PM

    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-8aba5d79fb42?QuickLink=index&overridelayout=true&20010252719731

    Best Regards,

    Sagarika

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 23, 2012 at 06:27 PM

    Hello all,

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

    Kind regards,

    Erkan

    Add comment
    10|10000 characters needed characters exceeded