Sub ParseXml
Dim xml As Xml2Map
xml.Initialize
Dim m As Map = xml.Parse($"<NewResponse>
<ExtResult rank="1" finalRank="0" type="0">
<NewItems>
<NewItem Id1="1" Id2="4259" flag="0" q1="0" q2="1" name="Typed string" lang="0"/>
</NewItems>
<Results>
<Result Id="0" number1="176.45" number2="250.84" number3="152" dist="0" resultType="1">
<NewString string="Area 1" stringType="1"/>
<NewString string="Area 2" stringType="5"/>
<NewString string="Area 3" stringType="4"/>
<NewString string="Area 4" stringType="3"/>
<NewString string="Area 5" stringType="2"/>
<NewString string="99990" stringType="7"/>
</Result>
<Result Id="0" number1="90.28" number2="453.23" number3="198" dist="0" resultType="1">
<NewString string="Area 6" stringType="1"/>
<NewString string="Area 7" stringType="5"/>
<NewString string="Area 8" stringType="4"/>
<NewString string="Area 9" stringType="3"/>
<NewString string="Area 0" stringType="2"/>
<NewString string="88888" stringType="7"/>
</Result>
</Results>
</ExtResult>
</NewResponse>"$)
Log(m)
Dim result As Object = FindValue("number1",m)
Log(result)
Dim result As Object = FindValue("Results",m)
Log(result)
End Sub
Sub FindValue (Key As String, XmlMap As Map) As Object
Dim v As Object
For Each k As String In XmlMap.keys
If Key.EqualsIgnoreCase(k) Then Return XmlMap.Get(k)
If XmlMap.Get(k) Is Map Then
v = FindValue(Key,XmlMap.Get(k))
If v <> Null Then Return v
End If
If XmlMap.Get(k) Is List Then
Dim l As List = XmlMap.Get(k)
For Each o As Object In l
If o Is Map Then
v = FindValue(Key,o)
If v <> Null Then Return v
End If
Next
l.Clear
End If
Next
Return Null
End Sub