WORKING WITH QTP

TestEveryThinG

Check XML File Valid OR Not VB QTP

Posted by rajivkumarnandvani on April 21, 2009

REM ************************************************
Rem This Function Check XML File Valid OR not  if  File not valid XML  then return False  Else  True
REM  Function  fn_CheckXMLValid(  sXMLfilepath)
REM  Input sXMLfilepath := XMLfilepath
REM  Output(ReturnType) := True or False
REM  Created:    21/April/2009    Rajiv Kumar Nandvani ## Changed:MM/DD/YYYY

REM *************************************************************************

Public Function    fn_CheckXMLValid(byval sXMLfilepath)
rem create XML object
Set xmlDoc = CreateObject( “Microsoft.XMLDOM” )
xmlDoc.Async = “False”
Rem load XML File
xmlDoc.Load( sXMLfilepath )
If  xmlDoc.parseError.errorCode<>0 Then
fn_CheckXMLValid=False
else
fn_CheckXMLValid=True
End If
Set xmlDoc = nothing

End Function

REM ************************************************

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: