Hi, First, I want to say that JiBX is a really neat tool. It makes XML to Java serialization so easy. However, we are using schema group substitution a lot, and this seems to be an "advanced" feature. I would really appreciate your help.
I have read the page about mapping inheritance (http://jibx.sourceforge.net/tutorial/binding-mappings.html#inherit) many times, but I am still not able to get it to work. What I have is this class hierarchy: org.standard.SuperHeader org.standard.Header com.my.Header The schema for my Header says (st=standard): <xsd:element name="Header" type="HeaderType" substitutionGroup="st:Header" /> The JiBX mapping is defined as follows: <mapping type-name="Header" abstract="true" class="org.standard.Header" extends="org.standard.SuperHeader"> <structure map-as="SuperHeader"/> ... </mapping> <mapping name="Header" class="org.standard.Header" extends="org.standard.SuperHeader"> <structure map-as="Header"/> </mapping> subclass: <mapping name="myHeader" class="com.my.Header" extends="org.standard.Header"> <structure map-as="Header"/> ... </mapping> Then I have a container class, let's call "org.standard.Container" that can contain either "org.standard.Header" or "com.my.Header": <mapping type-name="Container" abstract="true" class="org.standard.Container"> <structure name="Header" field="header" map-as="Header" usage="optional"/> ... </mapping> <mapping name="Container" class="org.standard.Container"> <structure map-as="Container"/> </mapping> The Java class is like: package org.standard; public class Container { Header header; } When I process XML that contains <st:Header>, everything's fine. But when I process XML that contains <my:Header>, it doesn't work: Here's the XML: <st:Container> <my:Header> ... </my:Header> </st:Container> I get: org.jibx.runtime.JiBXException: Expected "{http://standard}Container" end tag, found "{http://my}Header" start tag (line 67, col 35) at org.jibx.runtime.impl.UnmarshallingContext.parsePastCurrentEndTag(Unknown Source) I have tried all different combinations of "map-as" to no avail. I really like the natural, OO way that JiBX does schema group substitution, so I really want to get this to work. I appreciate any help that you can give me. Thanks! --Polly ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users