The absence of a datum in XML can be expressed either by omitting the element (minOccurs="0"
in schema) or by setting it to xsi:nil="true"
(nillable=true
in schema).
Using minOccurs=0
seem altogether cleaner and more consistent, and it doesn't require the XML to reference the XSD namespace. So what is the benefit of nillable
?
Best Answer
nillable is in the spec because the XML Schema WG had a number of members who saw the world in SQL terms and wanted an explicit equivalent to SQL's null values. It's totally unnecessary in my view: just ignore it and don't use it.