XML Functions (LR_XML) > XML Input String

XML Input String

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

"XML=<employee>JohnSmith</employee>

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

"XML={EmployeeNameParam}"

If the XML does not contain an XML encoding attribute, the LoadRunner 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.

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_save_string(text_buffer, "Param_errorList")