Just mark "b" as a container in the mapping file:

<mapping>
...
<class name="A" ...>
   <field name="fieldA1" type="string"/>
   <field name="fieldA2" type="string"/>
   <field name="b" type="B" container="true"/>
</class>
...
<class name="B" ...>
   <field name="fieldB1" type="string"/>
   <field name="fieldB2" type="string"/>
</class>

</mapping>

--Keith


[EMAIL PROTECTED] wrote:
> 
> Is it possible to marshall an Object , such that the resulting XML
> output shows only the attributes of an associated Object.
> This example would make clear what I really want
> 
> class A
> {
>         public  String fieldA1;
>         public String fieldA2;
> 
>         public class B;
> }
> 
> class B
> {
>         public  String fieldB1;
>         public String fieldB2;
> }
> 
> I want to write a Mapper which wud create the following XML output
> when I marshall an Object of class A
> 
> <A
>         fieldA1= "abc"
>         fieldA2= "def"
> 
>         fieldB1= "xyz">
> </A>
> 
> Is this possible , I don't want to map the associated class B as an
> element during marshalling.
> 
> Thanks,
> Navin

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

Reply via email to