Trying to check a small xml, I get the following error: no character data is allowed by the content model.
This is my xml example:
<?xml version="1.0" encoding="UTF-8"?>
<plats xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="1_e.xsd">
<primer codi='3'>Caldo de verdures</primer>
<segon codi='4'>Pollastre al forn</segon>
<primer codi='7'>Spaguettis</primer>
<segon codi='12'>Llus a la planxa</segon>
</plats>
And this is my xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="t_primer">
<xs:choice>
<xs:element name="primer" type="xs:string" />
</xs:choice>
<xs:attribute name="codi" type="xs:string" />
</xs:complexType>
<xs:complexType name="t_segon">
<xs:choice>
<xs:element name="segon" type="xs:string" />
</xs:choice>
<xs:attribute name="codi" type="xs:string" />
</xs:complexType>
<xs:element name="plats">
<xs:complexType>
<xs:choice>
<xs:sequence>
<xs:element name="primer" type="t_primer" />
</xs:sequence>
<xs:sequence>
<xs:element name="segon" type="t_segon" />
</xs:sequence>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
I can not find where I am wrong, and the code looks good ...
source
share