java xml转map
程序员文章站
2022-05-19 15:33:32
...
String responseText = (String) resultMap.get("responseText");
responseText=HttpUtil.dealWithGash(responseText);
resultData = HttpUtil.getYbMap(responseText);
public static Map getYbMap(String xmlString) throws Exception {
Map returnmap=new HashMap();
Document doc = null;
doc = DocumentHelper.parseText(xmlString);
Element businessdata = (Element) doc.selectSingleNode("//businessdata");
for (Iterator iterator = businessdata.elementIterator(); iterator.hasNext();) {
Element e = (Element) iterator.next();
returnmap.put(e.getName(), e.getText());
}
return returnmap;
}
上一篇: 如何只能插入数据
下一篇: Oracle几个优化有用的视图