xml架构验证错误:cvc-complex-type.2.4.a

时间:2017-03-29 14:39:54

标签: xml xsd schema

这是我的架构代码:

    <?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            targetNamespace="https://www.w3schools.com"
            xmlns="https://www.w3schools.com"
            elementFormDefault="qualified">

    <xs:element name="DBF_text">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="paramId" type="xs:integer"/>
                <xs:element name="CDBText" type="xs:string"/>                   
                <xs:element name="menuLocation" type="xs:string"/>
                <xs:element name="sourceText" type="xs:string"/>
                <xs:element name="targetText">
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="20"/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

这是XML文件:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <DBF_text   xmlns="https://www.w3schools.com"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="https://www.w3schools.com Translations.xsd">
    <record>
    <paramId>1</paramId>
    <CDBText>ew</CDBText>
    <menuLocation>er</menuLocation>
    <sourceText>tr</sourceText>
    <targetText>rf</targetText>
     </record>
    <record>
    <paramId>2</paramId>
    <CDBText>ee</CDBText>
    <menuLocation>rr</menuLocation>
    <sourceText>tt</sourceText>
    <targetText>ff</targetText>
</record>
</DBF_text>

尝试验证架构时,我一直收到此错误消息: &#34; cvc-complex-type.2.4.a:从元素&#39;记录&#39;开始发现无效内容。 &#39; {&#34; https://www.w3schools.com&#34;:记录}&#39;预期&#34;。 我做错了什么?

0 个答案:

没有答案
相关问题