dom4j递归解析所有子节点
//解析返回的xml字符串,生成document对象Document document = DocumentHelper.parseText(resultXml);//根节点Element root = document.getRootElement();//子节点ListchildElements = root.elements();Map mapEle = new HashMap ();//遍历子节点mapEle = getAllElements(childElements,mapEle);
private MapgetAllElements(List childElements,Map mapEle) { for (Element ele : childElements) { mapEle.put(ele.getName(), ele.getText()); if(ele.elements().size()>0){ mapEle = getAllElements(ele.elements(), mapEle); } } return mapEle;}