lr_xml_replace

Example: lr_xml_replaceXML Functions (LR_XML)

Replaces fragments of an XML string.

int lr_xml_replace( <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 name of the output parameter containing the XML data after replacing the new value
Query: the XML Query on the input string XML.

Choose one of the following:
XmlFragment: the string value to use as replacement of the query match—an element or an attribute.
or:
XmlFragmentParam: the name of the parameter containing the string value to use as replacement

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_replace function queries the XML input string XML for values matching the Query criteria and replaces them either with XmlFragment or XmlFragmentParam as the value of the elements matched by the query. You can replace elements by specifying either its element name or attribute in the XML Query. The resulting string is placed in ResultParam, 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.

If there is more than one value to be replaced, then pass the "XmlFragmentParam=" specification. Save the values in a series of parameters with the names:

Param_1, Param_2, Param_3, ...

where Param is the value "XmlFragmentParam=Param". lr_xml_replace replaces each successive match of the Query with the value of the next parameter in the series. For an example of multiple-value query see lr_xml_set_values.

Return Values

See Return Values

Parameterization

See Parameterization