XML Navigator
- Last UpdatedJun 26, 2024
- 3 minute read
Activity Description:
The XML Navigator activity is used to either locate or navigate to a specific record in a collection within an XMLIterator Variable. This activity enables identification of a specific record for execution of an activity or group of activities.
See also Example of XML Navigator Activity
Activity Properties:
You can configure the XML Navigator activity by specifying appropriate values in the Activity Properties area. To access the Activity Properties, click the Activity Properties menu in the Tool Bar. Or, right-click the XML Navigator activity and select the Activity Properties option. The Activity properties are organized under groups of related properties. The properties under each group are described in this topic.
Name & Description
Specify the name and description for the activity in this group.
Name - Enter the name for the activity.
Property Type: Optional (This property needs to be set only if necessary.)
Description - Enter a brief description for the activity.
Property Type: Optional (This property needs to be set only if necessary.)
Configuration
The Configuration group has properties for selection of the XMLIterator Variable to be looped through.
XMLIterator - Select the XML Iterator variable to be navigated. All XMLIterator variables as declared in the Start activity are available for selection.
Property Type: Mandatory (This property must be set if the action is to be executed.)
Location - This field identifies the location to be navigated to. It defaults to First. The options are:
First: Navigates to the first record in the collection.
Last: Navigates to the last record in the collection.
Next: Navigates to the next record based on the current location.
Previous: Navigates to the previous record based on current location.
Index: Navigates to the record identified in the Index field.
Property Type: Mandatory (This property must be set if the action is to be executed.)
Index - Enter the index number of the record to navigate to. This field is mandatory if the Location field is set to Index.
Property Type: Optional (This property needs to be set only if necessary.)
Example for XML Navigator
Consider already an XML file called Sample.XML is exists. The contents of it are as shown below.
<?xml version="1.0" encoding="utf-8"?>
<root>
<Item>
<itemdID>I001</itemdID>
<desc>some stuff1</desc>
<qty>10.20</qty>
</Item>
<Item>
<itemdID>I002</itemdID>
<desc>some other stuff2</desc>
<qty>20.20</qty>
</Item>
<Item>
<itemdID>I003</itemdID>
<desc>some more stuff3</desc>
<qty>30.20</qty>
</Item>
</root>
Step 1: Design a Workflow as shown in the below figure.

Step 2: In the Start Activity, declare two XML Variables.
-
Click the New Variable link. Under Schema enter the following details:
Variable Name: ItemDoc, Type: XML Document, and Scope: Global
Use Content for internal storage and browse the above created Sample.XML file and load it.

-
Click the New Variable link. Under Schema, enter the following details:
Variable Name: ItemItr,
Type: XML Iterator,
Scope: Global,
XML Variable: ItemDoc
Node Select: Item -
Click Save Variable and close the window

Step 3: In the location property of XML Navigator Activity, select "Last". For the XML Iterator property, select the Iterator created that is, ItemItr. In the Logger Activity, the ItemItr is displayed in LogMessage column of the work item.
Step 4: Click the LogMessage property of Logger Activity, following window will open.

Select XML Variable form the first drop-down. In the second drop-down, select the Iterator created, that is ItemItr. In the third drop-down, select the Item ID from the tree displayed. Click Append, and then click Update.
Step 5: On the link connecting XML Navigator Activity and Logger Activity, select "Record Found".
Output:
The item ID will be displayed in the LogMessage Column of the Logger in work item.