cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid XML Character (Unicode: 0x0)

Former Member
0 Kudos

Hello guys,

I have a problem with one mapping. The error is that there is an invalid character ( Unicode: 0x0 ). I have seen this is the null character, but how can I found it?

I can't test the message mapping because we have a dynamic configuration function, or there is anyway to test it avoiding the function?

How can I know what is the wrong character? There is any tool that opening the file I can see the character in error.

The scenario is File -> PI -> Proxy

The error is in the message mapping of PI, and file is being taken with Content Conversion, Text Format and UTF-8.

In message mapping the occurence is 0..unbounded so there are no mandatory fields.

Normally this interface is running well but sometimes we have this error.

Many thanks in advance.

Regards,

Xavi.

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

open your file with a hex editor.

You will find free hex editiors for download with google.

Former Member
0 Kudos

Hello Stefan,

I suppose that null character in hex is 00. I don't find this character using a hex tool.

Many thanks,

Xavi.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello guys,

one more thing, this interface is using Dynamic Configuration to take the File Name. Always is working, but I can not test the message mapping.

If I change the message mapping without taking dynamic configuration is working.

Could this be the problem? Reviewing monitoring the File Name is well-formed and with no strange characters.

Many thanks,

Xavi.

Former Member
0 Kudos

Hello guys,

we have seen that the problem is in the original file, sometimes is coming NULL ( we can see it opening with notepad ++ and encoding UTF-8)

The question is, how can we delete this nulls? There is any way to do it in the content conversion of the file adapter? Or we have to create a java module or java class?

Many thanks,

Xavi.

stefan_grube
Active Contributor
0 Kudos

The file must not have a NULL. This is not a valid character. Fix the issue on sender side.

Former Member
0 Kudos

Hello Stefan,

this files are extracts created from different banks, and the client don't want to ask them to change the way they fill the file, so we have to manage to delete this nulls.

Should we have to create a java module to delete? In the operating system command we can call a java class? I suppose that in sender file adapter there is no way to delete the nulls from the lines.

I suppose we have to do it before to take the file, or another way could be to take the file without content conversion, and with a java mapping delete the nulls and create the message we send to R/3.

What do you think about this?

Many thanks,

Xavi.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Xavi,

" suppose we have to do it before to take the file, or another way could be to take the file without content conversion, and with a java mapping delete the nulls and create the message we send to R/3.

What do you think about this?"

Ans)

Yes that's correct. You can follow this blog http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/4018

where without FCC the mapping code directly creates the target XML. you can add code to replace all null characters as example shown below


String line = bin.readLine();
String s="";
for(int i=0;i<line.length();++i)
{
     if(line.charAt(i)!=)0X00)
    {
        s=s+line.charAt(i);
    }

}
line=s;

Any source interface is fine in interface mapping and no need to use FCC. Rest all setrtings will be normal as per the blog.

Regards

Anupam

Former Member
0 Kudos

Hello guys,

I thought the error was with characters like 'ç' or 'ñ' and I changed the file encoding to ISO-8859-1 but I have the same error of the invalid character.

In the original file there are empty lines, but this shouldn't be a problem because the other files are running well.

The files are from different partners, so we think the error could be in the adapter not in the file.

Maybe we have to do another configuration in the adapter?

Many thanks,

Xavi.

Former Member
0 Kudos

This guide talks about encoding in PI, can you check will it be helpful for you.

[http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42]

Regards

Ramesh

Former Member
0 Kudos

Hello Ramesh,

I think the problem is not the encoding, I have tested with UTF-8 and ISO-8859-1 and I have the same error.

Regards,

Xavi.

Former Member
0 Kudos

Xavi,

Try ISO-8859-2 and check it out!

ç - seems to be a latin character. For more information on encoding check this link ht[http://en.wikipedia.org/wiki/%C3%87|http://en.wikipedia.org/wiki/%C3%87]

Regards

Ramesh

Former Member
0 Kudos

Hello Ramesh,

is the same error. I think there is another problem.

Regards,

Xavi.

Former Member
0 Kudos

Hi,

Unicode: 0x0 means you get null value for certain element. Please check whether you look for value from the null element during mapping or so? Are you configuring optional elements as mandatory in the file adapter and that cause the error?

regards,

ganesh.

Former Member
0 Kudos

Hello ganesh,

ther are no mandatory fields.

The configuration of the adapter is in content conversion:

Document number: XXXX

Recordset Structure: ROW,*

Recordset Sequence: Ascending

Recordsets per Message: 1

And in configuration:

ROW.endSeparator 'nl'

ROW.fieldSeparator 'nl'

ROW.fieldNames Line

ignoreRecordsetName true

In processing we have File Type: Text and Encoding: UTF-8

Is strange because this interface is failing only a few times.

Regards,

Xavi.

Former Member
0 Kudos

Hi,

Defining Special Characters in Strings for Separators

You can specify non-printable ASCII characters in all strings for separators (NameA.fieldSeparator, NameA.beginSeparator, and NameA.endSeparator).

○ Insert these characters individually in the strings in the form ´0xHH´ (including quotation marks). HH represents the character encoded as a hexadecimal value.

○ Add a line break using the character ´nl´ (including the quotation marks); nl stands for new line.

○ The special character ´0´ is not a separator character.

regards,

ganesh.