I do have all FieldDescriptors compiled and in the path.
The marshalling framework generates the following:

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

It complains that "name" is not deifined in the FieldDescriptor for ParentObject.

I had thought that the xsi:type would cause Castor to unmarshall to subObject and not
parentObject. Is there some property in castorbuilder.properties that forces castor to do that?
In fact currently I am using the xsi:type to do my own unmarshalling for the XML to subObject, but it becomes tedious as I increase the scope of the project and I think castor should be able to handle subclass unmarshalling.


Thanks.




From: Keith Visco <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Subclass unmarshalling in castor
Date: Wed, 07 Jan 2004 14:00:06 -0600




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


_________________________________________________________________
Have fun customizing MSN Messenger � learn how here! http://www.msnmessenger-download.com/tracking/reach_customize


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




Reply via email to