I am trying to write an XSD file with an element that has an attribute and three children. I get the following error message:
The content is not valid. Expected is (annotation?, (restriction | extension)). adress_validator.xsd:18: element complexType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}element': The content is not valid. Expected is (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*)). WXS schema adress_validator.xsd failed to compile
Could anybody tell me what I am doing wrong?
Here is what I have tried:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.w3schools.com"
xmlns:tns="https://www.w3schools.com"
elementFormDefault="qualified">
<xsd:element name="adress_book">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="house" maxOccurs="unbounded">
<xsd:complexType>
<xsd:simpleContent>-
<xsd:extension base="xsd:string">
<xsd:attribute name="id" type="xsd:int"
use="required"></xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="surname"></xsd:element>
<xsd:element name="first_name"></xsd:element>
<xsd:element name="phone_number"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>