加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – 从元素’元素’开始发现无效的内容.在这一点上预计不会有

发布时间:2020-12-16 07:55:31 所属栏目:百科 来源:网络整理
导读:我正在研究我的xml技能,但验证器在某些根深蒂固的地方错误了我的XSD. 错误是: 18:11 cvc-complex-type.2.4.d:发现内容无效 与元素’aktor’.在这一点上预计不会有子元素. 37:11 cvc-complex-type.2.4.d:发现内容无效 与元素’utwor’.在这一点上预计不
我正在研究我的xml技能,但验证器在某些根深蒂固的地方错误了我的XSD.
错误是:

> 18:11 cvc-complex-type.2.4.d:发现内容无效
与元素’aktor’.在这一点上预计不会有子元素.
> 37:11 cvc-complex-type.2.4.d:发现内容无效
与元素’utwor’.在这一点上预计不会有子元素.

这是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>

这里是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>

我不明白这个问题,它说没有孩子元素是预期的,孩子的数量有限制吗?我可以扩大吗?

我已经找到我的问题的答案,可以乘以的元素必须有maxOccurs =“unbounded”属性.

我已经找到我的问题的答案,可以乘以的元素必须有maxOccurs =“unbounded”属性.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读