Gopinath thanks for your suggestion. Unfortunately I had already tried this and it seems that the bind doesn't have the effect of nesting all of the list elements within a "parent" list element, which is what I'm trying to achieve, instead it renames the list elements to whatever is specified as the bind-xml name.

Maybe someone can point me to an example mapping.xml in which there is a mapping for a class which includes a list member?

--James



Gopinath R wrote:

Hi James,
Please use bind tag within the field tag.
<field ...>
  <bind-xml name="my-list" />
</field>

Thanks
Gopi

On 1/5/06, *James Adams* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    I am trying to map a List but have yet to work out the correct Castor
    mapping.  When I let Castor auto-complete the class which contains the
    List I get all of the elements of the list at the same level.  For
    example if my object contains a List of two elements I will get XML
    which looks like the following:

    <my-object>
        <list-element>
            <element-field/>
        </list-element>
        <list-element>
            <element-field/>
        </list-element>
    </my-object>

    Instead I am trying to get XML which looks like this:

    <my-object>
        <my-list>
            <list-element>
                <element-field/>
            </list-element>
            <list-element>
                <element-field/>
            </list-element>
        </my-list>
    </my-object>


    I have tried using a mapping.xml with the following entry:

        <class name="MyObject"
               auto-complete="true">
            <!--
            <field name="myList"
                   collection="arraylist"
                   type="MyListClass"/>
            -->
        </class>

    I get the first example XML whether or not I use the <field>
    element in
    the <class> mapping element above.

    The List member of the class I'm mapping is actually a List<E>, in
    that
    it is a List of objects of a class which is also mapped in the
    mapping.xml. Maybe Castor doesn't yet support generics, but I haven't
    seen anything to that effect in the documentation.

    Can someone steer me in the right direction?  Thanks in advance
    for any
    suggestions!


    --James

    -------------------------------------------------
    If you wish to unsubscribe from this list, please
    send an empty message to the following address:

    [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    -------------------------------------------------




-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to