java使用jacksondataformatxml库将属性设置为空xml标记
我有HashMap<;字符串,对象>;它被序列化为xml。 当对象为空时
HashMap<String, Object> h1 = new HashMap<>();
h1.put("test", null);
System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(h1));
杰克逊创造了这样的东西
<HashMap>
<test/>
</HashMap>
所以我需要给这个空标签添加属性
<HashMap>
<test attribute = "something"/>
</HashMap>
可能吗
共 (0) 个答案