[Simple-support] How "not" to serialize nulls
Brought to you by:
niallg
|
From: Kevin J. <kjo...@in...> - 2008-04-22 05:48:48
|
Hi,
When serializing an object that has a null data member, the resulting
xml has an empty element in it. Is there a way to avoid this?
For example:
class foo {
@Element
private String bar;
}
if "bar" has a value of "2", the xml will look like this:
<foo>
<bar>2</bar>
</foo>
but if "bar" has a value of NULL, the xml will look like this:
<foo>
<bar></bar>
</foo>
Where I would prefer:
<foo>
</foo>
Is this possible?
thanks,
-kevin
|