Hi,
let me address one of the issues/questions right now - inline.
Regards
Werner
Sarathi Balasundaram wrote:
> Hi
>
> This is my first stab at using Castor...It has been good learning
> curve so
> far. I am presently stuck with something and would need your help
> in
> resolving it.
>
>
>
> The output xml that I am looking for should be as below
>
> <my-response>
> <employee-wrapper>
> <manager/>
> </employee-wrapper>
>
> <employee-wrapper>
> <manager/>
> </employee-wrapper>
>
> </my-response>
>
>
>
> My mapping looks as below
>
> <class name="MyResponse" auto-complete=
> "true">
> <map-to xml="my-response"/>
> <field name="employees" type="Employee"
> collection="array">
> <bind-xml auto-naming="deriveByClass" location=
> "employee-wrapper" node="element"/>
The value you supply at the location attribute defines a wrapper element
for the underlying field, which in your case is of type array. In other
words, you will get the wrapper once only, and *not* for the contained
array members.
> </field>
> </class>
>
>
> Employee is an abstract class. Manager and Worker are concrete
> classes that extend Employee class.
>
> The WSDL definition for employee-wrapper is
>
> <xs:element name="employeeWrapper">
> <xs:complexType>
> <xs:choice>
> <xs:element name="manager" type="Manager"/>
> <xs:element name="worker" type="Worker"/>
> </xs:choice>
> </xs:complexType>
> </xs:element>
>
> So, the employeeWrapper can have either manager or worker or both
>
>
> But the problem that I am facing are of 2 kinds
>
>
> 1. When 2 managers are a part of the employeeWrapper , it fails
> with
> org.exolab.castor.xml.MarshalException: element "manager" occurs
> more than
> once.
> 2. If there is manager and worker, the output is as below which
> is different from what I expect.
>
> <my-response>
> <employee-wrapper>
> <manager/>
> <worker/>
> </employee-wrapper>
> </my-response>
Please see above.
>
> Any help would be appreciated.
>
> thanks
>
> Kind Regards
> Sarathi Balasundaram
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email