Example: lr_xml_set_valuesXML Functions (LR_XML)

Sets the values of XML elements found by a query.

int lr_xml_set_values( <List of specifications> [, <List of optional specifications> ] [, LAST]);
List of specifications

For the following list of required specifications, use the following string format:"Specification=value"

XML: the XML Input String to query
ResultParam: The output parameter containing the XML data after setting the new value. If the parameter does not exist, it is created.
Query: the XML Query on the input string XML. You can specify elements or attributes.

Choose one of the following:
Value: the string value to set as the XML element
ValueParam: the parameter name containing the value to set as the XML element

List of optional specifications

For the following list of optional specifications, use the following string format:"Specification=value"

SelectAll: If "yes", all elements matching the query will be processed. If "no", only the first match will be processed. Default is "no". See Multiple Query Matching
NotFound: See Continuing on Error

LAST A marker which indicates the end of the List of optional specifications

The lr_xml_set_values function queries the XML input string XML for values matching the Query criteria and sets either Value or ValueParam as the value of the elements matched by the query.

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

"XML=<employee>John Smith</employee>

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


You can pass the input value required as a string ("Value=string"), or as a parameter which contains the string ("ValueParam={Param}").

If there is more than one value to be replaced, then use ValueParam. Save the values in a series of parameters with the names:

Param_1, Param_2, Param_3, ...

where Param is the value "ValueParam=Param". lr_xml_set_values sets each successive match of the Query to the value of the next parameter in the series.

When parameters with the names ValueParam or ResultParam already exist, their value is overwritten. ResultParam is returned using the source document encoding. The output preserves the XML Character Encoding of the original document, independent of the input encoding. The input encoding uses the client's local encoding.

For information and examples about Query see XML Query.

Return Values

See Return Values


See Parameterization