Create XMLCheckpoint object at runtime for XML comparison
I am creatng XMLCheckpoint at run time. I am adding numerous checkoints based on the XML files we get from log.
Checkpoints are created successfully however while comparison i need to pass Checkpoint name to XML object. Since at run time I am picking up the Checkpoint name, it is in String. I know that once i try XML.Checkpoint (Object.String) it will not work.
Is there any way it can work ? Is there any concept of reflection where i can create object from the String ?
Please see the code below and the comment marked as '//' where i am getting stuck.
Code Snipet -
Public Function testFn()
Dim XMLCheckpointNew, XMLOptions, XMLUpDoc, CheckPoint
CheckPoint = "XMLCheckPoint"
'Obtains the XMLCheckpoint object
Set XMLCheckpointNew = XML.CheckPoint //It fails here since Checkpoint is String and it is not recognizing this as an object
'Obtains the XMLCheckpointOptions object
Set XMLOptions = XMLCheckpointNew.Options
'Enables the ExtendedLogging XML checkpoint option
XMLOptions.ExtendedLogging = True
'Specifies the XML document path
XMLUpDoc = "C:\ABCD\Test.xml"
'Compares MyXMLCheckpoint with the XML document
XMLCheckpointNew.Compare(XMLUpDoc)
End Function
There is no "checkpoint" property of the XML object... so, you can't just call XML.CheckPoint.
You will need to use Eval to do what you want.
Set XMLCheckpointNew = Eval("XML." & CheckPoint)