Previous Topic: Parse Text from XMLNext Topic: Parse XML Result for DevTest Tags


Read Attribute from XML Tag

The Read Attribute from XML Tag filter lets you store the text of a specific attribute in a property. The attribute can occur anywhere in the result.

You can create this filter either manually from the filter list, or by using the embedded filter commands on an XML response.

To create the filter manually:

Complete the following fields:

Filter in

The name of the property to consider as the last response for the step. If the property is not in the pull-down menu, you can enter it. The property must exist.

Tag

The name of the XML tag; for example, "target".

Tag Count

The occurrence of the tag from the top of response; for the first tag enter "1".

Attribute

The name of the attribute to filter; for the href attribute enter "href".

Property

The property in which to store the value.

Default (if not found)

The value to use if the attribute value is not found.

URLEncode

When selected, property value is URLEncoded.

Filter Run Results

Displays the property and values that result from running the filter.

Run Filter

To run and execute the filter, click Run Filter. The results appear in the Filter Run Results section.

To create the filter from the response page:

  1. Display the step response that contains the XML.

    Filter: Read Attribute from XML Tag: creating the filter from the response page

  2. From the DOM Tree view, select the attribute whose value you want to store in a property.
  3. When it is highlighted, select Generate Filter for Attribute or Text.
  4. Enter the property name in the window.

    HTML/XML Filter Info dialog - enter property key

    You can also add an assertion here. A Property Value Expression Assertion can be added to this step.