Hi Leif,

The issue here is that you need a <value> element rather than a <structure> element inside the first <collection>, since all you want to do there is represent the individual items in the array as simple elements in the XML (at least, I assume that's what you want). The <structure> element is only needed in the second case because you're creating a more complex XML representation, where the XML has a wrapper element to hold the values as attributes. So just replace your <structure name="item" value-style="element"... with <value name="item" style="element" ... and you should have what you want.

Sorry I didn't notice this on my earlier reply, and for the delayed response.

 - Dennis

Leif Stainsby wrote:

Hi Dennis,

Thanks for the response.  I've updated my local JiBX from CVS as you
suggested, but, neither option appears to work.  Both return this
message:

    [bind] Error: No compatible mapping defined for type
java.lang.String; on structure element at (line 6, col 96, in
JiBX/bin/CollectionAttributeItemTest-binding.xml)

Perhaps there's still a piece missing?  The modified binding file
(sporting the contained-element-with-type attribute option) is below.

...Leif
----------------
<binding>
 <mapping name="document" class="test.MyDocument">
   <structure name="elementItemList">
<collection field="elementItemList" factory="org.jibx.runtime.Utility.arrayListFactory"> <structure name="item" value-style="element" usage="optional" type="java.lang.String"/>
     </collection>
   </structure>
   <structure name="attributeItemList">
<collection field="attributeItemList" factory="org.jibx.runtime.Utility.arrayListFactory">
       <structure name="item" value-style="attribute" usage="optional">
         <value name="code" style="attribute" type="java.lang.String"/>
       </structure>
     </collection>
   </structure>
 </mapping>
</binding>
----------------


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to