I am getting error "Invalid XML input: Character reference &#x1a is an invalid XML character" while

satyabratasatyabrata Posts: 2

Hi All,

I need the data to stored in xml data bank , so that i can compare with REST response.

The query is running fine without xml databank and giving the invalid xml error after adding the result as XML databank.

Please let me know how to fix this issue.

satyabrata Das


  • OmarROmarR Posts: 174 admin

    Hello Satyabrata,

    Do you see the same error after enabling the "Encode XML characters" option in your DB tool?
    See the following:

  • benken_parasoftbenken_parasoft Posts: 329 ✭✭✭

    &#x1a is a control character. Control characters are illegal in XML 1.0. Control characters, aside from the null character, are legal in XML 1.1 when expressed as a character reference. You may have to modify the XML prior to sending it to the data bank, either stripping "&#x1a" or modifying the XML version in the prolog from 1.0 to 1.1.

  • OmarROmarR Posts: 174 admin

    In XML 1.0, control characters and characters out of the Unicode ranges are not allowed. However, control characters are allowed in XML 1.1, but are discouraged.
    See https://stackoverflow.com/a/28152666 for more information on this.

    As @benken_parasoft stated above, You can modify the XML prior to passing it though the databank. You can do this by chaining an extension tool to the DB tool to remove the illegal characters OR change the XML version="1.0" to version="1.1.".
    The setup would look like the following:

    Below is a groovy script to do this.

    import com.parasoft.api.*;
    public String Replace(Object data){
    data = data.toString().replaceAll("", "");
    //data = data.toString().replaceAll("version=\"1.0\"", "version=\"1.1\"");
    return data.toString();
Sign In or Register to comment.