while marshalling If we don't initialize a few jaxb object properties it will not show those properties in the marshalled String(StringWriter ) but in my case I need to show all the elements irrespective of whether there are initialized or not.If it is a String there is no problem I'm initializing to empty ,but the problem is when I had datatypes like int,boolean and date also.In this case if I need to show the elements I need to show the elements with default values such 0,false which is not proper to show like that.
Imagine employee object has properties like name,age etc
what it returns is(ignoring age
as I didn't initialize)
but I'm expecting in either this form
or this form
If I initialize age(datatype is primitive int ) to default value in java code, it will return like this which doesn't make sense,age as 0.
Is there any to to show empty elements when uninitialized.Any help highly appreciated, I'm really struggling with this