views:

19

answers:

1

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?

A: 

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

Jherico
@beth - points of SO etiqqette. 1) if someone provides a helpful answer, Vote for their answer. 2) if someone provides the definitive answer, Accept their answer. 3) Don't ask new questions in comments ... unless they are really requests for clarification of the original answer.
Stephen C
@Stephen C- I don't have any reputation. If I have some reputation, i give votes to Jherico.
beth
But you can accept his answer, and that will give you some reputation points.
Stephen C