Web Vuser Functions (WEB) > Alphabetical List of Web Vuser Functions > web_reg_save_param_xpath

web_reg_save_param_xpath

Example: web_reg_save_param_xpath Correlation Functions

Registers a request to save dynamic data in an HTML buffer that has been formatted as XML. The data is saved to a parameter.

C Language

int web_reg_save_param_xpath( "ParamName=<output parameter name>", "QueryString=<Xpath>", ["ReturnXML=<Yes|No>",] ["SelectAll=<Yes|No>",] <List of Attributes>, <Search Filters>,LAST ); 
Argument Description
ParamName The name of the parameter to create.
QueryString The XPath of the value to save.
ReturnXML Optional: If ReturnXML=Yes, the data returned in the parameter specified by ParamName includes the entire XML node at the specified XPath, including contained elements. See Example with ReturnXML. If ReturnXML=No, only the value of the element that matches the query is returned. (Default)
SelectAll Optional: If SelectAll=Yes, all the occurrences of the match are saved in an array. See Saving Multiple Matches below in this topic.
List of Attributes For details of each attribute, see Attributes for Save Parameter Registration Functions. Attribute value strings (e.g., "Search=body") are not case-sensitive. See the Restrictions.
SEARCH FILTERS Specifies the sections of the buffer to search for the string in. See Search Filters for Save Parameter Registration Functions. See the Restrictions.
LAST A marker that indicates the end of the argument list.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

Parameterization

The values of keyword-value pairs can be parameterized. For example, "ALT={altParam}".

General Information

web_reg_save_param_xpath registers a request to find an XML node within the server response to the next action function and save the string. This function is used when the server response is XML or converted to XML. For example, the function is used in conjunction with Data Format Extensions that output in XML format. The search does not apply to values returned as a result of calls to asynchronous or cross-step functions.

This function registers a request to retrieve dynamic information from the XML and save the information to a parameter. For correlation, enclose the parameter name in braces (e.g., "{param1}") in ensuing function calls which use the dynamic data. The request registered by web_reg_save_param_xpath looks for the the node specified with the QueryString argument and saves the contents of the node, if found. See also Correlating Statements.

For more information about XPATH, see XML Query or search the internet for XPATH.

Saving Multiple Matches

The web_reg_save_param_xpath function supports array type parameters. When you specify SelectAll=Yes, all the occurrences of the match are saved in an array. Each element of the array is represented by the ParamName_index. In the following example, the parameter name is A:

web_reg_save_param_xpath("ParamName= A", "QueryString=//component/prd/item", "SelectAll=Yes", LAST );

The first match is saved as A_1, the second match is saved as A_2, and so forth. You can retrieve the total number of matches by using the following term: ParamName_count. For example, to retrieve the total number of matches saved to the parameter array, use:

TotalNumberOfMatches=atoi(lr_eval_string("{A_count}"));

 

web_reg_save_param_xpath is not recorded. You can add it manually to a script.

Restrictions

Scope = ALL does not apply to web_reg_save_param_xpath.

No searches are performed in data downloaded asynchronously.

If the HeaderNames filter argument is specified but the Scope is not Headers, the HeaderNames argument is ignored.

If the RelFrameID=ALL argument is specified, the Ordinal argument must be ommited or set to ALL.

For more information on the DFES argument, see Attributes for Save Parameter Registration Functions.

For more information on the HeaderNames and Scope arguments, see Search Filters for Save Parameter Registration Functions

For more information on the RelFrameID and SelectAll arguments, see Search Filters for Save Parameter Registration Functions and RelFrameID Attribute.

Concept Link IconSee Also