Iterating through XML nodes

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 (948 B)

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.


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


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.

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

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 (538 B)

NirS,

That should be something like:
/DN/Cluster/ClusterElem/Machines/Machine

And then specify the attribute in the other field to:
address

.t8

Thanks Tate, I actually tried this but it returns :
"XPath “/DN/Cluster/ClusterElem/Machines/Machine” returned no nodes."

I wonder what’s the problem…

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

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.

Thanks I’ll try that!