Hi,
For a project i'm working on I need to get data from a real time interface which uses web services and returns XML. I have managed to connect to the web service and get a DOM NodeList but I am now struggling to get the data into Access somehow. I was hoping i'd be able to Save the Node list as an XML file and then import it into Access but looking at some articles on the web it seems like it is not that straight forward. If I save the node list out I get all the field names but no data (which makes sense) so I think I have to iterate through all the nodes in the list and pull out the data from each one but I have no idea how. Most stuff I can find on the web is for .net or c# and not for VBA so i'm struggling to put it together because i've never worked with XML before. Anyway - for what it's worth i've got this so far...
TransData is returning the NodeList so can anyone help me extract the data out (hopefully into a recordset) so the pseudo-code would be something like;
For i = 1 to NodeList.count
RecordSet.Field(i) = NodeList(i).Data
next i
that will be a start then I just have to work out how to go to the next record and it should be nearly there!
Thanks,
Tom
For a project i'm working on I need to get data from a real time interface which uses web services and returns XML. I have managed to connect to the web service and get a DOM NodeList but I am now struggling to get the data into Access somehow. I was hoping i'd be able to Save the Node list as an XML file and then import it into Access but looking at some articles on the web it seems like it is not that straight forward. If I save the node list out I get all the field names but no data (which makes sense) so I think I have to iterate through all the nodes in the list and pull out the data from each one but I have no idea how. Most stuff I can find on the web is for .net or c# and not for VBA so i'm struggling to put it together because i've never worked with XML before. Anyway - for what it's worth i've got this so far...
Code:
Public Sub GetTranactions()
Dim DPX As New clsws_DataPortalEx
Dim xml As MSXML2.DOMDocument
Dim str_ID As String
Dim str_Password As String
Dim bln_NonNullResponse As Boolean
Dim TransData As MSXML2.IXMLDOMNodeList
Set xml = New DOMDocument
str_ID = "XXXX"
str_Password = "XXXX"
bln_NonNullResponse = True
Set TransData = DPX.wsm_GetLatestTransactions(str_ID, str_Password, bln_NonNullResponse)
xml.LoadXml TransData(0).xml
xml.Save ("C:\Transactions.xml")
End Sub
TransData is returning the NodeList so can anyone help me extract the data out (hopefully into a recordset) so the pseudo-code would be something like;
For i = 1 to NodeList.count
RecordSet.Field(i) = NodeList(i).Data
next i
that will be a start then I just have to work out how to go to the next record and it should be nearly there!
Thanks,
Tom