我有一个小的VB脚本在使用MSXML 3.0但不是6.0时有效。我读过我应该远离4.0 & 5.0。
所有脚本都找到一个节点,在消息框中显示内部文本。
测试脚本:
Dim xmlResponseDocument
' Set xmlResponseDocument = CreateObject("Msxml2.DOMDocument.3.0") ' uses MSXML 3.0
Set xmlResponseDocument = CreateObject("Msxml2.DOMDocument.6.0") ' uses MSXML 6.0
' Load the xml document from a file for testing
xmlResponseDocument.load("C:\Trash\IsFollowupNurseValid.xml")
Dim Nodes
set Nodes=xmlResponseDocument.getElementsByTagName("IsFollowupNurseValidResult")
for each child in Nodes
MsgBox child.text, ,child.nodeName
next
For Each lookupTypeNode In xmlResponseDocument.SelectNodes("//IsFollowupNurseValidResult")
MsgBox lookupTypeNode.Text, , "Select Nodes"
Next
MsgBox "Finish Running"
Set Nodes=nothing
set xmlResponseDocument = nothing
XML文档:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<IsFollowupNurseValidResponse xmlns="http://example.com/Quark/">
<IsFollowupNurseValidResult>false</IsFollowupNurseValidResult>
</IsFollowupNurseValidResponse>
</s:Body>
</s:Envelope>