The char '0x0' after '' is not valid XML character

1

I am using Axis 1.4, when I get the response from a webservice developed by a third party, it is giving me the following error:

  

java.io.IOException: java.io.IOException: java.io.IOException:   java.lang.IllegalArgumentException: The char '0x0' after '' is not a   valid XML character

What happens is that you are returning to me in the content of the description field a String of 40 blank spaces. The value that it brings description is: "
                              "

The enconding I use in utf-8

Any idea how to solve it?

    
asked by alejogabriel 04.01.2019 в 14:00
source

1 answer

0

The problem is that your XML contains unicode characters , specifically '0x0' refers to the Null character

This character is probably not visible since it is in the list of "non-printable characters":

An error is occurring when generating the response, I suggest you check the Web Service, instead of delivering the information it is delivering null values .

You can directly review the content of the answer in this page , where the red ones will be shown in red unprintable unicode characters that are causing the problem.

One way to eliminate these unicode characters in the response is by using the following REGEX:

String respuesta_limpia = response.replaceAll("\p{C}", "");
    
answered by 04.01.2019 в 19:30