Hi,

If I have a type say Person and this is extended by another type Employee,
is there anyway to unmarhsall as a Person the XML produced by the Employee
helper class.

For example the Xsd would be;

        <xsd:complexType name="Person">
                <xsd:complexContent>
                                <xsd:sequence>
                                        <xsd:element name="firstName"
type="xsd:string" minOccurs="0"/>
                                        <xsd:element name="lastName"
type="xsd:string" minOccurs="0"/>
                                </xsd:sequence>
                </xsd:complexContent>
        </xsd:complexType>

        <xsd:complexType name="Employee">
                <xsd:complexContent>
                        <xsd:extension base="Person">
                                <xsd:sequence>
                                        <xsd:element name="employeeNumber"
type="xsd:long" minOccurs="0"/>
                                        <xsd:element name="salary"
type="xsd:long" minOccurs="0"/>
                                </xsd:sequence>
                        </xsd:extension>
                </xsd:complexContent>
        </xsd:complexType>

The Xml produced by Employee would look something like;

<employee>
        <firstName>Fred</firstName>
        <lastName>Flintstone</lastName>
        <employeeNumber>345</employeeNumber>
        <salary>10000</salary>
</employee>

I want this XML to be read into a Person object ignoring the extra elements
(i.e. I don't want to have to first parse it into an Employee and then cast
back).

Any help on this would be appreciated.

Thanks

Brian.



**************************************************************************
The information contained in this e-mail is confidential,
may be privileged and is intended only for the use of the
recipient named above. If you are not the intended
recipient or a representative of the intended recipient,
you have received this e-mail in error and must not copy,
use or disclose the contents of this email to anybody
else. If you have received this e-mail in error, please
notify the sender immediately by return e-mail and
permanently delete the copy you received. This email has
been swept for computer viruses. However, you should
carry out your own virus checks.


Registered in Ireland, No. 205721. http://www.FINEOS.com
**************************************************************************

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

Reply via email to