I am trying to get some node value in XML using VBScript. If I use the normal XML with the below script, then it is correctly fetching the expected node value. But if I use the SOAP response which is having namespaces, then below script is throwing the following error in the highlighted line:
Object Required: 'nNode'
Script:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Load editName
xmlDoc.SetProperty "SelectionNamespaces", "xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:sch='http://www.exchangerate.com/webservices/schemas' xmlns:xbe='http://www.exchangerate.com/rate'"
Set nNode = xmlDoc.SelectSingleNode(tag)
objSheet.Cells(i, Column).value = nNode.text '<-- this fails
strResult = xmlDoc.Save(editName)
How can I solve this?
Sample Response XML:
Input:
tag="/SOAP-ENV:Envelope/SOAP-ENV:Body/sch:Request/sch:Response/xbe:ConversionRateResult"