Sorry for the typo in the XML file. And thanks for your help. Having gone through the stages of being a committer, I know what your are talking of. That's why I'm trying to provide you with a test case as clear as possible.
Please find attached a mavenized test case, which will certainly be easier to re-launch. The only glitch is that the stable version of the castor-maven-plugin is using castor 220.127.116.11 instead of 1.2. You can probably switch to a snapshot version of the plugin.
I have created 2 test methods, underlying the issues I find with a nillable integer.
So you are correct in your assumptions, I would expect elem 2 to be null or to have hasElem2() equals to false (if not using the wrappers).
Along the same lines, you will see that castor is trying to validate the value of elem2. I have created an elem3, which is a nillable integer as elem2, but with a type not allowing 0. When I include a nil elem3, I get a marshalling exception due to the value 0 not being allowed for elem3.
I guess that pretty much as far as I can get in describing my issue. I woudl be happy to help you track this issue in your code, but I haven't been able to identify the place where you are handling nillable elements in the code. I have seen the property begin set correctly on the XMLFieldDescriptorImpl, but I don't know where you actually check that property when unmarshalling. I went thourgh the handler but didn't find the relevant place.
Thanks for your help and your time!