Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#11 Allow deserialization of empty optional elements

open
nobody
None
5
2009-12-08
2009-12-08
Anonymous
No

I have an optional element, named sessionToken:

@Element(name="sessionToken",required=false)
private String fSessionTokenString;

When I set this field to an empty string
fSessionTokenString = "";

it will be serialized as <sessionToken></sessionToken> which is what I expect.

When I dezerialize an XML document with such an empty element, it will be ignored and fSessionTokenString is null.

In my context, no sessionToken element or an empty sessionToken element (<sessionToken></sessionToken>) makes a different. I.e. I'm not able to distinguish between this to cases.

Discussion