Just solved my own problem. It's dead simple actually:

<mapping class="Foo" name="Foo">
<value name="Bar" field="bar" usage="optional"/>
      ...
</mapping>

I was starting from generated mappings and obviously got confused...
Thanks again for this great library !!!

On 15/07/2011 14:23, Jan De Moerloose wrote:
> Hi,
>
> i'm trying to map an optional child element which has only text content
> to a String field in my class:
>
> class Foo {
>       String bar;
> }
>
> The following configuration works but produces an empty element when the
> bar field is null:
>
> <mapping class="Foo" name="Foo">
> <structure name="Bar" usage="optional">
> <value style="text" get-method="getBar" set-method="setBar"
> usage="optional"/>
> </structure>
>         ...
> </mapping>
>
> <Foo><Bar/>...</Foo>
>
> I thought that the usage="optional" attribute was meant to produce an
> empty element in such cases ?
>


------------------------------------------------------------------------------
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
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to