Ciao a tutti
sto usando questo codice per leggere l'xml del servizio yahoo.weather
codice:<% Set objXML = Server.CreateObject("Microsoft.XMLDOM") objXML.setProperty "ServerHTTPRequest", true objXML.async = False strFile= "http://weather.yahooapis.com/forecastrss?w=718345&u=c" objXML.Load (strFile) Set AllItems = objXML.selectNodes("//channel") For I = 0 to (AllItems.Length - 1) Set Post = AllItems(I).selectNodes("item") For J = 0 to (Post.Length-1) Set title = Post(J).selectNodes("title") Set description = Post(J).selectNodes("description") Set ywea=Post(J).selectNodes("yweather:condition") %> <%=title(0).text%> <%=description(0).text%> <%=ywea(0).text%> <% Next Set title = Nothing Set description = Nothing Set link = Nothing Set Post = Nothing Next %>
riesco a leggere il file e non mi restituisce nessun errore solo che il nodo yweather:condition non mi visualizza niente, io vorrey stampare a video il valore di "code" e di "temp" per esempio
<yweather:condition text="Mostly Cloudy" code="28" temp="50"...
questo è tutto l'output xml completo
in pratica penso di riuscire a selezionare il nodo ma poi non so come dirgli che voglio leggere il valore di "code" e di "temp"codice:<?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 - Sunnyvale, CA</title> <link>http://us.rd.yahoo.com/dailynews/rss...SCA1116_f.html</link> <description>Yahoo! Weather for Sunnyvale, CA</description> <language>en-us</language> <lastBuildDate>Fri, 18 Dec 2009 9:38 am PST</lastBuildDate> <ttl>60</ttl> <yweather:location city="Sunnyvale" region="CA" country="United States"/> <yweather:units temperature="F" distance="mi" pressure="in" speed="mph"/> <yweather:wind chill="50" direction="0" speed="0" /> <yweather:atmosphere humidity="94" visibility="3" pressure="30.27" rising="1" /> <yweather:astronomy sunrise="7:17 am" sunset="4:52 pm"/> <image> <title>Yahoo! Weather</title> <width>142</width> <height>18</height> <link>http://weather.yahoo.com</link> <url>http://l.yimg.com/a/i/us/nws/th/main_142b.gif</url> </image> <item> <title>Conditions for Sunnyvale, CA at 9:38 am PST</title> <geo:lat>37.37</geo:lat> <geo:long>-122.04</geo:long> <link>http://us.rd.yahoo.com/dailynews/rss...SCA1116_f.html</link> <pubDate>Fri, 18 Dec 2009 9:38 am PST</pubDate> <yweather:condition text="Mostly Cloudy" code="28" temp="50" date="Fri, 18 Dec 2009 9:38 am PST" /> <description><![CDATA[Current Conditions: Mostly Cloudy, 50 F Forecast: Fri - Partly Cloudy. High: 62 Low: 49 Sat - Partly Cloudy. High: 65 Low: 49 Full Forecast at Yahoo! Weather (provided by The Weather Channel) ]]></description> <yweather:forecast day="Fri" date="18 Dec 2009" low="49" high="62" text="Partly Cloudy" code="30" /> <yweather:forecast day="Sat" date="19 Dec 2009" low="49" high="65" text="Partly Cloudy" code="30" /> <guid isPermaLink="false">USCA1116_2009_12_18_9_38_PST</guid> </item> </channel> </rss>
![]()
![]()
![]()

Current Conditions:
Mostly Cloudy, 50 F
Forecast:
Fri - Partly Cloudy. High: 62 Low: 49
Sat - Partly Cloudy. High: 65 Low: 49
Rispondi quotando