== Why is this an issue?

Having a ``++nillable++`` element in a schema means that element must always be present, whether or not you have data for it. That means that the resulting XML transmissions will be larger than they need to be. On the other hand, ``++minOccurs="0"++`` communicates the same "there is no value" message, with smaller XML messages. For that reason, ``++minOccurs="0"++`` is _almost_ always preferred over ``++nillable="true"++``. The one case were ``++nillable="true"++`` is valuable is in the case of an array element, where you may have the need to set a placeholder.


This rule raises an issue when ``++nillable="true"++`` is used on an element were ``++maxOccurs++`` is 1.


=== Noncompliant code example

[source,xml]
----
<complexType name="fruitArray" nillable="true">            <!-- Noncompliant -->
  <sequence>
    <element name="fruit" type="xs:string" nillable="true" maxOccurs="4"/>    <!-- ignored -->
  </sequence>
</complexType>
----


=== Compliant solution

[source,xml]
----
<complexType name="fruitArray">
  <sequence>
    <element name="fruit" type="xs:string" minOccurs="0" maxOccurs="4"/>
  </sequence>
</complexType>
----


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Use 'minOccurs="0"' here instead of 'nillable="true"'.


=== Highlighting

``++nillable="true"++``


endif::env-github,rspecator-view[]
