Details
-
Type: Improvement
-
Status: Open
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
JDK version and platform:1.5/WinXP
Description
Currently, if an object instance contains a field with a null value, that field is left out of the resulting XML. It would be great (REALLY USEFUL), if there was an option to output null fields as empty elments, or something, in the resulting XML. I have seen a number of people ask how to do this on various sites and the mailing list.
Hi,
I have encountered a similar issue. I have to write a module which will write an object graph into xml format and read the same and populate the object. While implementing the unmarshal method in com.thoughtworks.xstream.converters.Convertor I am able to handle both empty tags and self closing tags.
For the null fields in my object graph; the marshal method does not get called.
I am pretty new to XStream and haven't explored deeply into the API. Any suggestions whether a I need to extend MarshallingStrategy in order to achieve this?
Thanks and Regards,
Wriju