Re: [Simple-support] What should I do to handle null elements?
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2011-07-17 02:59:45
|
Use the required=false attribute for the @Element annotation. this is described in the tutorial. --- On Sat, 16/7/11, Beyer, Doug <dou...@tr...> wrote: From: Beyer, Doug <dou...@tr...> Subject: [Simple-support] What should I do to handle null elements? To: "sim...@li..." <sim...@li...> Received: Saturday, 16 July, 2011, 7:42 AM I’m serializing a simple class and one of its data members is marked with the “@Element” attribute. In this particular case, the instance’s element value happens to be null. I get the following exception while trying to serialize the instance. org.simpleframework.xml.core.ElementException: Value for @org.simpleframework.xml.Element(name=, data=false, required=true, type=void) on field 'Payload' private java.lang.String com.troppus.data.POMRequest.Payload is null in class com.troppus.data.POMRequest. Is there a proper way to handle such cases? -----Inline Attachment Follows----- ------------------------------------------------------------------------------ AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on "Lean Startup Secrets Revealed." This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |