XML Automation - GetXElementNodeList

GetXElementNodeList

When to use the GetXElementNodeList

Use this activity to get the total Count of Element from the XML input document.

Figure 1

1

(1) Drag and drop a GetXElementNodeList activity from the XML package. (2) Specify the Name of the Element in the Input Property field (Element Name). (3) Specify the path in which the Xml Document is stored if (4) File is chosen from the Input Type Drop-down. (5) Enter the name space if any (optional) (6) Specify the List< XElement> variable in the Output Property field (ListofXElementNode) to obtain the total elements’ count.

Figure 2

2

In this activity, as soon as the List<XElement variable type output parameter property field is created, if an error is encountered, please create a subsequent XElement variable type in the Variables section to proceed without disruption due to the error. This variable will not be used in subsequent workflows as in the WriteLog activity or any following activities, it is meant as a counter measure if error is encountered while creating the output variable in the GetXElementNodeList activity.

Figure 3

3

Next, (1) Drag and drop a WriteLog activity and assign it to the GetXElementNodeList activity. (2) Provide the input string with the appropriate Syntax - “Preferred text” + output variable +. Count. ToString as it gives you the count of the total elements. (3) Specify the Log level.

Figure 4

4

In the above workflow the Input String syntax in the WriteLog is as follows:

 ” Total Element” + ListElementNode.Count.ToString as displayed in the following image.

 

Figure 5

5

(1)Execute the workflow. The output will display the count of the Total Elements in the XML Document, as displayed in the following image.

Figure 6

6

Technical Reference

Figure 7

7

 

Version
5.1.1