Hello!
Is there any way to query nodes from xml like Microsoft XML?
The full XML format is:
I need to take the totalDistance="34.5" from <RouteSegment order="3" name="Route Point 3"...
Thank you in advance!
Is there any way to query nodes from xml like Microsoft XML?
B4X:
NodeLst = sXML.SelectNodes("//RouteSegment[@name=""Route Point 3""]")
If Not (aNodeLst Is Nothing) Then
For Each aNode In aNodeLst
For Each aAttr In aNode.Attributes
If aAttr.baseName = "totalDistance" Then
RouteDist = Round(Val(aAttr.Text) * 1000, 2)
End If
Next
Next
End If
B4X:
<RouteResponse>
<RouteResult routeId="1">
<RouteSegment order="1" name="Route Point 1" time="" totalTime="" distance=""
totalDistance="0.0" speed="" turn="" turnPointX=""
turnPointY="" segments="" turnSegments=""/>
<RouteSegment order="2" name="Route Point 2" time="" totalTime="" distance=""
totalDistance="21.7" speed="" turn="" turnPointX=""
turnPointY="" segments="" turnSegments=""/>
<RouteSegment order="3" name="Route Point 3" time="" totalTime="" distance=""
totalDistance="34.5" speed="" turn="" turnPointX=""
turnPointY="" segments="" turnSegments=""/>
</RouteResult>
</RouteResponse/>
Thank you in advance!
Last edited: