XML Input String

The XML input string can be a literal string containing XML data. For example:


Alternatively, the XML string can be a parameter containing the XML data. For example:


If the XML does not contain an XML encoding attribute, the XML parser uses UTF-8. If the input string contains an sequence that is not valid UTF-8, the script fails.

There are two options for handling invalid UTF-8.

  • Include an XML declaration with the appropriate encoding attribute. For example: <?xml version="1.0" encoding="ISO-8859-1"?>

  • Escape invalid UTF-8 hexadecimal characters. For example, it the input contains ,\xe6rre escape it by adding an additional back-slash: \\xe6rre

Example of escaped XML

XML=<employee id=\"1\"><name>John Smith</name><profession>scientist\\xenobiologist</profession></employee>

Example of fixing an XML returned from a server

char text_buffer[10000];

strcpy(text_buffer, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");

strcat(text_buffer, xml_input);

lr.saveString(text_buffer, "Param_errorList")