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
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'.
This is my XSD
structue:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://XXYYYYYZZZZZ"
xmlns:aeeg="http://www.XXXXXX">
<xs:element name="tr_cdgn">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="1" name="decodifica_impianto"
type="aeeg:tipo_decodifica_impianto"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="dichiarazione_impianto">
<xs:annotation>
<xs:documentation>MASCHERA: Dichiarazione per impianto </xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="lunghezza_rete_non_norme_tecniche"
type="xs:integer"/>
<xs:element name="dichiarazioni_sensi_del_comma">
<xs:complexType>
<xs:sequence>
<xs:element name="controllo_compilazione">
<xs:complexType>
<xs:attribute name="codice_impianto" type="xs:int"/>
<xs:attribute name="flag_compilazione_prec_1_2" type="xs:boolean"/>
<xs:attribute name="flag_compilazione_prec_2" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="dt_anno_prec_2"
type="xs:integer"/>
<xs:element minOccurs="0" name="dt_anno_prec_1"
type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="codice_impianto" type="xs:int" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:keyref name="fk_dichiarazione_impianto" refer="aeeg:pk_impianto">
<xs:selector xpath="dichiarazione_impianto"/>
<xs:field xpath="@codice_impianto"/>
</xs:keyref>
<xs:keyref name="fk_impianto_comp_dt_dta_clienti" refer="aeeg:pk_impianto_comp_dt_dta_clienti">
<xs:selector xpath="dichiarazione_impianto/dichiarazioni_sensi_del_comma/controllo_compilazione"/>
<xs:field xpath="@codice_impianto"/>
<xs:field xpath="@flag_compilazione_prec_1_2"/>
<xs:field xpath="@flag_compilazione_prec_2"/>
</xs:keyref>
</xs:element>
<xs:complexType name="tipo_decodifica_impianto">
<xs:sequence>
<xs:element name="codice_impianto" type="xs:int"/>
<xs:element maxOccurs="1" minOccurs="1" name="denominazione" type="xs:string"/>
<xs:element name="flag_compilazione_prec_1_2" type="xs:boolean"/>
<xs:element name="flag_compilazione_prec_2" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
This is my XML
structure:
<?xml version="1.0" encoding="utf-8"?>
<tr_cdgn xmlns="WWW:XXYYYYZZ" xsi:schemaLocation="XXXXX" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<decodifica_impianto>
<codice_impianto>676</codice_impianto>
<denominazione>string</denominazione>
<flag_compilazione_prec_1_2>true</flag_compilazione_prec_1_2>
<flag_compilazione_prec_2>false</flag_compilazione_prec_2>
</decodifica_impianto>
</tr_cdgn>
Can anyone help me to understand where is the issue? Regards Sin