private static String map2Xml(Map<String, String> map) {
Document document=DocumentHelper.createDocument();
Element root=document.addElement("xml");
Set<String> keys=map.keySet();
for(String key:keys){
root.addElement(key).addText(map.get(key));
}
StringWriter sw=new StringWriter();
try {
document.write(sw);
} catch (IOException e) {
e.printStackTrace();
}
return sw.toString();
}
Document document=DocumentHelper.createDocument();
Element root=document.addElement("xml");
Set<String> keys=map.keySet();
for(String key:keys){
root.addElement(key).addText(map.get(key));
}
StringWriter sw=new StringWriter();
try {
document.write(sw);
} catch (IOException e) {
e.printStackTrace();
}
return sw.toString();
}