Hello,

I am really struggling with castor. I am using castor 1.3.1. I have used
castor generated classes for mapping but i faced issues with class loader.
Now i am going to XML based mapping instead of generated classes. But could
not find enough information on mapping nested elements. Could anyone help me
with this.
xml message:
<code>
  
         
            <C
xsi:schemaLocation="http://www.testsite.com/2005/Individual.xsd";
recordReturn="3">
               <C1>
                  <test1>ac6556979b44</test1>
                  <test2 xsi:nil="true"/>
                  <test3>message</test3>
                  <test4 xsi:nil="true"/>
                </C1>
                <C1>
                  <test1>b3quiqioe8ii</test1>
                  <test2 xsi:nil="true"/>
                  <test3>message2</test3>
                  <test4 xsi:nil="true"/>
                </C1>
                 <C1>
                  <test1>naciehi6373</test1>
                  <test2 xsi:nil="true"/>
                  <test3>message3</test3>
                  <test4 xsi:nil="true"/>
                </C1>
            </C>
         
       
</code>

Here element "C" contains multiple(array of) C1 elements.

Mapping file:
<code>
<mapping xmlns="http://castor.exolab.org/";>
        <class name="org.test.A">
                <map-to xml="A" />
                <field name="B" type="org.test.B"
                        required="true">
                        <bind-xml name="B" node="element"/>
                </field>
        </class>

        <class name="org.test.B">
                <field name="B"
                        type="org.test.B" required="true" >
                        <bind-xml name="C" node="element" />
                </field>
        </class>
        <class name="org.test.C">
                <field name="C"
                        type="org.test.C" required="false" 
collection="arraylist">
                        <bind-xml name="C1" node="element" />
                </field>
        </class>
        <class name="org.test.C1">
                <field name="test1" type="java.lang.String">
                        <bind-xml name="test1" node="element" />
                </field>
                <field name="test2" type="java.lang.String">
                        <bind-xml name="test2" node="element" />
                </field>
                <field name="test3" type="java.lang.String">
                        <bind-xml name="test3" node="element" />
                </field>
                <field name="test4" type="java.lang.String">
                        <bind-xml name="test4" node="element" />
                </field>
        </class>
</mapping>
</code>

I am getting all kinds of unmarshalling exceptions. Any help would be
greatly appreciated.

-- 
View this message in context: 
http://old.nabble.com/castor-mapping-nested-elements-multiple-classes-tp29296849p29296849.html
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to