java 新浪天气预报接口

编程入门 行业动态 更新时间:2024-10-08 18:33:39

java <a href=https://www.elefans.com/category/jswz/34/1766670.html style=新浪天气预报接口"/>

java 新浪天气预报接口

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

回复 ? 显示需要的帮助。").append("\n\n");; // 遍历子节点下的子节点// Iterator iters = recordEle.elementIterator("status1"); // 获取子节点head下的子节点script// // // 遍历Header节点下的Response节点// while (iters.hasNext()) { Element itemEle = (Element) iters.next();// // String username = itemEle.elementTextTrim("username"); // 拿到head下的子节点script下的字节点username的值// String password = itemEle.elementTextTrim("password");// // System.out.println("username:" + username);// System.out.println("password:" + password);// } }// Iterator iterss = rootElt.elementIterator("body"); ///获取根节点下的子节点body// // 遍历body节点// while (iterss.hasNext()) {// // Element recordEless = (Element) iterss.next();// String result = recordEless.elementTextTrim("result"); // 拿到body节点下的子节点result值// System.out.println("result:" + result); Iterator itersElIterator = recordEless.elementIterator("form"); // 获取子节点body下的子节点form// // 遍历Header节点下的Response节点// while (itersElIterator.hasNext()) {// // Element itemEle = (Element) itersElIterator.next();// // String banlce = itemEle.elementTextTrim("banlce"); // 拿到body下的子节点form下的字节点banlce的值// String subID = itemEle.elementTextTrim("subID");// System.out.println("banlce:" + banlce);// System.out.println("subID:" + subID);// }// } } catch (DocumentException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); }

return buff.toString(); }

public static void main(String[] args) {Gettqbycs test=new Gettqbycs();

try {

String instr="福州天气";

System.out.println(instr.substring(2, 4));

String city=instr.substring(0, 2);

String ss= test.Gettqbycs(URLEncoder.encode(city, "GBK"));

String buffstr=test.readStringXml(ss);

System.out.println(buffstr); } catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();} }

}

:咏诘鉮ead下的子节点script// // // 遍历Header节点下的Response节点// while (iters.hasNext()) { Element itemEle = (Element) iters.next();// // String username = itemEle.elementTextTrim("username"); // 拿到head下的子节点script下的字节点username的值// String password = itemEle.elementTextTrim("password");// // System.out.println("username:" + username);// System.out.println("password:" + password);// } }// Iterator iterss = rootElt.elementIterator("body"); ///获取根节点下的子节点body// // 遍历body节点// while (iterss.hasNext()) {// // Element recordEless = (Element) iterss.next();// String result = recordEless.elementTextTrim("result"); // 拿到body节点下的子节点result值// System.out.println("result:" + result); Iterator itersElIterator = recordEless.elementIterator("form"); // 获取子节点body下的子节点form// // 遍历Header节点下的Response节点// while (itersElIterator.hasNext()) {// // Element itemEle = (Element) itersElIterator.next();// // String banlce = itemEle.elementTextTrim("banlce"); // 拿到body下的子节点form下的字节点banlce的值// String subID = itemEle.elementTextTrim("subID");// System.out.println("banlce:" + banlce);// System.out.println("subID:" + subID);// }// } } catch (DocumentException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); }

return buff.toString(); }

public static void main(String[] args) {Gettqbycs test=new Gettqbycs();

try {

String instr="福州天气";

System.out.println(instr.substring(2, 4));

String city=instr.substring(0, 2);

String ss= test.Gettqbycs(URLEncoder.encode(city, "GBK"));

String buffstr=test.readStringXml(ss);

System.out.println(buffstr); } catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();} }

}

更多推荐

java 新浪天气预报接口

本文发布于:2024-02-06 20:35:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1751238.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:新浪   天气预报   接口   java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!