Read and Review Automation Anywhere Documentation

Automation 360

Close Contents

Contents

Open Contents

XML package

  • Updated: 10/19/2021
    • 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.
  • Save and close the session.
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.
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.
    • Text: Specify the text name or select an existing variable.
  • Save the XML session.
Update node Updates the value of a node.
  • Type the session name or select an existing variable used in the Start XML session action.
  • Enter the XPath expression for the node to be updated.
  • Enter a New value for the node.
  • Select the Updates attribute(s) option to create a new Dictionary or to add an existing Variable of Dictionary-type.
Validate XML document The tags and document structure are defined when the XML document is created. Use this action to validate an XML document.
  • Enter the session name or select an existing variable used in the Start XML session action.
  • Select the validation type from the following options:
    • XML schema files (.xsd)
      • List: Specify the schema XSD file path you want to validate in the Value field. Click Add to add multiple XML schema files (.xsd).
      • Variables: Create a new variable of type List with subtype String and enter the XSD file path in the Default value field (optional) or use an existing variable.
    • Internal Document Type Definitions (DTDs)
    • Well formed
  • Assign the output to a variable using Assign the output (Valid or Invalid) to variable
Send Feedback