Ich verwendet, um den Code zu verwenden, um aktuelle Temperatur abrufen. Aber es funktioniert nicht mehr.Lesen Sie NEW "query.yahooapis.com" Wetter XML
Set objXML = CreateObject("Microsoft.XMLDOM")
objXML.async = "false"
objXML.setProperty "ServerHTTPRequest", true
objXML.load("http://weather.yahooapis.com/forecastrss?p=79105&u=f")
outTEMPer = objXML.selectSingleNode("//item/yweather:condition").Attributes.GetNamedItem("temp").Text
Neuer Link ist
objXML.load("https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.places(1) where text%3D%22amarillo%2C tx%22)&format=xml&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys")
Aber ich kann nicht Isttemp analysieren. Haben Sie versucht
outTEMPer = objXML.selectSingleNode("//item/yweather:condition").Attributes.GetNamedItem("temp").Text
und
outTEMPer = objXML.getElementsByTagName("http://xml.weather.yahoo.com/ns/rss/1.0","condition").getAttribute("temp")
XML ist:
<?xml version="1.0" encoding="UTF-8"?>
<query yahoo:lang="en-us" yahoo:created="2016-03-29T14:50:40Z" yahoo:count="1" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng">
<!-- total: 19 -->
<!-- main-1f117507-f23e-11e5-8580-d89d676f9644 -->
<results>
<channel>
<yweather:units temperature="F" speed="mph" pressure="in" distance="mi" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0"/>
<title>Yahoo! Weather - Amarillo, TX, US</title>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2354141/</link>
<description>Yahoo! Weather for Amarillo, TX, US</description>
<language>en-us</language>
<lastBuildDate>Tue, 29 Mar 2016 09:50 AM CDT</lastBuildDate>
<ttl>60</ttl>
<yweather:location xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" region=" TX" country="United States" city="Amarillo"/>
<yweather:wind speed="18" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" direction="175" chill="52"/>
<yweather:atmosphere pressure="26.13405" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" visibility="10.004077" rising="0" humidity="75"/>
<yweather:astronomy xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" sunset="8:7 pm" sunrise="7:37 am"/>
<image>
<title>Yahoo! Weather</title>
<width>142</width>
<height>18</height>
<link>http://weather.yahoo.com</link>
<url>http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif</url>
</image>
<item>
<title>Conditions for Amarillo, TX, US at 09:00 AM CDT</title>
<geo:lat xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">35.207249</geo:lat>
<geo:long xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">-101.833893</geo:long>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2354141/</link>
<pubDate>Tue, 29 Mar 2016 09:00 AM CDT</pubDate>
<yweather:condition xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" text="Breezy" temp="57" date="Tue, 29 Mar 2016 09:00 AM CDT" code="23"/>
Die untere Zeile des XML-Code ist das, was ich brauche.
Vielen Dank Aris. Das hat funktioniert.
Wenn es funktioniert hat, aber jetzt nicht, versuchen Sie 'Set objXML = Server.CreateObject (" MSXML2.DomDocument.6.0 ")' - mit der neuesten Version des Prozessors repariert manchmal diese Art von Skripten. – John
Verwenden Sie 'Msxml2.DOMDocument.6.0', auch wenn der Code ansonsten funktioniert. 'Microsoft.XMLDOM' ist veraltet und sollte nicht mehr verwendet werden. –