I’m trying to retrieve the value of the “state” node for nodes with an “ip” attribute of “1.2.3.4”. But I can’t seem to get the “node value” querey to work when using “xpaths” inspector.
q: node value of child node 2 of xpaths “/result/pool/member” whose (node value of attribute “ip” of it = “1.2.3.4”) of xml document of file “C:\status.xml”
E: The expression could not be evaluated: Windows Error 80020005: Type mismatch.
the "attribute of " apparently returns an xml dom node, not a string:
q: (attribute “ip” of it) of xpaths “/result/pool/member” whose (exists attribute “ip” of it) of xml document of file “C:\status.xml”
E: This expression evaluates to an unrepresentable object of type “xml dom node”
So you can cast it to a string (using the “as text” inspector) and compare:
q: (it as xml) of xpaths “/result/pool/member” whose (attribute “ip” of it as text = “1.2.3.4”) of xml document of file “C:\status.xml”
A: %0d%0a%09Pool member is available%0d%0a%09ENABLED2%0d%0a%09ENABLED%0d%0a%09UP%0d%0a
q: (child node 2 of it as text) of xpaths “/result/pool/member” whose (attribute “ip” of it as text = “1.2.3.4”) of xml document of file “C:\status.xml”
A: ENABLED
or just use 100% xpath, which is much cleaner:
q: (it as text) of xpaths “/result/pool/member/state” of xml document of file “C:\status.xml”
now how would I put in session relevance to replace the IP addr? The following gives me a relevance substitution error.
(it as text as lowercase = “enabled”) of xpaths “/result/pool/member/state” of xml document of file (parent folder of regapp “BESClient.exe” as string & “__BESData\actionsite\status-qae.xml”)
correction, this is the code that is giving me the problem:
(it as text as lowercase = “enabled”) of xpaths “/result/pool/member/state” of xml document of file (parent folder of regapp “BESClient.exe” as string & “__BESData\actionsite\status-qae.xml”)
(it as text as lowercase = "enabled") of xpaths "/result/pool/member[@ip='{addresses whose (it as string != "0.0.0.0") of ip interfaces whose (not loopback of it) of network}']/state" of xml document of file (parent folder of regapp "BESClient.exe" as string & "\__BESData\actionsite\status-qae.xml")
can anyone tell me how to add the IP Managed Property in place of the IP ?
You’ll have to construct a valid XPath query - and accounting for the plurals. XPath uses the format “@ip=’…’ or @ip=’…’” so I can get the entire query here:
q: "/result/pool/member[" & concatenation " or " of (("@ip='" & it as string & "'") of addresses whose (it as string != "0.0.0.0") of ip interfaces whose (not loopback of it) of network) & "]/state"
A: /result/pool/member[@ip='192.168.84.203' or @ip='192.168.106.117']/state
And then inserted back into your original statement:
(it as text as lowercase = "enabled") of xpaths ("/result/pool/member[" & concatenation " or " of (("@ip='" & it as string & "'") of addresses whose (it as string != "0.0.0.0") of ip interfaces whose (not loopback of it) of network) & "]/state") of xml document of file "C:\status.xml"
how would I replace the IP of “1.2.3.4” with session relevance of an IP Managed Property?
confinue if {(it as text as lowercase = "enabled") of xpaths "/result/pool/member[@ip='1.2.3.4']/status" of xml document of file "c:\users\desktop\test.xml"}