xml de yahoo >>>>>>>
Código xml:
Ver original
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> <channel> <title>Yahoo! Weather - Salou, SP</title> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Salou__SP/*http://weather.yahoo.com/forecast/SPXX0183_c.html</link> <description>Yahoo! Weather for Salou, SP</description> <language>en-us</language> <lastBuildDate>Sun, 07 Dec 2008 9:00 am CET</lastBuildDate> <ttl>60</ttl> <yweather:location city="Salou" region="" country="SP"/> <yweather:units temperature="C" distance="km" pressure="mb" speed="kph"/> <yweather:wind chill="9" direction="330" speed="8.05" /> <yweather:atmosphere humidity="82" visibility="9.99" pressure="0" rising="1" /> <yweather:astronomy sunrise="8:07 am" sunset="5:27 pm"/> <image> <title>Yahoo! Weather</title> <width>142</width> <height>18</height> <link>http://weather.yahoo.com</link> <url>http://l.yimg.com/us.yimg.com/i/us/nws/th/main_142b.gif</url> </image> <item> <title>Conditions for Salou, SP at 9:00 am CET</title> <geo:lat>41.07</geo:lat> <geo:long>1.13</geo:long> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Salou__SP/*http://weather.yahoo.com/forecast/SPXX0183_c.html</link> <pubDate>Sun, 07 Dec 2008 9:00 am CET</pubDate> <yweather:condition text="Fair" code="34" temp="10" date="Sun, 07 Dec 2008 9:00 am CET" /> <description><![CDATA[ <img src="http://l.yimg.com/us.yimg.com/i/us/we/52/34.gif"/><br /> <b>Current Conditions:</b><br /> Fair, 10 C<BR /> <BR /><b>Forecast:</b><BR /> Sun - Foggy. High: 15 Low: 7<br /> Mon - Foggy. High: 14 Low: 6<br /> <br /> <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Salou__SP/*http://weather.yahoo.com/forecast/SPXX0183_c.html">Full Forecast at Yahoo! Weather</a><BR/> (provided by The Weather Channel)<br/> ]]></description> <yweather:forecast day="Sun" date="7 Dec 2008" low="7" high="15" text="Foggy" code="20" /> <yweather:forecast day="Mon" date="8 Dec 2008" low="6" high="14" text="Foggy" code="20" /> <guid isPermaLink="false">SPXX0183_2008_12_07_9_00_CET</guid> </item> </channel> </rss><!-- api3.weather.ac4.yahoo.com uncompressed/chunked Sun Dec 7 00:27:43 PST 2008 --> /chunked Sat Dec 6 16:38:39 PST 2008 --> 8 -->
-----------------------------------
página html para analizar el xml de yahoo >>>>>
Código html:
---------Ver original
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> function parseXML() { try //Internet Explorer { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } catch(e) { try //Firefox, Mozilla, Opera, etc. { xmlDoc=document.implementation.createDocument(""," ",null); } catch(e) {alert(e.message)} } xmlDoc.async=false; xmlDoc.load("weather.xml"); temperatura=xmlDoc.getElementsByTagName("yweather: condition")[0].Attributes[2].nodeValue; document.getElementById("temp").innerHTML=temperat ura; } </script> <body onload="parseXML()"> </body> </html>
Todas las veces me da un error, en internet explorer error en la línea 23 "se requiere un objeto". En firefox con el firebug también en la línea 23 "xmlDoc.getElementsByTagName("yweather:conditi on")[0] is undefined"
muchas gracias
