We're doing some fairly heavy lifting with Castor-XML and use of types which extend other types -
Say I have two schemas, "A.xsd" and "B.xsd".
Schema A contains a complex type T, <A:T>. The Sourcegen class is A.T (package A, class T).
Schema B contains a complex type <B:T>, which extends <A:T>. The Sourcegen class is B.T (package B, class T), which extends A.T.
I need to unmarshal DOM's into instances of A.T, but if an <xsi:type> of "B:T" is present, then I need the unmarshaller to create instances of B.T, rather than A.T. I could find no automated way to do this via configuration, or via creating an Unmarshaller and changing its defaults settings. However, I did come up with a simple solution, which is, after I get a DOM and before I Unmarhsall it, I run it through a small "fixup" method I wrote, which traverses the DOM, checks for xsi:type's of "B:T" and replaces those attribute values with "java:B.T". Then I can call the Unmarshaller, give it class A.T as a parameter, and I'll actually get a B.T as expected.
Question: The preceeding DOM "fixup" technique is good enough, but is there a more directly supported way?
FYI, we are using SourceGen, but not a mapping file. Would this kind of better solution require use of a mapping file?
