title: Cvc-complex-type.2.4.a: Invalid Content Was Found Starting With Element ' '
body: <p>I have a XML file that is not valid respect to XSD but I can not understand what is the issue!
  It seems that XML is correct but It is not valid</p>
  <p><code>Cvc-complex-type.2.4.a: Invalid Content Was Found Starting With Element 'decodifica_impianto'. One Of '{decodifica_impianto}' Is Expected., Line '3', Column '24'.</code></p>
  <p>This is my <code>XSD</code> structue:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;
      targetNamespace=&quot;http://XXYYYYYZZZZZ&quot;
      xmlns:aeeg=&quot;http://www.XXXXXX&quot;&gt;
      &lt;xs:element name=&quot;tr_cdgn&quot;&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element maxOccurs=&quot;unbounded&quot; minOccurs=&quot;1&quot; name=&quot;decodifica_impianto&quot;
                      type=&quot;aeeg:tipo_decodifica_impianto&quot;/&gt;
                  &lt;xs:element maxOccurs=&quot;unbounded&quot; minOccurs=&quot;0&quot; name=&quot;dichiarazione_impianto&quot;&gt;
                      &lt;xs:annotation&gt;
                          &lt;xs:documentation&gt;MASCHERA: Dichiarazione per impianto &lt;/xs:documentation&gt;
                      &lt;/xs:annotation&gt;
                      &lt;xs:complexType&gt;
                          &lt;xs:sequence&gt;
                              &lt;xs:element minOccurs=&quot;0&quot; name=&quot;lunghezza_rete_non_norme_tecniche&quot;
                                  type=&quot;xs:integer&quot;/&gt;
                              &lt;xs:element name=&quot;dichiarazioni_sensi_del_comma&quot;&gt;
                                  &lt;xs:complexType&gt;
                                      &lt;xs:sequence&gt;
                                          &lt;xs:element name=&quot;controllo_compilazione&quot;&gt;
                                              &lt;xs:complexType&gt;
                                                  &lt;xs:attribute name=&quot;codice_impianto&quot; type=&quot;xs:int&quot;/&gt;
                                                  &lt;xs:attribute name=&quot;flag_compilazione_prec_1_2&quot; type=&quot;xs:boolean&quot;/&gt;
                                                  &lt;xs:attribute name=&quot;flag_compilazione_prec_2&quot; type=&quot;xs:boolean&quot;/&gt;
                                              &lt;/xs:complexType&gt;
                                          &lt;/xs:element&gt;
                                          &lt;xs:element minOccurs=&quot;0&quot; name=&quot;dt_anno_prec_2&quot;
                                              type=&quot;xs:integer&quot;/&gt;
                                          &lt;xs:element minOccurs=&quot;0&quot; name=&quot;dt_anno_prec_1&quot;
                                              type=&quot;xs:integer&quot;/&gt;
                                     &lt;/xs:sequence&gt;
                                  &lt;/xs:complexType&gt;
                              &lt;/xs:element&gt;
                          &lt;/xs:sequence&gt;
                          &lt;xs:attribute name=&quot;codice_impianto&quot; type=&quot;xs:int&quot; use=&quot;required&quot;/&gt;
                      &lt;/xs:complexType&gt;
                  &lt;/xs:element&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
          &lt;xs:keyref name=&quot;fk_dichiarazione_impianto&quot; refer=&quot;aeeg:pk_impianto&quot;&gt;
              &lt;xs:selector xpath=&quot;dichiarazione_impianto&quot;/&gt;
              &lt;xs:field xpath=&quot;@codice_impianto&quot;/&gt;
          &lt;/xs:keyref&gt;
          &lt;xs:keyref name=&quot;fk_impianto_comp_dt_dta_clienti&quot; refer=&quot;aeeg:pk_impianto_comp_dt_dta_clienti&quot;&gt;
              &lt;xs:selector xpath=&quot;dichiarazione_impianto/dichiarazioni_sensi_del_comma/controllo_compilazione&quot;/&gt;
              &lt;xs:field xpath=&quot;@codice_impianto&quot;/&gt;
              &lt;xs:field xpath=&quot;@flag_compilazione_prec_1_2&quot;/&gt;
              &lt;xs:field xpath=&quot;@flag_compilazione_prec_2&quot;/&gt;
          &lt;/xs:keyref&gt;
  
      &lt;/xs:element&gt;
      &lt;xs:complexType name=&quot;tipo_decodifica_impianto&quot;&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element name=&quot;codice_impianto&quot; type=&quot;xs:int&quot;/&gt;
              &lt;xs:element maxOccurs=&quot;1&quot; minOccurs=&quot;1&quot; name=&quot;denominazione&quot; type=&quot;xs:string&quot;/&gt;
              &lt;xs:element name=&quot;flag_compilazione_prec_1_2&quot; type=&quot;xs:boolean&quot;/&gt;
              &lt;xs:element name=&quot;flag_compilazione_prec_2&quot; type=&quot;xs:boolean&quot;/&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
  &lt;/xs:schema&gt;
  
  
  </code></pre>
  <p>This is my <code>XML</code> structure:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;tr_cdgn xmlns=&quot;WWW:XXYYYYZZ&quot; xsi:schemaLocation=&quot;XXXXX&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
    &lt;decodifica_impianto&gt;
      &lt;codice_impianto&gt;676&lt;/codice_impianto&gt;
      &lt;denominazione&gt;string&lt;/denominazione&gt;
      &lt;flag_compilazione_prec_1_2&gt;true&lt;/flag_compilazione_prec_1_2&gt;
      &lt;flag_compilazione_prec_2&gt;false&lt;/flag_compilazione_prec_2&gt;
    &lt;/decodifica_impianto&gt;
  &lt;/tr_cdgn&gt;
  </code></pre>
  <p>Can anyone help me to understand where is the issue?
  Regards
  Sin</p>