VBScript Can not Select XML nodes

前端 未结 3 1175
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-28 18:00

I am trying to Select nodes from some webservice response XML to no avail. For some reason I am able to select the root node (\"xmldata\") however, when I try to drill deeper(\"

3条回答
  •  無奈伤痛
    2021-01-28 18:32

    First off stop doing this:

    Dim doc : Set xmlDoc = CreateObject("MSXML2.DOMDocument")
    xmlDoc.LoadXML (oXmlHttp.responseXML.xml)
    

    XML in the response is parsed into a DOM, which you then ask to be converted back into a string (.xml) which then parse (again) into another DOM (.LoadXML).

    Do simply this:

    Dim xmlDoc : Set xmlDoc = oXmlHttp.responseXML
    

    Secondly you are correct in your answer XPath is case-sensitive so your XPaths (apart from the .text goof which Ekkehard has already pointed out) wouldn't work because the xml you are getting didn't match what you thought you were getting.

    Finally the definition of "Camel casing" is does vary but generally this "postalAddress" is camel cased and this "PostalAddress" is refered to as "Pascal casing".

提交回复
热议问题