Asynchronously load an XML file



I use this function to reverse geocoding using Google Maps and load an XML with the results:



Private Function ReverseGeocode(ByVal Latitud As Double, ByVal Longitud As Double) As String

Dim webClient As New System.Net.WebClient
Dim sURL As String = "http://ift.tt/1vcPO4Q"
sURL = sURL.Replace("@lat", Latitud)
sURL = sURL.Replace("@long", Longitud)

Dim result As String = webClient.DownloadString(sURL)
Dim xmlDoc As New XmlDocument()
xmlDoc.LoadXml(result)

Dim m_nodelist As XmlNodeList
m_nodelist = xmlDoc.SelectNodes("/GeocodeResponse/result/formatted_address")
ReverseGeocode = m_nodelist(0).InnerText
End Function


My question: can this be done using an asynchronous method?


No comments:

Post a Comment