PDA

View Full Version : Import XML String into Table



clampron
12-19-2012, 08:58 PM
Hello,
Does anyone know how to take XML that is stored in a string and save it to a table in Access? I'd like to use the Application.ImportXML method, but that seems to want an actual file.
Application.ImportXML "CR.xml", acAppendData
I'm making several calls to a web service, and then saving each response using xmlDoc.Save, which creates the actual XML file on my hard disk. I then have to use the Application.ImportXML method to import the XML file to a table, and then delete the file and loop through the process as there is more than one record.

The problem is that creating, then deleting the file takes time and is slowing down the process. Does anyone know how I can get around having to save and delete the file on each record? I have a few million records that needs to pass through the web service.

This is the code that I'm trying to speed up:
'NEED TO MAKE THIS FASTER
xmlDoc.Save CurrentProject.Path & "\" & "CR.xml"
Application.ImportXML CurrentProject.Path & "\" & "CR.xml", acAppendData
Kill CurrentProject.Path & "\" & "CR.xml"
'NEED TO MAKE THIS FASTER