I'm trying to unmarshal an xml doc that contains element whose type is identified by xsi:type attributes. The type may be from the root xml schema or from a complexType derived from a root complexType in another xml schema.
In order to have valid xml docs I need to have somthing like:


  <root:myElement xsi:type="derived:aDerivedElementType">
            <derived:someElement />
   </root:myElement>

However, the unmarshaller is not able to instantiate this derived element, because I get an 'unable to find fielddescriptor for someElement in MyElement', as if it does not see the derived tyope but only the root type.

I can solve this by using the java: mapping as follows:
<root:myElement xsi:type="java:com.myproject.derivedpackage.aDerivedElementType">
<derived:someElement />
</root:myElement>
in which the aDerivedElementType class is the generated class in the package com.myproject.derivedpackage. This is not a valid xml file however.
I have put this mapping of package to namespace in the castrobuilder.properties file:


org.exolab.castor.builder.nspackages=\
 http://www.myproject.com/root=com.myproject.rootpackage, \
 http://www.myproject.com/derived=com.myproject.derivedpackage

Now, if I marshal the unmarshalled object structure, I get an xml file that contains the initial xsi:type="derived:aDerivedElementType" again.

How can I use xsi:type="derived:aDerivedElementType" (using the namespace) in order to do the unmarshalling?
Thanks for any info/help/brilliant ideas


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




Reply via email to