I use dom4j1.6 in java(xml), but I can't addattribute null value, What can I do?

111 Views Asked by At

In my source-----

Element element1 = element.addElement("List");

element1.addAttribute("Number", (String)Map.get("NUMBER"));

element1.addAttribute("Indicator", null);

I want a result like that=> element1 Indicator=""/

I use use dom4j1.6 in java, I search the method, addattribute method => Attributes with null values are silently ignored.

but I have to print out element1 Indicator=""/

how can I do?

1

There are 1 best solutions below

3
On

Have you tried element1.addAttribute("Indicator", ""); ?