Get single node action in XML

The Get single node action in the XML package enables you to retrieve the value of a single node.

Settings

  • Enter the session name or select an existing variable used in the Start XML session action.
  • Enter the XPath expression, and attribute (optional) to retrieve a node.
    Get single node retrieves the first value from the XML document based on the provided XPath expression and the attribute. For example,
    <Customer>
    <Cust_Details>
    	<custid>A001</ custid>
    <custname>XYZ Corp</custname>
    <custzipcode>15639</custzipcode>
    <country>Mexico</country>
    <Locale lang=”es”> Spanish</Locale>
    </Cust_Details>
    </Customer>
    
    • Xpath expression with attribute: The attribute value of the XPath expression element is displayed. For example, if the XPath expression is entered as Customer//Cust_Details//Locale with the attribute as lang, the output is displayed as es.
    • XPath expression without attribute: The value of the XPath expression element is displayed. For example, if the XPath expression is entered as Customer//Cust_Details//Locale without any attribute, Spanish is displayed as an output.
  • Assign the output to a String-type variable.