I'm trying to insert an attribute into the root node of an XML fragment in loadrunner, using the lr_xml_insert function.
Code Fragment:
char *inputXML=
"<a>"
"<b>"
"<c></c>"
"</b>"
"</a>";
lr_save_string(inputXML,"paramInputXML");
lr_xml_insert("Xml={paramInputXML}",
"Query=/a",
"ResultParam=Result",
"Position=attribute",
"XmlFragment=attribValue=\"0\"",
LAST);
lr_output_message(lr_eval_string("String after insertion: {Result}"));
Desired output:
String after insertion: <a attribValue="0"><b><c/></b></a>
Actual Loadrunner output
String after insertion: <a><b><c/></b>attribValue="0"</a>
The function behaves as expected if the xpath query is /a/b or /a/b/c instead of /a