简体   繁体   English

XML模式:找不到元素的声明

[英]XML Schema: cannot find the declaration of element

I am beginning with XML and Schemas for a university course and I ran across this today and I have not been able to figure it out. 我从大学课程的XML和Schemas开始,今天遇到了这个问题,但我一直无法弄清楚。 While validating a XML Document against an XSD I'm getting an error that says: 针对XSD验证XML文档时,出现错误消息:

cvc-elt.1: Cannot find the declaration of element 'info:SubmitForm'. cvc-elt.1:找不到元素'info:SubmitForm'的声明。 [8] [8]

Below I provided my XML Document: 下面提供了我的XML文档:

<?xml version="1.0" encoding="UTF-8"?>

<info:SubmitForm    
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:info="http://www.nielsvandeven.nl/assignmentxml"
    xsi:SchemaLocation= "http://www.nielsvandeven.nl/assignmentxml 
                     EleFoDefAssignment.xsd">
    <CustomerInfo>
        <name>John Johnson</name>
        <country>United Kingdom</country>
        <age>40</age>
        <registrated>1</registrated>
    </CustomerInfo>

    <CustomerInfo>
        <name>Jan Jansen</name>
        <country>Belgium</country>
        <age>40</age>
        <registrated>0</registrated>
    </CustomerInfo>

</info:SubmitForm>

My Schema Document looks like this: 我的架构文档如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:info="http://www.nielsvandeven.nl/assignmentxml"
        targetNamespace="http://www.nielsvandeven.nl/assignmentxml"
        elementFormDefault="unqualified">

<xsd:element name="SubmitForm">
    <xsd:complexType> 
        <xsd:sequence>
            <xsd:element name="CustomerInfo" type="info:custinfo" minOccurs="0" maxOccurs="unbounded" /> 
        </xsd:sequence> 
    </xsd:complexType> 
</xsd:element>

<xsd:complexType name="custinfo">
    <xsd:sequence>
        <xsd:element name="name" type="xsd:string" />
        <xsd:element name="country" type="xsd:string" />
        <xsd:element name="age" type="xsd:integer" />
        <xsd:element name="registrated" type="xsd:boolean" />
    </xsd:sequence>
</xsd:complexType>

</xsd:schema>

As I am still learning, please feel free to point out any mistakes I made not referring to my earlier question. 在我仍在学习的同时,请随时指出我没有提到我先前的问题时所犯的任何错误。

Thanks, Niels 谢谢,尼尔斯

尝试将xsi:SchemaLocation更改为xsi:schemaLocation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM