I need some assistance with deleting an existing XML file. My classic ASP program produces an XML file but first it needs to see if a prior one exists. If one does exist, then I need to delete the old XML file before starting a new one. The problem with my logic is that I am loading the existing XML into memory and then deleting the physical file. How do I unload it from memory? This is causing my program to crash.
Here is my code right now:
strFilename = "Apogee1.xml"
Set oXML = Server.CreateObject("Microsoft.XMLDOM")
Set oXML.DocumentElement = oXML.createElement("P21_VPT_DATA")
Set oFSO = Server.CreateObject("Scripting.FilesystemObject")
' check file exists
bitFileExists = oXML.load(strXMLFile)
if bitFileExists then
oFSO.DeleteFile(strXMLFile) ?? This will delete the physical file but does not clear out memory from oXML.load.
Set oChild = oXML.appendChild(oXML.createElement("BillingData")) ???? my program will crash here if an existing file was loaded into memory.