Hi

Does anybody know if there is a plan to support the property combination 'choice=true' and 'flexible=true' on the structure element?  I am running version 1.1.3 now and it does not support this.  If not, is there a way around the below problem?

I have problems figuring out how jibx could support an unordered list with unknown elements!  That is, I have the following requirements for the XML list:
1) Any number (zero or more) Car and Boat elements
2) Car and Boat elements may appear in any order
3) Any element from any other name space may appear in the list (need to use flexible attribute for this)
4) The solution should not require the below XML snippet to be adapted in any way (the binding could be changed off course)

Consider the XML snippet below:
<list>
 <car>
   <name>Volvo</name>
 </car>
 <boat>
   <name>Windy</name>
 </boat>
 <car>
   <name>Saab</name>
 </car>
</list>

Item 1 and 2 above could be parsed using the following binding:
<mapping class="TestMappings" name="list">
   <collection type="java.util.ArrayList" field="list">
       <structure choice="true" ordered="false" type="TestMapping">
           <structure name="car" field="car" usage="optional">
               <value name="name" field="name" usage="optional"/>
           </structure>
           <structure name="boat" field="boat" usage="optional">
               <value name="name" field="name" usage="optional"/>
           </structure>
       </structure>
   </collection>
</mapping>

To fulfill requirement 3 above I add the flexible attribute:
   <structure choice="false" ordered="false" type="TestMapping" flexible="true">
I now get the below error:
   Caused by: org.jibx.runtime.JiBXException: Duplicate element "car"(line 8, col 8)

To fix this problem I tried adding the allow-repeats attribute:
   <structure choice="false" ordered="false" type="TestMapping" allow-repeats="true" flexible="true">
This time, jibx was only able to find the last Car (Saab) and the Boat element in the XML snippet above!

Any solution to this problem would be greatly appreciated!  I have the Java classes also if needed.


Thanks,
Per-Ivar

-------------------------------------------------------------------------
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

Reply via email to