【发布时间】:2013-12-13 20:47:51
【问题描述】:
我在使用 CreateObject("System.Collections.ArrayList") 解析 oList 对象时遇到问题
我在 vbscript 中遇到的错误
“Microsoft VBScript 运行时错误:对象不支持此属性或方法:'list.Add'”
基于this 教程,我知道您可以在 vbscript 中使用 COM 包装的 .Net 组件;那么为什么这不起作用呢?
其他信息:
当我在 VS08 中调试并将手表添加到列表时,它显示 Children could not be evaluated.
objNode.value 的监视具有两个字符串值。 (这是预期行为)
Function ProcessXML(oXML)
STOP
xPathExemptions= "//Exemption/@ExemptCodeWord"
Dim xmlDoc : Set xmlDoc = CreateObject("MSXML2.DOMDocument.6.0")
xmlDoc.Async = False
xmlDoc.loadXML(oXML)
Dim colNodes
Set colNodes = xmlDoc.selectNodes(xPathExemptions)
Dim oList
Set oList = CreateObject("System.Collections.ArrayList")
Dim objNode
For Each objNode in colNodes
oList.Add = objNode.value
Next
'ProcessExemptions = CStr(xmlDoc.selectNodes(xPathExemptions))
End Function
如果你在我的 vbscript 上有任何 cmets;请告诉我 - 刚开始学习,不知道最佳实践。
【问题讨论】: