Nillable attribute

The nillable attribute specifies whether or not an explicit NULL value can be assigned to the element. True enables an instance of the element to have the NULL attribute set to true. The NULL attribute is defined as part of the XML Schema namespace for instances. The default is false. This attribute is optional.

The nillable attribute is analogous to the SQL concept of NULL and is useful for dealing with the ambiguity that may otherwise surround an empty XML element value. With SQL there is a difference between a NULL value and a column containing a varchar of length zero. Similarly, in an XML schema there is a difference between an XML element containing no text value and one which is explicitly marked with xsi:nil=”true”.

Unless the XML schema indicates that an XML element is nillable, you cannot specify the nillable attribute for the element.

The following sample code with the nillable attribute can be found in the schema definition section:

<xs:element minOccurs="0" name="IncidentID" nillable="true" type="cmn:StringType" />