Step-By-Step Guide to Use XML to Pass the Input Manually and Retrieve the XML Node

Let's consider an example of passing the XML input manually and retrieving the XML node from the specified path.

 

We are passing a XML input that contains a store having details of books. We would retrieve details of the book element available at node four in the XML fragment.

 

To retrieve the data from the XML input:

  1. Create a new process.
  2. From the Canvas Tools panel, add the XML Activity to the Flowchart designer on the Canvas.
  3. In the Parameter bar, create an In argument, outputstring of type String. This argument is used to store the book details.

 

 

  1. In the XML Action list, select Getter to perform the action of retrieving data.
  2. Select the check box beside XML Input field to provide the input manually.
  3. Click the (Settings) icon, and then click Input XML Editor to enter the XML data manually. The XML Input Editor dialog box appears.

 

 

  1. Enter the details of the books in XML format and then click Confirm. You are directed back to the XML activity in the Canvas.
  2. Click the (Settings) icon, and then click Output Mapping to align the XML path and the data fetched with an argument. The Output Mapping dialog box opens.
  3. Click Add to provide details related to the mapping of the output parameters.
  4. In the XPath field, enter the XML path expression, /store/book[3] to retrieve the details of the book element available in the XML fragment.
  5. In the Mapping Variable list, select outputstring defined in the Parameter bar. The mapped argument stores the data retrieved from the stated XML path.

 

 

  1. Click CONFIRM to save the output mapping configuration.
    To view the output in Automation Studio , let's add WriteLine activity for both the retrieved set of data. You can assign this process to a robot, if you want to execute this process outside Automation Studio.
  2. Add a WriteLine activity below the XML Activity and in the Text field, enter outputstring to print the book details retrieved.
  3. Save the process.
  4. Setup the environment and then perform test run.

 

The console displays the book details.