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 [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-users
