Another XML question

(imported topic written by cstoneba)

How can I get the only the 2nd Server line of the attached xml document?

this is what I have so far:

q: if exists file “C:\testing\SyLink.xml” then ((node values of attribute 0 of selects “ServerSettings/CommConf/ServerList/ServerPriorityBlock/Server” of xml document of file “C:\testing\SyLink.xml”)) else “NA”

A: 172.16.4.87

E: Singular expression refers to non-unique object.

(imported comment written by Lee Wei)

Hi Chris,

Please see if this is what you are looking for.

The XPath syntax to select the 2nd node is “ServerSettings/CommConf/ServerList/ServerPriorityBlock/Server[1]”.

Note the [1].

So you can try:

q: if exists file “C:\testing\SyLink.xml” then ((node values of attribute 0 of selects “ServerSettings/CommConf/ServerList/ServerPriorityBlock/Server[1]” of xml document of file “C:\testing\SyLink.xml”)) else “NA”

Lee Wei

(imported comment written by cstoneba)

perfect. thanks