Niels_vandeVen
Niels_vandeVen

Reputation: 13

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. While validating a XML Document against an XSD I'm getting an error that says:

cvc-elt.1: Cannot find the declaration of element 'info:SubmitForm'. [8]

Below I provided my XML Document:

<?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

Upvotes: 0

Views: 775

Answers (1)

lexicore
lexicore

Reputation: 43671

Try changing xsi:SchemaLocation into xsi:schemaLocation.

Upvotes: 1

Related Questions