Help Centre › Functions & Formulas
This article describes the RPA Data Format functionality to query values from XML data.
For a full list of available functions, please read DATA FORMAT functions.
Description
The Query XML function retrieves values from XML data using XPath expressions. Returns an array of matching elements.
Setting it up
To use the Query XML function, follow these instructions:
{{popups:rpas/add:action=xml-query}}
Once on a process map:
- Navigate to the process where you would like to add the Query XML function
- Click on the green button’s drop-down (right side of the green button labelled “Process”)
- On the menu that appears, click on the “+ Activity” item
- From here you can select the DATA FORMAT Query XML option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Data | Yes | Text | - | The XML string to query |
| XPath | Yes | Text | - | The XPath expression to evaluate |
| Variable | No | Text | result | Variable name to store the result |
Output variables
| Variable | Type | Description |
|---|---|---|
| {result} | Array | Array of matching XML elements or values |
Errors
| Error | Description |
|---|---|
| Invalid XML | The data is not valid XML |
| XPath error | The XPath expression is invalid |
Tips
- Use .//tag for descendant search across all levels
- Use .//tag[@attr="val"] to filter by attributes