Can you show an example of the "marshalled" XML, Castor should be adding
an xsi:type attribute to the <obj> element that will allow Castor to
know it's a subObject and not a parentObject.

Such as: 

<thirdObject>
   <obj xsi:type="subObject">
      ...
   </obj>
</thirdObject>


Also, have you compiled the generated descriptors?

--Keith


asim razzaq wrote:
> 
> Hi,
> 
> I have the following schema (snippet):
> 
> <xsd:complexType name="parentObject" abstract="true">
>   <xsd:sequence>
>      <xsd:element name="Id" minOccurs="0" type="xsd:string"/>
>   </xsd:sequence>
> </xsd:complexType>
> <xsd:element name="subObject">
> <xsd:complexType>
>   <xsd:complexContent>
>    <xsd:extension base="parentObject">
>     <xsd:sequence>
>      <xsd:element name="name" minOccurs="0" type="xsd:string"/>
>     </xsd:sequence>
>    </xsd:extension>
>   </xsd:complexContent>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="thirdObject">
> <xsd:complexType>
>   <xsd:complexContent>
>     <xsd:sequence>
>      <xsd:element name="obj" minOccurs="0" type="parentObject"/>
>     </xsd:sequence>
>   </xsd:complexContent>
> </xsd:complexType>
> </xsd:element>
> 
> Castor generates ParentObject.java, SubObject.java, ThirdObject.java.
> I use the objects as follows:
> 
> SubObject sObj = new SubObject();
> sObj.setName("name");
> ThirdObject tObj = new ThirdObject();
> tObj.setObj(sObj);
> 
> tObj gets marshalled fine, but when it gets unmarshalled it throws an
> exception saying the FieldDescriptor
> for "name" does noe exist for parentObject.
> 
> I was wondering if there is a way in castor to let it know that it needs to
> use the
> FieldDescriptor of SubObject and not ParentObject?
> 
> Thanks.
> 
> _________________________________________________________________
> Working moms: Find helpful tips here on managing kids, home, work �  and
> yourself.   http://special.msn.com/msnbc/workingmom.armx
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

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

Reply via email to