zoukankan      html  css  js  c++  java
  • Using x++ code achieve to Yahoo Weather Forecast

    static void Jimmy_weatherForecast(Args _args)
    {
        XmlDocument             doc = new XmlDocument();
        XmlNamespaceManager     ns;
        XmlNodeList             nodes;
        XmlNode node;
        //AddressZipCode addresszipCode;
        container day(str _day)
        {
        ;
            switch(_day)
            {
                case 'Mon' : return [1,'Monday'];
                case 'Tue' : return [2,'Tuesday'];
                case 'Wed' : return [3,'Wednesday'];
                case 'Thu' : return [4,'Thursday'];
                case 'Fri' : return [5,'Friday'];
                case 'Sat' : return [6,'Saturday'];
                case 'Sun' : return [7,'Sunday'];
                Default : return connull();
            }
        }
        ;
        //addresszipCode = _args.record();
        doc.Load("http://xml.weather.yahoo.com/forecastrss?p= CHXX0123&u=c" );// +CHXX0037   UKXX0085 CHXX0123
        //addresszipCode.ZipCode +’&u=c’);
        
        
        //东莞 : http://hk.weather.yahoo.com/china/guangdong/shilong-2162460/
        
        // Set up namespace manager for XPath
        ns = new XmlNamespaceManager(doc.nameTable());
        ns.AddNamespace("yweather", "http://xml.weather.yahoo.com/ns/rss/1.0");
        // Get forecast with XPath
        nodes = doc.SelectNodes("//rss/channel/item/yweather:forecast", ns);
        node = nodes.nextNode();
        setprefix("Weather forecast");
        while (node)
        {
            info("-----------------------------------------------------");
            info(conpeek(day(node.attributes().getNamedItem("day").InnerText()),2));
            info("-----------------------------------------------------");
            info( node.attributes().getNamedItem("text").InnerText());
            info('Min :' + node.attributes().getNamedItem("low").InnerText());
    
            info('Max :' + node.attributes().getNamedItem("high").InnerText());
            if(dayofwk(today()) == conpeek(day(node.attributes().getNamedItem("day").InnerText()),1))
            {
                info('Current :' + node.attributes().getNamedItem("code").InnerText());
            }
            else
            {
                info('Current : NA');
            }
            node = nodes.nextNode();
        }
    }
    
  • 相关阅读:
    教你三招打入App Store推荐目录!
    APP下载量低 如何显著提高APP下载量?
    导致APP排名下跌的主要因素
    如何提高APP关键词覆盖率?先熟悉套路!
    如何让你的ASO优化效果提升10倍?
    有效的移动应用推广策略
    APP运营推广不得不看的6种数据指标
    如何为你的APP选出“最好”的关键词
    手机应用开发宝典:如何养成一款畅销APP
    Linux下设置定期执行脚本
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1910571.html
Copyright © 2011-2022 走看看