I'm working on my xml skills, but validator errors my XSD at certain deep rooted places. The erorrs are:
- 18: 11 cvc-complex-type.2.4.d: Invalid content was found starting with element 'aktor'. No child element is expected at this point.
- 37: 11 cvc-complex-type.2.4.d: Invalid content was found starting
with element 'utwor'. No child element is expected at this point.
Here's XSD:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="filmy">
<xs:complexType>
<xs:sequence>
<xs:element name="film">
<xs:complexType>
<xs:sequence>
<xs:element name="tytul"/>
<xs:element name="gatunek"/>
<xs:element name="czasTrwania"/>
<xs:element name="premiera"/>
<xs:element name="produkcja"/>
<xs:element name="rezyser"/>
<xs:element name="scenariusz"/>
<xs:element name="obsada">
<xs:complexType>
<xs:sequence>
<xs:element name="aktor">
<xs:complexType>
<xs:sequence>
<xs:element name="imie"/>
<xs:element name="nazwisko"/>
<xs:element name="dataUrodzenia"/>
<xs:element name="postac"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="soundtrack">
<xs:complexType>
<xs:sequence>
<xs:element name="utwor">
<xs:complexType>
<xs:sequence>
<xs:element name="wykonawca"/>
<xs:element name="tytulUtworu"/>
<xs:element name="gatunekMuzyczny"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Here's XML:
<?xml version="1.0" encoding="utf-8"?>
<filmy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<film>
<tytul>Fight Club</tytul>
<gatunek>Thriller, Psychologiczny</gatunek>
<czasTrwania>2h11m</czasTrwania>
<premiera>11 luty 1999</premiera>
<produkcja>Niemcy, USA</produkcja>
<rezyser>David Fincher</rezyser>
<scenariusz>Jim Uhls</scenariusz>
<obsada>
<aktor>
<imie>Edward</imie>
<nazwisko>Norton</nazwisko>
<dataUrodzenia>1969</dataUrodzenia>
<postac>Narrator</postac>
</aktor>
<aktor>
<imie>Brad</imie>
<nazwisko>Pitt</nazwisko>
<dataUrodzenia>1963</dataUrodzenia>
<postac>Tyler Durden</postac>
</aktor>
<aktor>
<imie>Helena</imie>
<nazwisko>Boham Carter</nazwisko>
<dataUrodzenia>1966</dataUrodzenia>
<postac>Marla Singer</postac>
</aktor>
</obsada>
<soundtrack>
<utwor>
<wykonawca>The Pixies</wykonawca>
<tytulUtworu>Where is my mind</tytulUtworu>
<gatunekMuzyczny>Rock</gatunekMuzyczny>
</utwor>
<utwor>
<wykonawca>The Pixies</wykonawca>
<tytulUtworu>Where is my mind</tytulUtworu>
<gatunekMuzyczny>Rock</gatunekMuzyczny>
</utwor>
<utwor>
<wykonawca>The Pixies</wykonawca>
<tytulUtworu>Where is my mind</tytulUtworu>
<gatunekMuzyczny>Rock</gatunekMuzyczny>
</utwor>
</soundtrack>
</film>
</filmy>
I don't understand the problem, it says no child element is expected, is there a limit for child number? Can i expand it?
I've found answer to my question, elements that could be multiplied, has to have maxOccurs="unbounded" attribute.