XPath Query

This activity allows you to extract information from an XML-formatted string. Instead of using regular expression to parse the XML, you can use an XPath to traverse the XML structure and extract the data you want.

Note: Some XML contains namespaces to help describe the content. The XPath Query activity can be configured to recognize namespaces by adding them under the Namespaces section in its properties.

Usage

Complete the following properties to use this activity:

  • General
    • Display Name - This name is what's displayed for the activity in the Workflow Editor.
    • Description - Add a clear and meaningful description.
    • Activity timeout (seconds) - Enter the amount of time in seconds that Automation will attempt to complete this activity before it times out.
    • Continue workflow execution on failure - Check this check box to continue the workflow if this activity fails (optional).
    • Skip activity execution - Check this check box to bypass running the activity during the workflow execution (optional).
  • XML Query
    • Source XML to Query - Paste the XML content into the text box or click the Variable Reference icon to choose a variable.
  • Namespaces - Click Add and provide the following information:
    • Prefix - Enter the element name prefix.
    • URI - Enter the URI associated with the prefix.
  • XPath Queries - Click Add and provide the following information:
    • Property Name - Enter the name of the XML property.
    • XPath Query - Enter the query or click the Variable Reference icon to use a variable.
    • Property Type - Click the drop-down menu and choose the type of property the query will search for.

Once the activity has extracted the data, you can use it in a downstream activity by choosing the property in the Variable Browser.

For example, if you want to return the value from the workflow, use the Set Variables activity downstream to set the workflow's output variable to the value extracted from the XML:

  • Under Variables, click Add.

  • In Variable to update, click the (Variable Reference) icon and drill down to choose the desired workflow output variable. 

  • In New value, click the (Variable Reference) icon and drill down to choose the property from XPath Query under Activities.