Vba xml (1 Viewer)

rasputnik

New member
Local time
Today, 05:14
Joined
Jun 11, 2013
Messages
2
I am new to access vba and need to read this xml file and put it into three differents tables (tblparametri, tblofferta,tblarticoli). How can i do it?
Thanks a lot.
Here's my xml file:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<exportPQ>
<parametri>
<codeOff>00013-00054</codeOff>
</parametri>
<offerta>
<codice>00013-00054 </codice>
<descrizione>PROVA DI NUOVO</descrizione>
</offerta>
<articoli>
<codice>132002</codice>
<modello>TG1200P</modello>
<rifFornitore>3</rifFornitore>
<descrizBreve>TAVOLO SU GAMBE DA 1200 MM</descrizBreve>
<importoListino>477,36</importoListino>
<scontoVendita>0;0;0</scontoVendita>
<importoUnitario>477,36</importoUnitario>
<quantita>1</quantita>
</articoli>
<articoli>
<codice>132003</codice>
<modello>TG1300P</modello>
<rifFornitore>3</rifFornitore>
<descrizBreve>TAVOLO SU GAMBE DA 2400 MM</descrizBreve>
<importoListino>477,36</importoListino>
<scontoVendita>0;0;0</scontoVendita>
<importoUnitario>477,36</importoUnitario>
<quantita>1</quantita>
</articoli>
</exportPQ>
 

speakers_86

Registered User.
Local time
Today, 00:14
Joined
May 17, 2007
Messages
1,919
You need to use the Microsoft XML 6.0 referrence. Here's a good reference:

http://www.w3schools.com/xpath/xpath_syntax.asp

Heres an example of how to use the library reference:

Code:
Public Sub test()
 
Dim objXML as DOMDocument60
set objXML  = New DOMDocument60
objXML.Load("Your Path Here")
 
Msgbox objXML.xml
 
Dim node as IXMLDOMNode
Set node = objXML.selectSingleNode("/exportPQ")
msgbox node.xml
 
Dim nodes as IXMLDOMNodeList
set nodes=objXML.selectNodes("/exportPQ")
msgbox nodes.length
 
dim node2 as ixmldomnode
'I used a modified version of you xml for testing, but you can see how it works.
set node2 = objxml.selectSingleNode("exportPQ/parametri/test[id='2']")
msgbox node2.xml
 
set node2=nothing
set nodes=nothing
set node=nothing
 
End Sub
 

Rx_

Nothing In Moderation
Local time
Yesterday, 22:14
Joined
Oct 22, 2009
Messages
2,803

Users who are viewing this thread

Top Bottom