Normally when an optional value is not present when marshalling JiBX
skips the element or attribute completely. If you really want these
written as empty elements instead you can do so by using something like:
<structure name="legs">
<value field="legs" style="text" usage="optional"/>
</structure>
<structure name="noOfLegs">
<value field="noOfLegs" style="text" usage="optional" default="0"/>
</structure>
- Dennis
babloosony wrote:
Hi Dennis & All,
Thank you for the response. I am sorry that my previous posting
replied with wrong subject line.
Say I have below class :
class Furniture
{
String legs = "FOUR";
int noOfLegs = 4;
}
When serializing this class into xml using normal jibx binding xml
I'll get below xml :
<Furniture>
<legs>FOUR</legs>
<noOfLegs>4</noOfLegs>
</Furniture>
but now say I have below class :
class Furniture
{
String legs;
int noOfLegs;
}
as shown above there are no values for member variables legs and
noOfLegs then I want the xml to be created like this :
<Furniture>
<legs></legs>
<noOfLegs></noOfLegs>
</Furniture>
Now how can I configure my binding.xml to achieve above ? Without
writing any custom (un)marshaller code is it possible and I find the
attribute default="" for values element is neither working for my
purpose. Please suggest ...
Thanks & Regards,
Kumar.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users
-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users