网址:http://www.evemarketeer.com/api/orders/10000043/30119/xml
我试过这个
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(url.openStream());
但是没有用,有人有任何想法用简单的方法创建一个文档吗?
THX
答案 0 :(得分:4)
这对我有用(返回28“行”元素)
URL url = new URL("http://www.evemarketeer.com/api/orders/10000043/30119/xml");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(url.openStream());
NodeList nodes = doc.getElementsByTagName("row");
System.out.println(nodes.getLength()) + " nodes found";