The schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://eduardoyanez.sytes.net" elementFormDefault="qualified" targetNamespace="http://eduardoyanez.sytes.net">
<xs:complexType name="Point">
<xs:sequence>
<xs:element name="x" type="xs:integer" minOccurs="1" maxOccurs="1" default="0"/>
<xs:element name="y" type="xs:integer" minOccurs="1" maxOccurs="1" default="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TCircle">
<xs:sequence>
<xs:element name="ratio" type="xs:integer" default="1"/>
<xs:element name="center" type="Point"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TSquare">
<xs:sequence>
<xs:element name="side" type="xs:integer" default="1"/>
<xs:element name="ul_corner" type="Point"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TShapes">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="circle" type="TCircle" minOccurs="0"/>
<xs:element name="square" type="TSquare" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="model">
<xs:complexType>
<xs:sequence>
<xs:element name="version" type="xs:string" minOccurs="1" maxOccurs="1" default="1.0"/>
<xs:element name="shapes" type="TShapes" minOccurs="1" maxOccurs="1"/>
<xs:any minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
A schema instance to test:
<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://eduardoyanez.sytes.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eduardoyanez.sytes.net shapes.xsd">
<version>1.0</version>
<shapes>
<circle><ratio>5</ratio><center><x>0</x><y>0</y></center></circle>
<square><side>5</side><ul_corner><x>0</x><y>0</y></ul_corner></square>
<circle><ratio>5</ratio><center><x>0</x><y>0</y></center></circle>
<circle><ratio>5</ratio><center><x>0</x><y>0</y></center></circle>
<square><side>5</side><ul_corner><x>0</x><y>0</y></ul_corner></square>
<circle><ratio>5</ratio><center><x>0</x><y>0</y></center></circle>
<circle><ratio>5</ratio><center><x>0</x><y>0</y></center></circle>
<square><side>5</side><ul_corner><x>0</x><y>0</y></ul_corner></square>
</shapes>
<colors></colors>
</model>
The error message:
No declaration foudn for element "colors"
"colors" should be good because xs:any.
version 1.2.1.3
Diff:
The error means that there should be something like below
in the schema.
Since there is none, the validator don't know if
is valid or it should be
Understood, I thought that "any" ment no validation, but it is not, you can put any element but it must be valid. It works after the definition of a "colors" element in the schema.
Thanks.