Hi,
When using XStream, I get am empty tag(on the collection field) if I try to serialise an Object has java.util.List
collection which is empty. How to I remove that empty tag in the xml output?
Hi,
When using XStream, I get am empty tag(on the collection field) if I try to serialise an Object has java.util.List
collection which is empty. How to I remove that empty tag in the xml output?
Your List variable must be null and not containing an empty list to avoid the 'empty' tag.
List list = getList();
if(list.isEmpty()) { list = null; }
// Serialization ...
EDIT:
If you want that to be done automatically you need to create a custom converter, follow this tutorial: http://xstream.codehaus.org/converter-tutorial.html