preload

CreateXMLDOMFromFile (QTP, TestComplete, VBScript)

Posted by Albert Gareev on Jun 13, 2008 | 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


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