Ver Mensaje Individual
  #4  
Antiguo 30-01-2018
farute farute is offline
Miembro
 
Registrado: feb 2010
Posts: 84
Reputación: 15
farute Va por buen camino
hola estoy intentando sacar los valores de este xml
Cita:
<?xml version="1.0" encoding="utf-8" ?>
<current_observation>
<image>
</image>
<location>
<elevation>2579 ft</elevation>
</location>
<station_type>other</station_type>
<observation_time>Last Updated on January 30, 9:17 AM CET</observation_time>
<observation_time_rfc822>Tue, 30 Jan 2018 08:17:42 GMT</observation_time_rfc822>
<weather></weather>
<temperature_string>31.8 F (-0.1 C)</temperature_string>
<temp_f>31.8</temp_f>
<temp_c>-0.1</temp_c>
</current_observation>

pero sólo lo consigo con algunos con otros no.

por ejemplo con esto si quiero sacar la <elevation> que está en <location> la saco sin problemas:
Código Delphi [-]
var
    StartItemNode : IXMLNode;
begin
   XMLDoc.FileName := 'http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=IVILLAQU3';
   XMLDoc.Active:=True;

   StartItemNode := XMLDoc.DocumentElement.ChildNodes.FindNode('location') ;
label3.Text:=  StartItemNode.childNodes['elevation'].Text;
end;

pero como quiera sacar otros valores de fuera de location como por ejemplo el "temp_c" no hay manera, no funcionan

Última edición por farute fecha: 30-01-2018 a las 09:43:26.
Responder Con Cita