I was able to figure out my problem after scratching my head for a while followed by some trial and error.
Here is the binding that appears to work (with some other changes due to some further updates I made): <binding> <mapping class="a.b.AbstractMessage" abstract="true" ordered="true"> <structure name="CommonInfo" field="header" ordered="false" flexible="true"> <value name="TransactionID" field="transactionId"/> </structure> </mapping> <mapping name="myXML" class="a.b.c.Foo" ordered="true" extends="a.b.AbstractMessage"> <structure map-as="a.b.AbstractMessage"/> </mapping> </binding> It doesn't really look like I did anything different, but perhaps the bug about optional structures "not being handles consistently unless they have an associated property value" bit me. Lee >From: "Lee Braverman" <[EMAIL PROTECTED]> >To: jibx-users@lists.sourceforge.net >CC: [EMAIL PROTECTED] >Subject: Another Inheritance Question >Date: Mon, 10 Jul 2006 15:23:07 -0600 > >I am a JiBX newbie and I have been able to follow the examples and have >been able to get some things ago. I have read the mailing list, and have >tried to solve a problem now that I have been working without any success. > >Situation is this, I have a class Foo that extends an abstract class which >contains some object (see classes below). I created the following mapping >to deserialize my xml input. However, when I run this I get an >IllegalStateException: Stack size mismatch on branch. The following is the >output from the compiler (with verbose turned on). Any help would be >appreciated. > >Thanks, >Lee > >Using paths: >. >C:\src\jibx\lib\jibx-bind.jar >C:\src\jibx\lib\bcel.jar >C:\src\jibx\lib\jibx-run.jar >C:\src\jibx\lib\xpp3.jar >C:\src\jibx\lib\stax-api.jar >C:\src\jibx\lib\wstx-asl.jar >Z:\lib\jakarta-commons\commons-lang.jar >. >Using bindings: >C:\JibxTest\status.xml >Running binding compiler version jibx_1_2_SNAPSHOT >binding status: >context (mp#=2) (cv#=1) (fm#=0) > mapping class a.b.AbstractMessage (#0) (abstract) > context (cv#=0) (fm#=0) > object binding for a.b.AbstractMessage create class a.b.AbstractMessage > structure ordered > element wrapper CommonInfo > component property header (Header) > object binding for a.b.Header create class a.b.Header > structure ordered > element TransactionID from property transactionId (long) > mapping class a.b.c.Foo to element <myXML> (#1) > context (cv#=0) (fm#=0) > element wrapper myXML > object binding for a.b.c.Foo create class a.b.c.Foo > structure unordered, flexible > mapping reference to a.b.AbstractMessage using property "this" >(a.b.c.Foo) >Generating code for mapping a.b.AbstractMessage >Generating code for mapping a.b.c.Foo >Error running binding compiler > >*** Error during code generation - please enter a bug report for this error >in Jira if the problem is not listed as fixed on the online stat >us page *** > >java.lang.IllegalStateException: Stack size mismatch on branch >in method a.b.c.Foo.JiBX_status_unmarshal >generated by [EMAIL PROTECTED] >from stack: > 0: a.b.c.Foo > 1: a.b.c.Foo > 2: a.b.AbstractMessage >to stack: > 0: a.b.c.Foo > 1: a.b.c.Foo > > at >org.jibx.binding.classes.BranchWrapper.setTarget(BranchWrapper.java:183) > at >org.jibx.binding.classes.BranchWrapper.setTarget(BranchWrapper.java:200) > at >org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:257) > at >org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:795) > at >org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:940) > at >org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:315) > at >org.jibx.binding.def.MappingDefinition.generateCode(MappingDefinition.java:582) > at >org.jibx.binding.def.DefinitionContext.generateCode(DefinitionContext.java:603) > at >org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:661) > at org.jibx.binding.Compile.compile(Compile.java:305) > at org.jibx.binding.Compile.main(Compile.java:385) > > >-------------------BINDING FILE >----------------------------------------------------- ><binding> > <mapping class="a.b.AbstractMessage" abstract="true"> > <structure name="CommonInfo" field="header"> > <value name="TransactionID" field="transactionId"/> > </structure> > </mapping> > > <mapping name="myXML" class="a.b.c.Foo" ordered="false" flexible="true" >extends="a.b.AbstractMessage"> > <structure map-as="a.b.AbstractMessage"/> > </mapping> ></binding> > >------------CLASSES --------------------------- > >package a.b; >public abstract class AbstractMessage { > private Header header; >} > >--------------------------------------- > >package a.b.c; >public class Foo extends AbstractMessage { > >} > >---------------------------------------- >public class Header { > int transactionId; >} > >-----------INPUT XML ----------------------------- > ><myXML> > <CommonInfo> > <TransactionID>123</TransactionID> > </CommonInfo> > <Health> > ... > </Health> ></myXML> > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users