函数

时间:2016-01-06 20:44:02

标签: vbscript qtp

我正在尝试在QTP中解析/处理XML文档。将对象传递给函数的正确方法是什么,以便Intellisense可以推导出对象类型并显示对象的方法和属性?

我的VBScript代码如下(在QTP编辑器中):

' Define the variable globally 
Set oldInsuranceNode = CreateObject("Msxml2.DOMDocument.6.0")
:
:
:' Lots of intervening code here
:
Set oldInsuranceNode = objOldNodeList.item(0).childNodes.item(oldFileIndex)    
oldInsuranceNode.childNodes.Count
'After the "." in oldInsuranceNode, I get the relevant functions, properties
'of the oldInsuranceNode object like childNodes, insertBefore etc. 
'(I believe it is of type IXMLDOMElement).
'Call the function                                                                                                                                                                                 
ConstructInsuranceSubNodesDictionary oldInsuranceNode, newInsuranceNode    
:
:

Function ConstructInsuranceSubNodesDictionary(nodeC, NodeD)
nodeC.childNodes.Count
'However, after the . after nodeC , I am not getting the help similar to 
'oldInsuranceNode above. The code "compiles" so to speak and it even works 
'but I am forced to use oldInsuranceNode to get Intellisense ....
'which works !

即使我正确地传入对象,编辑器也无法推断出函数中的类型(如果它是不同的名称)。在功能块中利用Intellisense的正确方法是什么,而不是使用在开始时设置的全局变量?

0 个答案:

没有答案