Applies to ReadyAPI 2.7, last modified on May 14, 2019

The XML data source fetches data from a property containing XML using the XPath expression. The data source parses the input XML content with XPath and populates the specified properties with the parsed values.

ReadyAPI cannot parse XML documents that contain the byte order mark (BOM) character.
Note: You can only use this data source in the SoapUI data source test step. It is not available in ServiceV.


The XML data source

Click the image to enlarge it.

Source Step

Specifies a test step that contains the XML property to read from. For example, another data source or a SOAP Request test step.

Source Property

Specifies the name of the desired property that contains XML data.

Row XPath

The XPath expression that selects a set of elements for iteration. You can specify the path manually or click Declare icon and select the desired element from the Select Row XPath dialog. See the example below.

Make sure the XPath expression does not contain a predicate with the index of a particular element, otherwise, the XPath expression will return only one element. For example, the following XPath expression returns only the first book element in a set:

To select all the books, remove the predicate:


Column XPaths

XPath expressions that return the desired property values. ReadyAPI applies these expressions to each element returned by the XPath expression specified in the Row Path.

The data source assigns data to the properties in the order they are listed in the Properties panel.

Make sure the number of properties is the same as the number of XPath expressions.

To add a new expression, click Add.

To change the selected expression manually, click Edit. Also, you can click declare icon and select the desired element from the Select Column XPath dialog.

To remove the selected expression, click Remove.

To learn how to specify Column XPaths, see the example below.

The following example demonstrates how to configure an XML data source:

1. Specify the source property

In the Source Step drop-down list, specify a test step whose property contains XML data. Specify this property in the Source Property drop down list.

For example, you can specify a SOAP Request test step, the response to which contains XML data:

2. Select data to iterate through

In Row XPath, specify an XPath expression that returns a set of elements for iteration.

Assume you have the following XML data:


         <author>Nigel Rees</author>
         <title>Sayings of the Century</title>
         <author>Evelyn Waugh</author>
         <title>Sword of Honour</title>
         <author>Herman Melville</author>
         <title>Moby Dick</title>
         <author>J. R. R. Tolkien</author>
         <title>The Lord of the Rings</title>

To get a list of books, specify the following XPath expression:


You can specify the expression manually, or click Declare icon and select the needed element by using the Select Row Path dialog.

The Select Row Path dialog adds a predicate to the XPath. Remove it to select all the sibling elements.

Configuring XML data source: Specify Row XPath

Click the image to enlarge it.

3. Specify properties to obtain

  1. Click to add a new property.

    ReadyAPI will add a new column path to the list.

  2. If the name of the added property is the same as the name of the desired child element, most likely, there is no need to customize the added XPath. Otherwise, perform the following steps to modify the XPath:

    • Select the added column path in the list.

    • Specify the XPath expression that returns the desired element. Note that ReadyAPI will apply this expression to the set of elements returned by the Row XPath expression. For example, to get the price/usd element from the XPath data above, specify the following XPath expression:


      To specify the XPath expression, click Declare icon to use the Select Column XPath dialog:

      Configuring XML data source: Specify Column XPath

      Click the image to enlarge it.

      You can also click Edit and specify the expression manually.

  3. Repeat the first two steps to add other properties.

  4. Click to test the data source:

    Configuring XML data source: Run data source

    Click the image to enlarge it.

See Also

DataSource Test Step
Data Source Types

Highlight search results