Disallowing null data values

If you want to disallow null values in a column:

  • Attribute-based schema – allows nulls by default; add use="required" to the attribute.

    <xsd:attribute name="oldStyle" type="xsd:string" use="required" /> 
  • Element-based schema – disallows nulls by default; the default is nillable="false", so the column below is not nullable.

    <xsd:element name="oldStyle" type="xsd:string"/>