java map转xml
程序员文章站
2022-05-19 15:31:50
...
public static String map2XML(Map map) {
Set<String> keys = map.keySet();
StringBuffer sb = new StringBuffer();//创建字符串
for (String key : keys) {
sb.append("<" + key + ">");
sb.append(map.get(key) == null ? "" : map.get(key));
sb.append("</" + key + ">");
}
return sb.toString();
}
```
上一篇: 日期转换器