I want to now the ID of each "actie" and use this ID number in a loop so I can check with the ID the Name with a Name in a Database.
But how do I get my ID number -> attribute I think, correctly in my VBScript code so I can count my ID numbers so I know how much loops I must do and then check of the ID is OK with the ID in the database.
My XML:
<?xml version="1.0"?>
<acties>
<actie ID = "1">
<Name>Glen</Name>
<Age>24</Age>
</actie>
<actie ID = "2">
<Name>Jos</Name>
<Age>32</Age>
</actie>
<actie ID = "3">
<Name>Jasmien</Name>
<Age>25</Age>
</actie>
</acties>
VBScript:
Dim XMLo, XMLname, item, TextA, TextB,strQueryA, strQueryB, XMLage
'Catch errors
On Error Resume Next
'load XML File
Set XMLo = CreateObject("Microsoft.XMLDOM")
XMLo.Async = "False"
XMLo.Load("C:\Storage Card SD\map\TEST.xml")
strQueryA = "(/acties/actie/Name)"
strQueryB = "(/acties/actie/Age)"
Set elem = XMLo.DocumentElement.FirstChild
Set XMLname= XMLo.SelectNodes(strQueryA)
Set XMLage = XMLo.SelectNodes(strQueryB)
For Each item In XMLname
TextA = TextA & item.NodeName & ":" & " " & item.Text
Next
For Each item In XMLage
TextB = TextB & item.Nodename & ":" & " "& item.Text
Next
SmartTags("Name") = TextA
SmartTags("Age") = TextB
If Err.Number <> 0 Then
ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
Err.Clear
Exit Sub
End If
ShowSystemAlarm "Readout of XML Data Was Succesful!"
End Sub