Reputation: 13
Error:
s4s-elt-must-match.1: The content of 'viviendas' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: complextype.
Schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://wwww.vivienda.io"
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.vivienda.io">
<xs:element name="viviendas">
<xs:complextype>
<xs:sequence maxoccurs="unbounded">
<xs:element name="vivienda" minoccurs="1">
<xs:complextype>
<xs:sequence>
<xs:element name="direccion">
<xs:complextype>
<xs:sequence>
<xs:element name="calle"></xs:element>
<xs:element name="numero"></xs:element>
<xs:element name="localidad"></xs:element>
<xs:element name="provincia"></xs:element>
</xs:sequence>
</xs:complextype>
</xs:element>
<xs:element name="refCatastral"></xs:element>
<xs:element name="habitaciones">
<xs:complextype>
<xs:sequence>
<xs:element name="habitacion" minoccurs="1">
<xs:complextype>
<xs:attribute name="area" use="required" type="xs:string">
<xs:complextype>
<xs:restriction base="xs:integer">
<xs:mininclusive value="1"/>
<xs:maxlength value="2"/>
</xs:restriction>
</xs:complextype>
</xs:attribute>
<xs:attribute name="tipo" use="required" >
<xs:complextype>
<xs:restriction base="xs:string">
<xs:pattern value="salon|cocina|baño|dormitorio"/>
</xs:restriction>
</xs:complextype>
</xs:attribute>
</xs:complextype>
</xs:element>
</xs:sequence>
</xs:complextype>
</xs:element>
<xs:element name="servicios">
<xs:complextype>
<xs:sequence>
<xs:element name="servicio" minoccurs="1"></xs:element>
</xs:sequence>
</xs:complextype>
</xs:element>
</xs:sequence>
</xs:complextype>
</xs:element>
<xs:element name="comprador" minoccurs="0" maxoccurs="1">
<xs:complextype>
<xs:attribute name="dni" use="required">
<xs:simpletype>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{9}[A-Z]{1}"/>
</xs:restriction>
</xs:simpletype>
</xs:attribute>
<xs:sequence>
<xs:element name="nombre"></xs:element>
<xs:element name="edad" >
<xs:simpletype>
<xs:restriction base="xs:integer">
<xs:mininclusive value="1"/>
</xs:restriction>
</xs:simpletype>
</xs:element>
<xs:element name="ref_catastral"></xs:element>
</xs:sequence>
</xs:complextype>
</xs:element>
</xs:sequence>
</xs:complextype>
</xs:element>
</xs:schema>
Upvotes: 1
Views: 2149
Reputation: 111491
As Dan Field indicated, you have to take care of case in complexType
(as well as in all XSD element names). However, there are many more issues to address in your XSD. Here is the complete list, followed by a completely corrected XSD:
xs:complextype
-> xs:complexType
maxoccurs
-> maxOccurs
minoccurs
-> minOccurs
xs:attribute
cannot have a xs:complexType
child.mininclusive
-> minInclusive
maxlength
-> maxLength
but maxLength
cannot appear as facet to
restriction on xs:integer
; changed to maxInclusive="99"
.xs:string
cannot appear on xs:attribute
along with the
specification of a local type via xs:simpleType
too.xs:simpleType
-> xs:simpleType
xs:attribute
must appear after, not before, xs:sequence
.Here are the above corrections applied to your XSD such that no further errors remain:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://wwww.vivienda.io"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.vivienda.io">
<xs:element name="viviendas">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="vivienda" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="direccion">
<xs:complexType>
<xs:sequence>
<xs:element name="calle"></xs:element>
<xs:element name="numero"></xs:element>
<xs:element name="localidad"></xs:element>
<xs:element name="provincia"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="refCatastral"></xs:element>
<xs:element name="habitaciones">
<xs:complexType>
<xs:sequence>
<xs:element name="habitacion" minOccurs="1">
<xs:complexType>
<xs:attribute name="area" use="required">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="99"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="tipo" use="required" >
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="salon|cocina|baño|dormitorio"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="servicios">
<xs:complexType>
<xs:sequence>
<xs:element name="servicio" minOccurs="1"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="comprador" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="nombre"></xs:element>
<xs:element name="edad" >
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ref_catastral"></xs:element>
</xs:sequence>
<xs:attribute name="dni" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{9}[A-Z]{1}"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Upvotes: 2
Reputation: 21641
XML tags are CaSe SenSitIve. complexType
!= complextype
. You need to fix that throughout your schema - it's expecting to find <xs:complexType>
but instead finding <xs:complextype>
, which is not valid.
It looks like you will have similar problems elsewhere - for example, simpleType
, maxLength
are other tags that have different casing than the lower case names you've used in your schema. As you fix each error, your validation software should indicate the next error.
Upvotes: 3