Mal*_*lyo 14 xml validation xsd
我正在研究我的xml技能,但验证器在某些根深蒂固的地方错误我的XSD.这些人是:
这是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>
Run Code Online (Sandbox Code Playgroud)
这是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>
Run Code Online (Sandbox Code Playgroud)
我不明白这个问题,它说没有预期的子元素,是否对子号有限制?我可以扩展吗?
我找到了我的问题的答案,可以成倍增加的元素,必须有maxOccurs ="unbounded"属性.
| 归档时间: |
|
| 查看次数: |
60620 次 |
| 最近记录: |