veronica_glynn
10 years agoContributor
Retrieving data from WebService XML via XPath
Hi! I am generating data via our web services and need to retrieve data to pass into another web service call but I am having difficulties accessing that data. I have tried using a 'Find', 'FindAll', 'FindAllChildren', FindChildByXPath, and Find with XPath. So far, none of these methods have run successfully. I receive an 'Object doesn't support this property or method' error. I am trying to run the 'Find' directly against the XML. I am also having issues obtaining a particular Node. Regardless of the Node I request, it always returns the root Node. Snippet of code is entered below...
Thanks for any help! I am stuck..
Call WebServices.CogneroContentImportService. GetUsersQuestionSetTree(userID)
XML.GetUsersQuestionSetTree.Check WebServices.CogneroContentImportService
Set Doc = Sys.OleObject("Msxml2.DOMDocument.6.0")
Doc.async = False
' Load data from a file
Call Doc.load("D:\\XML\GetUsersQuestionSetTree\GetUsersQuestionSetTree.xml")
Set Nodes = Doc.selectNodes("//Soap/GetUsersQuestionSetTreeResponse")
'set your xpath variable
xpath1 = ".//add[@nodeTypedValue = 'LogsDirectory']"
'execute the FindChildByXPath method and assign the object to LogsDirectory
NOTE: THIS IS WHERE IS FAILS - OBJECT NOT SUPPORTED
Set LogsDirectory = Doc.FindChildByXPath(xpath1, False)
'now that you have the node object get the value of the 'value' attribute
sLogsDirectoryValue = LogsDirectory.GetAttribute("value", QuestionSetmetaScripts)
Log.Message ("Result: " + sLogsDirectoryValue)
Thanks for any help! I am stuck..
Call WebServices.CogneroContentImportService. GetUsersQuestionSetTree(userID)
XML.GetUsersQuestionSetTree.Check WebServices.CogneroContentImportService
Set Doc = Sys.OleObject("Msxml2.DOMDocument.6.0")
Doc.async = False
' Load data from a file
Call Doc.load("D:\\XML\GetUsersQuestionSetTree\GetUsersQuestionSetTree.xml")
Set Nodes = Doc.selectNodes("//Soap/GetUsersQuestionSetTreeResponse")
'set your xpath variable
xpath1 = ".//add[@nodeTypedValue = 'LogsDirectory']"
'execute the FindChildByXPath method and assign the object to LogsDirectory
NOTE: THIS IS WHERE IS FAILS - OBJECT NOT SUPPORTED
Set LogsDirectory = Doc.FindChildByXPath(xpath1, False)
'now that you have the node object get the value of the 'value' attribute
sLogsDirectoryValue = LogsDirectory.GetAttribute("value", QuestionSetmetaScripts)
Log.Message ("Result: " + sLogsDirectoryValue)