• AX 中获得天气预报


    static void 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= CHXX0014&u=c" );//常熟
    // addresszipCode.ZipCode +’&u=c’);
    // 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();
    }
    }

  • 相关阅读:
    POJ 3683 Priest John's Busiest Day (2-SAT+输出可行解)
    Codeforces #2B The least round way(DP)
    避免死锁的银行家算法C++程序实现
    源代码编译安装MySQL5.6.12具体过程
    Android 设计模式
    Java与设计模式-适配器模式
    Java和Flex整合报错(五)
    三层架构—再思考
    怎样让DBGrid在按住Shift点鼠标的同时能将连续范围的多行选中?
    找出你的短板
  • 原文地址:https://www.cnblogs.com/KobeZhang/p/3770588.html
Copyright © 2020-2023  润新知