9月 102011
 

■groovy -v
——————————————————
Groovy Version: 1.8.2 JVM: 1.7.0
——————————————————

■weather_forecast.groovy


rssFeed = new groovy.util.XmlParser().parse("http://weather.yahooapis.com/forecastrss?p=JAXX0099&u=c")
item = rssFeed.channel.item[0]
title = item.title[0].value()[0]
condition = item."yweather:condition"

println "${title} : ${condition.@text[0]}, ${condition.@temp[0]}[℃]"

■実行
// 企業内からなどネット接続時にproxy経由が必要な場合
// set JAVA_OPTS=-Dhttp.proxyHost=proxy.xxxxx.co.jp -Dhttp.proxyPort=8080
groovy weather_forecast.groovy

■結果(標準出力)
——————————————————
Conditions for Yokohama, JA at 9:59 pm JST : Partly Cloudy, 27[℃]
——————————————————

Sorry, the comment form is closed at this time.