Reputation: 337
I am trying to retrieve a couple of nodes from the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<CheckPersonResponse xmlns="http://test.net/crs/">
<CheckPersonResult>
<xml xmlns="http://test.com/webservices/crs2/">
<requestid>933ca7df-6f25-49d9-8144-692e9f18cf27</requestid>
<customernumber>xxx</customernumber>
<reference>xx</reference>
<product>xxx</product>
<input>
<customernumber>xx</customernumber>
<reference>xx</reference>
<name>xx</name>
<initials>xx</initials>
<prefix>xx</prefix>
<gender>xx</gender>
<birthdate>xxx</birthdate>
<streetname>x</streetname>
<housenumber>x</housenumber>
<extension>Axx</extension>
<postcode>xx</postcode>
<city>xx</city>
<country />
<phonenumber1 />
<phonenumber2 />
<emailaddress />
<bankaccount />
<referencedate>xxx</referencedate>
<typeofclaim>xx</typeofclaim>
<claimdate>xxx</claimdate>
<claimamount>xx</claimamount>
</input>
<result>
<reference>xxx</reference>
<personalscore>0</personalscore>
<statisticalscore>0</statisticalscore>
<paymentscore>0</paymentscore>
<overallscore>0</overallscore>
<addressindicator />
</result>
</xml>
</CheckPersonResult>
</CheckPersonResponse>
</soap:Body>
</soap:Envelope>
Where I want to retrieve all the nodes within the the tag <result>
how can I select all the nodes with XPath and use them with in VBS?
Upvotes: 0
Views: 212
Reputation: 337
Found the solution:
namespaces = Array( _
"xmlns:s='http://test.nl/webservices/crs2/'", _
"xmlns:c='http:/test.net/crs/'", _
"xmlns:soap='http://www.w3.org/2003/05/soap-envelope'", _
"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'", _
"xmlns:xsd='http://www.w3.org/2001/XMLSchema'" _
)
xmlhttp.responseXML.setProperty "SelectionNamespaces", Join(namespaces, " ")
xpath = "/soap:Envelope/soap:Body/c:CheckPersonResponse/c:CheckPersonResult/s:xml/s:result/s:*"
Set NodeList = xmlhttp.responseXML.selectNodes(xpath)
Upvotes: 1