simpleframework, deserializing an empty element to an empty string instead of null
Answering for completeness
Annotate your element with the convert annotation and give it a converter class as a parameter
@Convert(SimpleXMLStringConverter.class)
Create the converter class that does string conversion from null to empty string
public class SimpleXMLStringConverter implements Converter<String> {
@Override
public String read(InputNode node) throws Exception {
String value = node.getValue();
if(value == null) {
value = "";
}
return value;
}
@Override
public void write(OutputNode node, String value) throws Exception {
node.setValue(value);
}
}
And don't for get to add new AnnotationStrategy()
to your persister.