Hi,

 

My Problem is: I want to use a single java object to create 2 different elements of the same java class with different binding names.

I’ll again explain detain what I want.

1)       I have a java class called AddressInfo and another class called ShipToInfo which contains AddressInfo Object.

2)       ShipToInfo has some other data like, name along with AddressInfo object.

3)       Now while writing mapping xml file, I have to bind AddressInfo class elements to different names ( like CurrentStreet,and ShipToStreet) .

4)       I am stuck here. DO not understand how to do this.

 

Can somebody please help me in this?

 

 

Here is the output XML I want from Marshaller

<MainTag>

.

.

.

.

<CurrentAddress>

<CurrentStreet>1374 S WHITE ST</CurrentStreet>

<CurrentCity>ANAHEIM</CurrentCity>

</CurrentAddress>

 

<ShipToAddress>

            <ShipToName>anyName</ShipToName>

<ShipToStreet>123 Anaheim</ShipToStreet>

<ShipToCity>Orange</ShipToCity>

</ShipToAddress>

 

 

Mapping File:

 

<MainTag>

<class  name = “com.sample.AddressInfo” >

<bind-xml name=”CurrentAddress”>

<field name="street" type="java.lang.String">

                        <bind-xml name="CurrentStreet" />        

            </field>

            <field name="city" type="java.lang.String">

                        <bind-xml name="CurrentCity" />           

            </field>

</class>

 

<class  name = “com.sample.AddressInfo” >

<bind-xml name=”ShipToAddress”>

<field name="street" type="java.lang.String">

                        <bind-xml name="ShipToStreet" />         

</field>

            <field name="city" type="java.lang.String">

                        <bind-xml name="ShipToCity" />

            </field>

</class>

</MainTag>

 

 

java Classes

 

class AddressInfo {

String stree;

String City;
}

 

Class ShipToInfo {

String name;

AddessInfo addr;
}

 

 

Regards,

Shital

 

 

 

 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to