Read and Review Automation Anywhere Documentation

Automation 360

Close Contents

Contents

Open Contents

XML package

  • Updated: 2022/08/09
    • Automation 360 v.x
    • Build
    • RPA Workspace

XML package

Extensible Markup Language (XML) is a markup language designed to store and transport data. Use the actions in the XML package to automate the processing of XML data generated from web services and cloud computing applications.

An XML document is structured as an ordered and labeled tree. Each node of the tree is an XML element and is written with an opening and closing tag. In the following example, custname and custid are nodes:

<customer>
<custname>XYZ Corp</custname>
<custid>A001</custid>
</customer>

XPath is a query language that uses path expressions to select nodes or node-sets in an XML document. XPath includes built-in functions for manipulation of string, numeric, Boolean, date and time, and so on.

Before you start

Perform the following actions within the XMLpackage.

  1. Start the XML session using the Start XML Session action. Use this session name for all corresponding actions.
  2. Use the different actions available in the XML package to automate XML-related tasks.
  3. Save the session using the Save XML Session action to assign the data to a file or String-type variable.
  4. End the session using the End XML Session action to complete a task.

Actions in the XML package

The XML includes the following actions:

Action Description
Delete node Deletes a specific node from XML file.
  • Enter the session name or select an existing variable used in the Start XML session action .
  • Enter the XPath expression for the node to be deleted.
  • Enter the attribute (optional)
End session Closes an XML session.

Enter the session name or select an existing variable used in the Start XML session action.

Note: The End session action clears out session-related data from memory. To save the modified data, use the Save session data action.
Execute XPath function Executes an XPath function and stores the results in a variable.
  • Enter the session name or select an existing variable used in the Start XML session action .
  • Enter the XPath expression or select an existing variable.
  • Assign a String-type variable to the output.
Get multiple nodes Retrieves the value of multiple nodes.
  • Enter the session name or select an existing variable used in the Start XML session action .
  • Enter the XPath expression to retrieve multiple nodes or select an existing variable.
  • In the Get each node field, select if you require the Text value, XPath expression, or Specific attribute name of each node.
    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>
    
    • Text value retrieves the exact value of the specific node element. For example, the custname element of a Cust_Details node retrieves the names of all the customers of the company.
    • XPath expression refers to the path of the selected node in an XML document. An XPath expression such as Customer//Cust_Details//custid selects only customer IDs that are available in the customer details node.
    • Specific attribute defines a property or the type of the element in a particular node. For example, lang is an attribute of the Locale element in a Cust_Details node. The output for lang attribute is displayed as es.
Get single node Retrieves the value of a single node.
  • 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.
    • 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.
Insert node See Using Insert node action.
Save session data Saves the XML session data to a file or variable of type String.
  • Enter the session name or select an existing variable used in the Start XML session action.
  • To save the session data to a file, select the Write XML data option and specify a file path.
  • Select Overwrite to replace the existing file if a file with the same name exists in the location you have specified.
  • Assign the output to a String-type variable.
Note: The session data will be saved if you select the Write XML data option.
Start session Creates a new XML session based on an XML file or specified text.
  • Start the XML session.
  • Enter the session name or select an existing variable used in the Start XML session action. Use this session name for all corresponding actions.
  • In the Data Source field, select either File or Text:
    • File: Select from the Control Room file, Desktop file, or an existing Variable of File type.