Hi Ben,

I'm afraid XStream does not support this capability. If you're willing to
do a bit of work, there are 2 options I can see...

If you only have a few 'whatever' classes, you could always write a custom
converter for those classes, that will output XML exactly as you like it.
http://xstream.codehaus.org/converter-tutorial.html

Alternatively, if you wanted to do this across the board, your best bet
would be to extend (or wrap) the ReflectionConverter class, and add in all
the additional null fields at the end (though the fields would not be in
the correct order).

thanks
-Joe

On Sun, Aug 26, 2012 at 10:08 PM, Ben van Klinken <[email protected]>wrote:

> Hi,
>
> If I have an object:
>
> class whatever{
>   Double value;
> }
>
> and I do:
>
> xstream.toXML(new whatever());
>
> i get:
>
> <whaever>
>
> </whatever>
>
> but i'd like to get
> <whatever>
>  <value />
> </whatever>
>
> how can i not skip null values?
>
> Thanks
> ben
>

Reply via email to