Keith,

To get validation working correctly for an UnmarhalHandler, that supports xsi:nil, I have created the attached TestCaseBug1723Unmarshaller. The used classes are generated based on the attached bug1723.xsd. The asserts and fails that don't work as expected are commented out. For some ValidationException a wrong reason is creating the correct behavior in which case I have added a temporary alternative assert. Could you take a look if my validation assumptions are correct ?

To get the validation correct for the above asserts and fails the Validator needs to have some notion if the tag was supplied (for example <...Tag/>) or supplied and has attribute xsi:nil set (for example <...Tag xsi::nil="true"/>) or if the tag wasn't there. In other words handle <...Tag/> and <...Tag xsi::nil="true"/> as field is null and fieldNilOption is true (Note: exception is <StringTag/> which has field = "" and nilOption is false). When the tag is missing handle it as field is null and field nilOption is false. Or should <...Tag/> as if <...Tag xsi::nil="false"/> and thus throw required field exception with <StringTag/> still the only exception. In the latter case some of my validation assumptions aren't correct (and even a hasFieldOption might be necessary) !

An example of a generated class that could be used for this purpose is the attached TopValidationTag with nilOptions: private boolean _nil_requiredNillableDateTag and private java.util.ArrayList _nilRequiredMultipleDateTag.

To set those nilOptions I would like to add a new method public void setValue( java.lang.Object object, java.lang.Object value, boolean nil) to XMLFieldHandler. But the UnmarhalHandler makes use of the FieldHandler. Should I move it to FieldHandler or create a helpermethod in UnmarhalHandler for all handler.setValue calls that checks if the handler is an instanceof XMLFieldHandler and then call the new method because in the end all handler that are encountered are XMLFieldHandler anyway ?

Because e-mail was to large for castor-dev I will try to send smaller parts of the above mentioned attachments as replies.

Thanks,

Jene



----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to