# Iterating through XML nodes

**URL:** https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81
**Category:** Discussion
**Created:** [May 2, 2006, 12:38pm UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81 "2006-05-02T12:38:07Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![nirsilgi](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/a6a055/32.png) [@nirsilgi](https://www.finalbuilder.com/forums/u/nirsilgi)
#### Post date: [May 2, 2006, 12:38pm UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/1 "2006-05-02T12:38:07Z")

</div>

Hi,  
  
I'm trying to iterate through the node in the attached XML but with no success. I tried to look at the XML tutorials but no matter what I try the FB XML iterator rejects me :(  
The deepest node I was able to iterate is /Sonitor/Services. Maybe I'm doing something wrong or maybe the FB doesn't support this kind of XML.  
Can you please take a look and help me?  
  
Thanks,  
NirS

[TestConfig.zip](https://www.finalbuilder.com/forums/uploads/default/original/2X/7/7d9587c41b2093a6aa19b5b11889c93c158d695a.zip) (948 B)

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [May 3, 2006, 3:01am UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/2 "2006-05-03T03:01:17Z")

</div>

What are you trying to achieve and what xpath statement are you using? The xpath property allows you to define what nodes will be part of the node set that will be iterated, so it is crucial to get the correct xpath statement.

---

<div class="post-metadata">

### Author: ![nirsilgi](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/a6a055/32.png) [@nirsilgi](https://www.finalbuilder.com/forums/u/nirsilgi)
#### Post date: [May 4, 2006, 9:01am UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/3 "2006-05-04T09:01:24Z")

</div>

Hi Vincent,  
  
I’m trying to iterate through the node. With each iteration I’m trying to get the machine name into a variable.  
I’m not big expert on XML and while I tried to look at some XPATH tutorials, I don’t seem to get it right.  
  
Your help is appreciated,  
Thanks,  
NirS

---

<div class="post-metadata">

### Author: ![tate](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@tate](https://www.finalbuilder.com/forums/u/tate)
#### Post date: [May 4, 2006, 9:20am UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/4 "2006-05-04T09:20:01Z")

</div>

Try this:  
  
Set XPath to: /Sonitor/Services/Service/Component/Machine  
And then set a variable to the text value of the node (first option in Variable to set).  
  
This seemed to work for me, it gave me 25 nodes.  
  
If you want to limit it to a particular service, you can use an XPath statement like this:  
/Sonitor/Services/Service[@name=“Sorters”]/Component/Machine  
  
(which gives 10 nodes).  
  
hth.

---

<div class="post-metadata">

### Author: ![nirsilgi](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/a6a055/32.png) [@nirsilgi](https://www.finalbuilder.com/forums/u/nirsilgi)
#### Post date: [May 4, 2006, 3:04am UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/5 "2006-05-04T03:04:59Z")

</div>

AWESOME it works thank you!!! You are Great (and I feel stupid )

---

<div class="post-metadata">

### Author: ![nirsilgi](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/a6a055/32.png) [@nirsilgi](https://www.finalbuilder.com/forums/u/nirsilgi)
#### Post date: [May 22, 2006, 10:00am UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/6 "2006-05-22T10:00:28Z")

</div>

Hi,  
  
I have again a problem with another format XML… Can you please help me with the XPATH to iterate through the IPs in Machine Address (see the XML attached)  
  
Thanks in advance,  
NirS  
[DomainLoad2.zip](https://www.finalbuilder.com/forums/uploads/default/original/2X/a/a3de86ef670823bd27d6d86d7a180fa8dc1f9653.zip) (538 B)

---

<div class="post-metadata">

### Author: ![tate](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@tate](https://www.finalbuilder.com/forums/u/tate)
#### Post date: [May 22, 2006, 1:34am UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/7 "2006-05-22T01:34:20Z")

</div>

NirS,  
  
That should be something like:  
/DN/Cluster/ClusterElem/Machines/Machine  
  
And then specify the attribute in the other field to:  
address  
  
.t8

---

<div class="post-metadata">

### Author: ![nirsilgi](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/a6a055/32.png) [@nirsilgi](https://www.finalbuilder.com/forums/u/nirsilgi)
#### Post date: [May 22, 2006, 2:12am UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/8 "2006-05-22T02:12:25Z")

</div>

Thanks Tate, I actually tried this but it returns :  
"XPath “/DN/Cluster/ClusterElem/Machines/Machine” returned no nodes."  
  
I wonder what’s the problem…

---

<div class="post-metadata">

### Author: ![nirsilgi](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/a6a055/32.png) [@nirsilgi](https://www.finalbuilder.com/forums/u/nirsilgi)
#### Post date: [May 22, 2006, 2:18am UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/9 "2006-05-22T02:18:04Z")

</div>

Ok Actually it works with MSXML Parser 3 but not with 4

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [June 1, 2006, 2:46am UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/10 "2006-06-01T02:46:09Z")

</div>

That’s because of a “by design” “feature” of MS XML 4. If you check the “Expand document namespaces” option on the action, it will work properly with 4 as well.

---

<div class="post-metadata">

### Author: ![nirsilgi](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/a6a055/32.png) [@nirsilgi](https://www.finalbuilder.com/forums/u/nirsilgi)
#### Post date: [June 1, 2006, 8:38am UTC](https://www.finalbuilder.com/forums/t/iterating-through-xml-nodes/81/11 "2006-06-01T08:38:53Z")

</div>

Thanks I’ll try that!
