CreateXMLDOMFromFile (QTP, TestComplete, VBScript)

Categories: Source codeXML Data

Parent page: Service Functions – MSXMLDOM (QTP, TestComplete, VBScript)

Description

Create XML DOM object by loading it from a file. If file doesn’t exists returns Nothing.

Implementation

Public Function CreateXMLDOMFromFile(ByVal sFileName, ByVal boolAsync)
 Dim FSO, objXMLDoc
 Dim boolRC
 Set FSO = CreateObject("Scripting.FileSystemObject")
 boolRC = FSO.FileExists(sFileName)
 Set FSO = Nothing
 If Not boolRC Then
 Set CreateXMLDOMFromFile = Nothing
 Exit Function
 End If
 Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
 objXMLDoc.async = boolAsync
 objXMLDoc.load(sFileName)
 Set CreateXMLDOMFromFile = objXMLDoc
End Function

  • Leave a Reply

    * Required
    ** Your Email is never shared

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by the author is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.