cvc-complex-type.2.4.d
: Invalid content was found starting with elementwydane
. No child element is expected at this point.
I do not know what I could do to solve this problem. Someone have any idea?
Below is a fragment of my XML Schema:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xs:element name="nazwa" type="xs:string"/>
<xs:element name="wydane" type="xs:string"/>
<xs:element name="dlc">
<xs:complexType mixed="false">
<xs:sequence>
<xs:choice>
<xs:element ref="wydane"/>
<xs:element ref="nazwa"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="rodzaj" type="xs:string"/>
</xs:complexType>
</xs:element>
Below is a frament of XML:
<?xml version="1.0" encoding="UTF-8"?>
<hobby xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xmlschema2.xsd">
<gry>
<strategiczne>
<HeartsOfIron4 gatunek="RTS,GSW">
<studio premiera="06.06.2016">Pradadox Interactive</studio>
<dlc rodzaj="PayToPlay">
<nazwa>By blood alone</nazwa>
<wydane>2022.09.27</wydane>
<nazwa>No step back</nazwa>
<wydane>2021.11.23</wydane>
<nazwa>Battle for the Bosporus</nazwa>
<wydane>2020.10.15</wydane>
<nazwa>La Resistance</nazwa>
<wydane>2022.02.25</wydane>
<nazwa>Man the Gun</nazwa>
<wydane>2019.02.28</wydane>
<nazwa>Waking the Tiger</nazwa>
<wydane>2018.03.08</wydane>
<nazwa>Death or Dishonor</nazwa>
<wydane>2017.06.14</wydane>
<nazwa>Together for Victory</nazwa>
<wydane>2016.12.15</wydane>
</dlc>
Your XSD says that
dlc
can have a choice of either onewydane
element or onenazwa
element, yet your XML tries to repeat those elements. Upon the first repetition, you receive the stated error.If you wish
dlc
to have that choice repeated, then addmaxOccurs="unbounded"
to thexsd:choice
element.If you wish
dlc
content to be an ordered pairs ofwydane
andnazwa
elements, then changexsd:choice
toxsd:sequence
, and again addmaxOccurs="unbounded"
to thexsd:sequence
element.See also