Hi all

I have some vendor supplied XML that I am trying to marshal to my Java
object.

========================

<Customer>
        <Address>
                <AddressLine1>13 Some Street</AddressLine1>
                <AddressLine2 />
                <AddressLine3>Suburb</AddressLine3> 
                <AddressLine4 />
                <AddressLine5>City</AddressLine5>
                <AddressLine6>Postcode</AddressLine6>
                <Country>Country</Country>
        </Address>
        <EmailAddressList>
                <Address>[email protected]</Address>
                <Address>[email protected]</Address>
        </EmailAddressList>
</Customer>

========================

Now I want the marshaller to create a Customer, set the addresses
(List<Address>), and set the email addresses(List<String>)

here is my binding

customer.xml
========================

<mapping>
        <class name="domain.CustomerImpl">

                <map-to xml="Customer" ns-uri="http://namespace"; />
                
                <field name="Addresses" type="domain.AddressImpl"
                        collection="arraylist">
                        <bind-xml name="Address" />
                </field>
                  
                <field name="EmailAddresses" type="java.lang.String"
                        collection="arraylist">
                        <bind-xml name="Address" location="EmailAddressList" 
node="element" />
                </field>                

        </class>
</mapping>

============================
address.xml
============================
<mapping>

        <class name="domain.AddressImpl">
        
                <map-to xml="Address" ns-uri="http://namespace"; />
                
                <field name="AddressLine1" type="java.lang.String">
                        <bind-xml name="AddressLine1" node="element" />
                </field>
                
                ..snipped
 
        </class>

</mapping>
================================

When I started the mapping, starting with the addresses, the Customer was
created as expected, and the address objects created and set on the
customer.

However, after then doing the mapping for the email addresses, the address
mapping stopped working, and the only assumption I can make is that there
are 2 different "Address" elements. I confirmed this by commenting out the
email address binding, and then my addresses were once again populated
correctly. I even tried setting the "location" of the "Address" element to
"Customer" but this didnt work.

Any suggestions on how to get around this?

Thanks in advance
Shaine 

-- 
View this message in context: 
http://old.nabble.com/Binding-Composite-Element%27s-child-element-overrides-another-element-binding-tp26516953p26516953.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