Hi Matthias, I'm having a hard time following the German names, but it looks to me as if the unmarshalling code is somehow getting confused and setting the <xs:choice> to the sequence, rather than to the BerichtszeitraumGruppe which is actually present in the XML. I don't understand why this would happen, but if you can confirm that's what goes on it would help track down the cause.
Also, it'll make it much easier for me to try this out if you can tar/gz a complete Ant project to demonstrate the problem and attach it to a Jira report. I realize you've given me all the pieces, but I want to make sure that I'm doing exactly the same thing as you've done when I investigate the problem. Thanks, - Dennis Dennis M. Sosnoski XML and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Matthias Pretzer wrote: > Hi, > > I generated Java Code and Jibx Binding using CodeGen (current version > from cvs). The input schema is DatML/RAW, available from here: > http://www.statspez.de/core/downloads/DatML/raw/v2_0/datml-raw-de-2_0.xsd > > My test file is available from here: http://ifdef.de/kdo/datmlraw/small.xml > > The generated code and binding file is here: > http://ifdef.de/kdo/datmlraw/datmlraw-jibx.tar.gz > > When I unmarshal the sample file and directly marshal it back, I get the > following exception: > > java.lang.IllegalStateException: Missing required object > at > org.jibx.runtime.impl.MarshallingContext.pushObject(MarshallingContext.java:1181) > at > de.destatis.schema.datmlraw.de.BeginnEndeTyp.JiBX_binding_marshal_1_0(BeginnEndeTyp.java) > at > de.destatis.schema.datmlraw.de.BerichtszeitraumTyp.JiBX_binding_marshal_1_0(BerichtszeitraumTyp.java) > at > de.destatis.schema.datmlraw.de.NachrichtSegmentGruppe.JiBX_binding_marshal(NachrichtSegmentGruppe.java) > at > de.destatis.schema.datmlraw.de.NachrichtTyp.JiBX_binding_marshal_1_0(NachrichtTyp.java) > at > de.destatis.schema.datmlraw.de.JiBX_MungeAdapter.JiBX_binding_marshal_1_16() > at > de.destatis.schema.datmlraw.de.DatMLRAWD.JiBX_binding_marshal_1_0(DatMLRAWD.java) > at de.destatis.schema.datmlraw.de.JiBX_bindingDatMLRAWD_access.marshal() > at de.destatis.schema.datmlraw.de.DatMLRAWD.marshal(DatMLRAWD.java) > at > org.jibx.runtime.impl.MarshallingContext.marshalRoot(MarshallingContext.java:1021) > at > org.jibx.runtime.impl.MarshallingContext.marshalDocument(MarshallingContext.java:1104) > at de.kdo.jibx.JibxMarshaller.marshal(JibxMarshaller.java:30) > > > > The cause seems to be the null value in fiel beginn of class > BerichtszeitraumTyp, which is ok in terms of the schema. The generated > mapping of BerichtszeitraumTyp is: > > <mapping abstract="true" type-name="ns1:BerichtszeitraumTyp" > class="de.destatis.schema.datmlraw.de.BerichtszeitraumTyp"> > <structure ordered="false" choice="true"> > <structure map-as="ns1:StringTyp" test-method="ifString" > get-method="getString" set-method="setString" usage="optional" > name="string"/> > <structure map-as="ns1:BerichtszeitraumGruppe-Group" > test-method="ifBerichtszeitraumGruppe" > get-method="getBerichtszeitraumGruppe" > set-method="setBerichtszeitraumGruppe" usage="optional"/> > <structure test-method="ifBeginn" usage="optional"> > <structure map-as="ns1:BeginnEndeTyp" get-method="getBeginn" > set-method="setBeginn" name="beginn"/> > <structure map-as="ns1:BeginnEndeTyp" get-method="getEnde" > set-method="setEnde" name="ende"/> > </structure> > </structure> > </mapping> > > > If I add usage="optional" to the innermost structure elements, > marshalling works, but this of course changes the constraints implied by > the schema. > > So, I think this is a bug in the binding compilers way of handling the > usage="optional" of the <structure test-method="ifBeginn" > usage="optional"> part in the mapping. > > > Kind regards, > > Matthias > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > > ------------------------------------------------------------------------------ Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today! http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users