Example: web_reg_save_param_xpath

The following example shows the use of web_reg_save_param_xpath.

web_reg_save_param_xpath(
   "ParamName=outParam",
   "QueryString=//tag_c",
   SEARCH_FILTERS,
   "Scope=Body",
   LAST );

   web_url( "xpath_test.xml",
   "url=http://localhost/webgui/xpath_test.xml",
   LAST );

   lr_output_message( lr_eval_string( "outParam = {outParam}" ) );

 

Example with ReturnXML

This example shows the use of web_reg_save_param_xpath to return an entire XML segment.

web_reg_save_param_xpath(
    "ParamName=CorrelationParameter",
    "QueryString=/LR_EXTENSION[1]/object[1]/object[1]/array[1]",
    "DFEs=JsonXml",
    "ReturnXML=Yes",
    SEARCH_FILTERS,
    "Scope=Body",
    LAST);

			
web_url("generate_json_simple.asp",
    "URL=http://my_server/cgi-bin/json/generate_json_simple.asp",
    "TargetFrame=",
    "Resource=0",
    "RecContentType=text/html",
    "Referer=http://my_server/cgi-bin/json/json_correlation_base64.asp",
    "Snapshot=t2.inf",
    "Mode=HTML",
    LAST);

			
lr_log_message(">>> CorrelationParameter = %s", lr_eval_string("{CorrelationParameter}"));

 

 

The output is:

>>> CorrelationParameter = <array name="batter"><object><pair type="str" name="id">1001</pair><pair type="str" name="type">Regular</pair></object><object><pair type="str" name="id">1002</pair><pair type="str" name="type">Chocolate</pair></object><object><pair type="str" name="id">1003</pair><pair type="str" name="type">Blueberry</pair></object><object><pair type="str" name="id">1004</pair><pair type="str" name="type">Devil's Food</pair></object></array>