This is a known problem with JiBX, basically a variation of the third and final one mentioned on the status page. It's going to take redesigned code generation to handle it properly, which is the main focus for beta 4. Hopefully I'll have this working (at least in CVS) by early May.

- Dennis

Thomas Will wrote:

I use this class:
public class A {
 private String c;
}

I use this binding file:
<binding>
 <mapping name="A" class="test.A">
   <namespace uri="uri://myname.com/xyz"
default="elements"/>
   <structure name="B" usage="optional">
     <value name="C" field="c"/>
   </structure>
 </mapping>
</binding>

With the following XML file, unmarshaling and
subsequent roundtrip marshaling is ok:
<?xml version="1.0" encoding="UTF-8"?>
<A xmlns="uri://myname.com/xyz">
   <B>
       <C>c1</C>
   </B>
</A>

With the following XML file, unmarshalling is ok, an object of type A is created, with a instance
variable c referencing null, as expected.
But when trying to marshal that object, I get a
NullpointerException.
<?xml version="1.0" encoding="UTF-8"?>
<A xmlns="uri://myname.com/xyz">
</A>


Is that a bug or is my binding file wrong?

Btw, I observed the same problem when B is optional
and contains a list of <C> elements, mapped to an ArrayList in class A.


Tom.






------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to