Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading xml file

Status
Not open for further replies.

elly00

Technical User
Jun 30, 2011
69
IT
Hi
I have a xml file that I read to save data in db table

The section of sql that gives problem is like that:

<AltriDatiGestionali>
<TipoDato>Cod: 1</TipoDato>
<RiferimentoTesto>GAS</RiferimentoTesto>
</AltriDatiGestionali>
-<AltriDatiGestionali>
<TipoDato>Cod: 1</TipoDato>
<RiferimentoTesto>GAS</RiferimentoTesto>
</AltriDatiGestionali>

I need to save both data present in the "AltriDatiGestionali" section..In some case the second GAS should not be present..


Is there a way to do so?


I'm using this code but it down't works correctly..If the second section is not present GAS1 (second variable) always is valorized

for each child in x.ChildNodes
NODE1=child.nodename
NODE2=child.text


'----------------------------------------------

if NODE1="AltriDatiGestionali" then
IF NODE2<>"" AND MID(NODE2,1,6)="Cod: 1" AND CONTAGAS=0 THEN
GAS=NODE2
msgbox("GAS= "&GAS )
CONTAGAS=CONTAGAS+1
END IF
End If
'----------------------------------------------
if NODE1="AltriDatiGestionali" then
IF NODE2<>"" AND MID(NODE2,1,6)="Cod: 1" AND CONTAGAS=1 THEN
GAS1=NODE2
msgbox("GAS1= "&GAS1 )
END IF
End If






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top