У меня есть две ошибки, которые я не могу решить, и я не могу найти решение для моего конкретного случая ...
Итак, есть мои ошибки:
s4s-elt-invalid-content.1: Недопустимое содержимое enginecapacityType. Элемент «ограничение» недопустим, неуместен или встречается слишком часто.
s4s-elt-invalid-content.1: содержимое enginepowerType недопустимо. Элемент «ограничение» недопустим, смещен или встречается слишком часто.
Мой код внизу.
Не могли бы вы помочь мне решить проблему и объяснить, почему она возникает? Спасибо.
XSD-файл:
<xsd:element name="carCollection">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="personalData" type="personalDataType" maxOccurs="1"/>
<xsd:element name="copyright"/>
<xsd:element name="car" type="carType" minOccurs="10" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="personalDataType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="2"/>
<xsd:element name="surname" type="xsd:string"/>
<xsd:element name="sex" type="sexType"/>
<xsd:element name="age" type="xsd:anyType"/>
<xsd:element name="city" type="xsd:anyType"/>
<xsd:element name="specialization" type="xsd:anyType"/>
<xsd:element name="group" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="sexType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="male"/>
<xsd:enumeration value="female"/>
</xsd:restriction>
</xsd:complexType>
<xsd:complexType name="carType">
<xsd:sequence>
<xsd:element name="brand" type="BrandType"/>
<xsd:element name="model" type="modelType"/>
<xsd:element name="enginecapacity" type="enginecapacityType"/>
<xsd:element name="color" type="colorType"/>
<xsd:element name="enginepower" type="enginepowerType"/>
<xsd:element name="production_year" type="production_yearType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="BrandType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="BMW"/>
<xsd:enumeration value="Audi"/>
<xsd:enumeration value="Skoda"/>
<xsd:enumeration value="Citroen"/>
<xsd:enumeration value="Fiat"/>
<xsd:enumeration value="Kia"/>
<xsd:enumeration value="Focus"/>
<xsd:enumeration value="Skoda"/>
<xsd:enumeration value="Toyota"/>
<xsd:enumeration value="Lexus"/>
<xsd:enumeration value="Ford"/>
</xsd:restriction>
</xsd:complexType>
<xsd:complexType name="modelType">
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:complexType>
<xsd:simpleType name="enginecapacityType">
<xsd:simpleContent>
<xsd:restriction base="xsd:decimal">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="5.0"/>
</xsd:restriction>
</xsd:simpleContent>
</xsd:simpleType>
<xsd:complexType name="colorType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="tone" type="toneType"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="enginepowerType">
<xsd:simpleContent>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="300"/>
</xsd:restriction>
</xsd:simpleContent>
</xsd:simpleType>
<xsd:complexType name="production_yearType">
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="1990"/>
<xsd:maxInclusive value="2018"/>
</xsd:restriction>
</xsd:complexType>
<xsd:complexType name="toneType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="mat"/>
<xsd:enumeration value="bright"/>
<xsd:minLength value="0"/>
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:complexType>
XML-файл:
<?xml version="1.0" encoding="utf-8" ?>
<carCollection>
<!--
W tym pliku xml jest opisana kolekcja wybranych samochodow
-->
<personalData>
<name>Łukasz</name>
<surname>Skiba</surname>
<sex>male</sex>
<age year_of_birth="1998">20</age>
<city region="Lesser Poland" motherland="Poland">Kraków</city>
<specialization semester="1">Informatyka Stosowana</specialization>
<group>WZISN1-1113</group>
</personalData>
<copyright xmlns:uek="https://www.uek.krakow.pl/">
Wydział zarządzania, Uniwersytet Ekonomiczny, Kraków
</copyright>
<car>
<brand>Ford</brand>
<model>Focus ST-Line Business</model>
<enginecapacity fuel="petrol">1.6</enginecapacity>
<color tone="mat">Black</color>
<enginepower power ="horsepower">125</enginepower>
<production_year>2018</production_year>
</car>
<car>
<brand>BMW</brand>
<model>2 Coupe</model>
<enginecapacity fuel="petrol">1.8</enginecapacity>
<color tone="mat">White</color>
<enginepower power ="horsepower">180</enginepower>
<production_year>2018</production_year>
</car>
<car>
<brand>Ford</brand>
<model>Mondeo</model>
<enginecapacity fuel="petrol">1.8</enginecapacity>
<color tone="mat">Grey</color>
<enginepower power ="horsepower">180</enginepower>
<production_year>2018</production_year>
</car>
<car>
<brand>Audi</brand>
<model>A7</model>
<enginecapacity fuel="petrol">2.8</enginecapacity>
<color tone="mat">Black</color>
<enginepower power ="horsepower">220</enginepower>
<production_year>2017</production_year>
</car>
<car>
<brand>Toyota</brand>
<model>Auris</model>
<enginecapacity fuel="petrol">2.8</enginecapacity>
<color tone="mat">Dark green</color>
<enginepower power ="horsepower">180</enginepower>
<production_year>2016</production_year>
</car>
<car>
<brand>Fiat</brand>
<model>126p</model>
<enginecapacity fuel="petrol">0.9</enginecapacity>
<color tone="mat">Red</color>
<enginepower power ="horsepower">25</enginepower>
<production_year>2000</production_year>
</car>
<car>
<brand>Citroen</brand>
<model>C3</model>
<enginecapacity fuel="petrol">1.4</enginecapacity>
<color tone="mat">Grey</color>
<enginepower power ="horsepower">70</enginepower>
<production_year>2007</production_year>
</car>
<car>
<brand>Lexus</brand>
<model>NX</model>
<enginecapacity fuel="petrol">3.0</enginecapacity>
<color tone="mat">White</color>
<enginepower power ="horsepower">160</enginepower>
<production_year>2017</production_year>
</car>
<car>
<brand>Skoda</brand>
<model>Superb</model>
<enginecapacity fuel="petrol">1.8</enginecapacity>
<color tone="mat">Blue</color>
<enginepower power ="horsepower">200</enginepower>
<production_year>2016</production_year>
</car>
<car>
<brand>Kia</brand>
<model>Cee'd</model>
<enginecapacity fuel="petrol">2.0</enginecapacity>
<color tone="mat">Navy Blue</color>
<enginepower power ="horsepower">200</enginepower>
<production_year>2017</production_year>
</car>
</carCollection>