That's unfortunate, but as the label/using approach is effectively deprecated it's unlikely to be fixed. The preferred approach for handling this type of situation is to make use of abstract mappings. In this case you'd do that by making the UserData <mapping> abstract and drop the name="..." and label="..." attributes, then your <structure> reference can just drop the using="...".

If you want to use this both ways you need an abstract <mapping class="..." type-name="typeName"> (with no name="...") to define the reusable structure, along with a non-abstract mapping to actually define the standalone use, which would look like this:

 <mapping class="..." name="...">
   <structure map-as="typeName"/>
 </mapping>

The only problem is I tested this technique after RC1 and found a problem, which I just fixed in CVS. The fix will be in the coming 1.0 production release.

Sorry to force this change in approach, but the label/using thing just had too many problems to be workable. I left it in in the hope that people who were already using it would not have to change their bindings, but I'll probably eliminate it completely after 1.0.

 - Dennis

Michael Kurz wrote:

Hi

I tried to switch from beta 3c to rc1 today but encountered an error with some of my collection mappings. The following example shows two of the mappings producing an error:


<mapping class="Users" label="Users" name="Users" post-set="postSet">
  <collection field="User">
    <structure name="User" type="UserData" using="UserData"/>
  </collection>
</mapping>
<mapping class="UserData" label="UserData" name="UserData">
  <value field="Login" name="Login"/>
  <value field="Password" name="Password"/>
</mapping>


With error:


[bind] Error running binding compiler
[bind] *** Error during code generation - please report this error on the JiBX users list so that the condition can be caught during validation *** [bind] java.lang.IllegalStateException: Internal error: Expected UserData on stack, found java.util.ArrayList
[bind] full stack:
[bind] 0: java.util.ArrayList
[bind] 1: org.jibx.runtime.impl.UnmarshallingContext
[bind] at
org.jibx.binding.classes.MethodBuilder.verifyCompatible(MethodBuilder.java:393) [bind] at org.jibx.binding.classes.MethodBuilder.verifyCallStack(MethodBuilder.java:495)
...


I use this collection - structure mix with "using" to have the possibility to map collection elements whose name in the collection differs from the name given in the mapping definition. With beta 3c this was no problem.

regards
Michael Kurz


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to