Thema: Delphi Attribut auslesen..

Einzelnen Beitrag anzeigen

Benutzerbild von mtin
mtin

Registriert seit: 8. Jun 2005
34 Beiträge
 
#9

Re: Attribut auslesen..

  Alt 2. Mai 2007, 12:33
hm...danke das ihr euch alle solche Mühe macht, aber es geht trotzdem nicht

Result bleibt leer...

hier mal der Komplette Quelltext, einfach ein TXMLDocument aufs Form geknallt und dann müsste das doch gehen

Delphi-Quellcode:
function getWeather():string;
var weatherCheck:TidHTTP;
weather:string;
xnChannel, xnCondition: IXMLNode;
begin

try
  weatherCheck := TidHTTP.Create;
  //http://xml.weather.yahoo.com/forecastrss?p=GMXX1930&u=c
  weather := weatherCheck.Get('http://xml.weather.yahoo.com/forecastrss?p=GMXX1930&u=c');

  Form1.xmldoc.LoadFromXML(weather);
  Form1.xmldoc.Active:=true;
  xnChannel := Form1.xmldoc.DocumentElement.ChildNodes['channel'];
  xnCondition := xnChannel.ChildNodes['condition'];
  result := VarToStr(xnCondition.Attributes['temp']);

  weatherCheck.Free;
except
  result := 'could not retrieve weather data';
end;

end;
  Mit Zitat antworten Zitat