Hi Everyone, I created Java code from an xsd file using the CodeGen tool. The problem is, that the schema defined in the xsd is needlessly complex and so it is a real pain to use the generated classes (especially the class ElementType from the binding listed later). So I decided to write a custom marshaller/unmarshaller for ElementType and use the generated classes for anything else. I also changed the generated binding.xml to use my custom marshaller/unmarshaller.
<binding xmlns:tns="NameSpace" name="binding" package="packagename"> <namespace uri="NameSpace" default="elements" /> ... <mapping class="packagename.MappingClass1" name="MappingClass1"> <structure map-as="tns:ElementType" get-method="getElementType" set-method="getElementType" usage="optional" name="ElementOfMappedClass"/> </mapping> <mapping class="packagename.MappingClass2" name="MappingClass2"> <structure map-as="tns:ElementType" get-method="getElementType" set-method="getElementType" usage="optional" name="ElementOfMappedClass"/> </mapping> <mapping class="packagename.MappingClass3" name="MappingClass3"> <structure map-as="tns:ElementType" get-method="getElementType" set-method="getElementType" usage="optional" name="ElementOfMappedClass"/> </mapping> <mapping class="packagename.MappingClass4" name="MappingClass4"> <structure map-as="tns:ElementType" get-method="getElementType" set-method="getElementType" usage="optional" name="ElementOfMappedClass"/> </mapping> <mapping abstract="true" type-name="tns:ElementType" class="packagename.ElementType" marshaller="packagename.ElementTypeMarshaller" unmarshaller="packagename.ElementTypeMarshaller" /> ... </binding> The problem is, that when I run the binding compiler, I get a NullPointerException on line 1144 in class org.jibx.binding.def.BindingDefinition. I investigated this a little bit using the debugger discovered the cause of the problem: 1139: m_activeContext.getMappingAtLevel("packageName.ElementType") returns null (I guess this is not right) and in the next iteration 1139: m_activeContext.getMappingAtLevel("{NameSpace}:ElementType") returns an object of type MappingDirect. As map.isAbstract() is true, the if condition evaluates to true and as map.getBinding() returns null for the type MappingDirect, the access to the bind object yields the NullPointerException. I don't think that this is a problem of jibx but rather a user-error that is I did something wrong in the binding definition. So any help on this would be much appreciated even if you have a completely different idea how to solve this. I gladly provide any further information you need! Thanks in advance! - Michael ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users