PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 24 → Read Xml
Read Xml
Débuté par adrianoboller, 18 nov. 2014 13:41 - 1 réponse
Membre enregistré
2 962 messages
Popularité : +89 (91 votes)
Posté le 18 novembre 2014 - 13:41
Procedure WS_LeituraXml()

//Consulta Xml

IF GloDebugSN = "S" THEN
Info("LeituraXml")
END

Rua, Numero, Bairro01, Bairro02, Cidade, Estado, Pais, CEP, Latitude, Longitude is string = ""

HTTPRequest("http://maps.google.com/maps/api/geocode/xml?address=Rua+Professora+Antonia+Reginato+Vianna,+337+Curitiba,+PR&sensor=true")

XMLResultado is string = WS_Android_IOS_HTTPGetResult()// HTTPGetResult(httpResult)

XmlDoc is XMLDocument

XmlDoc = XMLOpen(XMLResultado, fromString)


IF (XmlDoc.GeocodeResponse.status) = "OK" THEN

FOR EACH address_component OF XmlDoc.GeocodeResponse.result on address_component

//info(address_component.long_name, address_component.short_name, address_component.type)
IF CEP = ""

IF (address_component.long_name <> "" AND address_component.short_name <> "" AND address_component.type = "street_number")
Numero = address_component.long_name
END
IF (address_component.long_name <> "" AND address_component.short_name <> "" AND address_component.type = "route")
Rua = address_component.long_name
END
IF (address_component.long_name <> "" AND address_component.short_name <> "" AND address_component.type = "neighborhood")
Bairro01 = address_component.long_name
ELSE IF (address_component.long_name <> "" AND address_component.short_name <> "" AND address_component.type = "sublocality")
Bairro02 = address_component.long_name
END
IF (address_component.long_name <> "" AND address_component.short_name <> "" AND address_component.type = "locality")
Cidade = address_component.long_name
ELSE IF (address_component.long_name <> "" AND address_component.short_name <> "" AND address_component.type = "administrative_area_level_2")
Cidade = address_component.long_name
END
IF (address_component.long_name <> "" AND address_component.short_name <> "" AND address_component.type = "administrative_area_level_1")
Estado = address_component.long_name
END
IF (address_component.long_name <> "" AND address_component.short_name <> "" AND address_component.type = "country")
Pais = address_component.long_name
END
IF (address_component.long_name <> "" AND address_component.short_name <> "" AND address_component.type = "postal_code")
CEP = address_component.long_name
END

END

FOR EACH geometry OF XmlDoc.GeocodeResponse.result on geometry
IF (geometry.location.lat <> "")
Latitude = geometry.location.lat
END
END

FOR EACH geometry OF XmlDoc.GeocodeResponse.result on geometry
IF (geometry.location.lng <> "")
Longitude = geometry.location.lng
END
END

END

END

Info(Latitude,Longitude)
Membre enregistré
2 962 messages
Popularité : +89 (91 votes)
Posté le 09 décembre 2017 - 00:21
IF InAndroidMode() = True THEN
FOR nCont = 1 TO sTotal
StringToDate(sData = XMLExtractString(XML_Retorno,"Data",nCont))
sDescricao = XMLExtractString(XML_Retorno,"Descricao",nCont)
sIdFotos = XMLExtractString(XML_Retorno,"idGaleriaFotos",nCont)
LooperAddLine(LOOP_Fotos,sData,sDescricao,sIdFotos)
END
//implementar codigo para IOS
END


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/