Hi Kap,
It's doable by calling the XML DOM object. Here's an example of script:
dim objXMLDoc
dim NodeList
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.load(Watch.GetJobFilename)
Set NodeList = objXMLDoc.documentElement.selectNodes("items/item")
Watch.Log NodeList.length, 1
If used with a sample xml data like this:
<root>
<items>
<item>
<id>1</id>
<name>John</name>
</item>
<item>
<id>2</id>
<name>Jack</name>
</item>
<item>
<id>3</id>
<name>Joe</name>
</item>
<item>
<id>4</id>
<name>James</name>
</item>
<item>
<id>5</id>
<name>Jimmy</name>
</item>
</items>
</root>
It will count the number of "item" nodes, which in this case is 5 and display it in the log. Feel free to use "NodeList.length" for other operations in the script, you could also use Watch.SetJobInfo or Watch.SetVariable to store that value into a job info or variable, and reuse it later in your process.
EDIT:
Here's another sample that will actually loop through the nodes, and display their value in the log:
dim objXMLDoc
dim NodeList
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.load(Watch.GetJobFilename)
Set NodeList = objXMLDoc.documentElement.selectNodes("items/item")
for i = 0 to (NodeList.length-1)
set ChildNodes = NodeList.item(i).childNodes
Watch.Log "ID: " + ChildNodes.item(0).Text, 1
Watch.Log "NAME: " + ChildNodes.item(1).Text, 1
next
Once again, feel free to do whatever else you want with the "ChildNodes.item(0).Text" properties. This is just an example to get you started.
Hope that helps!
Regards,
Raphaël Lalonde Lefebvre