Is there a way to add constant attributes to the wrapper element of a
collection?

For example, say I'm using the schema from the collections tutorial
(carriers & airports). Is there a way I can add a constant attribute
named "myAttr" to the "carriers" element?

<timetable>
   <carriers myAttr="myAttrValue">
      <carrier code="NL" rating="4">
      ...
   </carriers>
</timetable>

I've tried using something similar to this in my binding.xml file:

<collection field="carriers" name="carriers">
    <value style="attribute" name="myAttr" constant="myAttrValue"/>
    <structure name="carrier" map-as="carrier"/>
</collection>

But I'm receiving "Error: Attributes not allowed as child components
of collection; on value element..." when I try to bind my classes.
This example is a slightly modified version of what's in the
collections tutorial (specifically, the structure element) so that it
closely resembles the binding definition I'm trying to use. I'm
assuming that has no effect on the problem at hand. My guess is that I
would have to define a custom unmarshaller to handle this scenario,
but I was hoping there might be another way around it.

Thanks,
Sean

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to