I am creating a VB6 application, which reads information from an XML file and then copies a particular file to my local workstation. The XML looks something like the below;
<ArrayOfMediaFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MediaFile>
<fileName>Default.jpg</fileName>
<filePath>C:\Program Files\media</filePath>
<dateModified>2012-04-30T14:41:28.6893988-05:00</dateModified>
<Action>Add</Action>
</MediaFile>
<MediaFile>
<fileName>icon.jpg</fileName>
<filePath>C:\Program Files\media</filePath>
<dateModified>2012-04-30T15:43:31.2995396-05:00</dateModified>
<Action>Add</Action>
</MediaFile>
</ArrayOfMediaFile>
Now my application reads the file name and if the action node is “add” it copies the file and converts the action node to “keep”.
The Problem
What i wish to do now is to save this file after every operation. If while saving the XML there is any error, I should be able to make a copy of the XML which I can again use in the operation.
This code always backs up the XML file .xml to .backup, and then if successful, it saves to _Processed.xml. Hope that’s what you want.