Hi Brian, Yes, I agree that this is an error - or at least an ambiguity - in the JiBX handling. There are unfortunately several issues around this type of nested <structure> binding. I've been planning to get this cleaned up completely in the JiBX 2.0 code. The only hitch is that I have no schedule at present as to when that will be done. :-(
- Dennis Dennis M. Sosnoski SOA and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Brian Wallis wrote: > I have a problem with a test-method not being included in the generated > binding code. > > The two bindings below are (I think) equivalent. The first has a named > element > called "name" that is optional and has a test-method to determine marshalling > behavior. The second has an unnamed structure with a test-method that > contains a named structure for the "name" element. > > Unfortunately in the second case no code is generated to call the hasName() > method. I suppose this sort of makes sense as the unnamed structure doesn't > marshall to an element but the contained structures/values do and should not > be used if hasName() returns false. > > binding1: > > <binding> > <mapping name="customer" class="ognl.Customer1"> > <structure name="name" usage="optional" test-method="hasName"> > <value name="first-name" field="firstName" usage="optional"/> > <value name="last-name" field="lastName" usage="optional"/> > </structure> > <value name="street1" field="street1"/> > <value name="city" field="city"/> > <value name="state" field="state"/> > <value name="zip" field="zip"/> > <value name="phone" field="phone"/> > </mapping> > </binding> > > binding2: > > <binding> > <mapping name="customer" class="ognl.Customer1"> > <structure usage="optional" test-method="hasName"> > <structure name="name"> > <value name="first-name" field="firstName" usage="optional"/> > <value name="last-name" field="lastName" usage="optional"/> > </structure> > </structure> > <value name="street1" field="street1"/> > <value name="city" field="city"/> > <value name="state" field="state"/> > <value name="zip" field="zip"/> > <value name="phone" field="phone"/> > </mapping> > </binding> > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users