Do you schema validation truned on? This may help:
http://stackoverflow.com/questions/805989/can-one-validate-marshalled-xml-with-jaxb-2-0
On 09/13/2011 10:51 AM, Prêtre Thierry wrote:
> Hello everybody,
> i use JAXB to marshall a bean in an XML and i've a xsd to validate it.
>
> I've one field in my bean called for example "firstname" and in the
> xsd this field is in minoccurs=1. By this case, if a set firstname to
> null then i've have validation error.
>
> Y tried to modified manually the output validated and i've inserted
> the tag :
>
> <firstname/>
>
> -- without value
>
> and the validation pass.
>
> So how can i create the empty tag when i've "null" in the value ?
--
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com