How I can retrieve null
value, when unmarshalling, if inside XML attribute value is empty ? Now I make inside my getters checking for null
:
I think your XML looks more or less like this:
This, unfortunately, means, that you are passing an empty string.
If you want to pass null
you have two options:
tag at all).xsi:nil
.If using xsi:nil
, first you have to declare your xml element (in XSD file) as nilable
, like this:
Then, to pass the null
value inside XML do this:
or this:
This way, JAXB knows, that you are passing null
instead of an empty String.