Hi,
can anyone help me to read this simple xml file, Italian Cityes, that is making me waste a lot of time?
I would like to read the values of the individual fields in this way:
Thank in advance
regards
can anyone help me to read this simple xml file, Italian Cityes, that is making me waste a lot of time?
<?xml version="1.0" encoding="utf-8"?>
<Auxdata>
<Header>
<Fieldtype name="City" key="1" hidden="0" type="string" />
<Fieldtype name="County" key="0" hidden="1" type="string" />
<Fieldtype name="ZIPCode" key="0" hidden="1" type="string" />
<Fieldtype name="Region" key="0" hidden="1" type="string" />
</Header>
<Elements>
<Element>
<Field name="City">Agrigento</Field>
<Field name="County">AG</Field>
<Field name="ZIPCode">92100</Field>
<Field name="Region">Sicilia</Field>
</Element>
<Element>
<Field name="City">Alessandria</Field>
<Field name="County">AL</Field>
<Field name="ZIPCode">15100</Field>
<Field name="Region">Piemonte</Field>
</Element>
<Element>
<Field name="City">Ancona</Field>
<Field name="County">AN</Field>
<Field name="ZIPCode">60100</Field>
<Field name="Region">Marche</Field>
</Element>
B4X:
Dim aux As Map = ParsedData.Get("Auxdata")
Dim elements As Map = aux.Get("Elements")
Dim items As List = elements.Get("Element")
For i = 0 To items.Size -1
Dim aField As Map = items.Get(i)
For r=0 To aField.Size - 1
Dim aValues As List = aField.GetValueAt(r)
For z = 0 To aValues.Size -1
Dim aData As Map = aValues.Get(z)
For z1 = 0 To aData.Size -1
Log(aData.GetKeyAt(z1) & " - " & aData.GetValueAt(z1))
Next
Next
Next
Next
I would like to read the values of the individual fields in this way:
B4X:
For Each item As Map In items
Dim City As String = item.Get("City")
Dim County As String = item.Get("County")
Dim ZIPCode As String = item.Get("ZIPCode")
Dim Region As String = item.Get("Region")
Next
Thank in advance
regards