|
|
@ -30,13 +30,13 @@ public class MessageUtil { |
|
|
|
* @throws DocumentException |
|
|
|
* @throws DocumentException |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Map<String, String> xmlToMap(HttpServletRequest req) throws IOException, DocumentException{ |
|
|
|
public static Map<String, String> xmlToMap(HttpServletRequest req) throws IOException, DocumentException{ |
|
|
|
Map<String, String> map=new HashMap<>(); |
|
|
|
|
|
|
|
SAXReader reader=new SAXReader(); |
|
|
|
SAXReader reader=new SAXReader(); |
|
|
|
InputStream ins=req.getInputStream(); |
|
|
|
InputStream ins=req.getInputStream(); |
|
|
|
String resultString=IoUtil.convertStreamToString(ins); |
|
|
|
String resultString=IoUtil.convertStreamToString(ins); |
|
|
|
Document doc=DocumentHelper.parseText(resultString); |
|
|
|
Document doc=DocumentHelper.parseText(resultString); |
|
|
|
Element root=doc.getRootElement(); |
|
|
|
Element root=doc.getRootElement(); |
|
|
|
List<Element> list=root.elements(); |
|
|
|
List<Element> list=root.elements(); |
|
|
|
|
|
|
|
Map<String, String> map=new HashMap<>(list.size()); |
|
|
|
for(Element e:list){ |
|
|
|
for(Element e:list){ |
|
|
|
map.put(e.getName(), e.getText()); |
|
|
|
map.put(e.getName(), e.getText()); |
|
|
|
} |
|
|
|
} |
|
|
|