要解析的string为response
1.将字符串转换城数据流对象InputStream
ByteArrayInputStream in=new ByteArrayInputStream(response.getBytes());
2.将数据流转化成document对象
Document document =DocumentBuilderFactory.newInstance().newDocumentBuilder.Parse(in);
3.将document对象转化城url
Element root=document.getDocumetElement();
NodeList nodes=root.getElementsByTagName("node");
Node node=nodes.item(0);
String url=node.getFirstChild().getNodeValue();
return url;
转载于:https://blog.51cto.com/asalinux/1050796