all groups > dotnet xml > december 2004 >
You're in the

dotnet xml

group:

"element is not declared" errors when validating xml from schema


"element is not declared" errors when validating xml from schema mailing NO[at]SPAM sunnybrisbane.com
12/30/2004 7:01:13 PM
dotnet xml:
I am writing a web application for job seekers, and am adding a
section that allows administrators to upload jobs to the system via
xml. I have used an xml schema to validate the xml they upload. The
website runs on IIS5 using classic ASP, and the xml validation is done
in a .NET component written in C# that is registered for COM interop
on the webserver.

I have a test application to test the .NET component, and that
application does not give any errors, however, when I run it in the
web application, it keeps coming back with errors on every element.

It just started having problems today, so I assume it's caused by some
change I made recently, but I can't figure out what.

The errors I get back are as follows:

The 'http://www.w3.org/2001/XMLSchema:schema' element is not declared.
An error occurred at , (2, 2).
The 'version' attribute is not declared. An error occurred at , (2,
12).
The 'id' attribute is not declared. An error occurred at , (2, 71).
The 'http://www.w3.org/2001/XMLSchema:simpleType' element is not
declared. An error occurred at , (4, 3).
The 'name' attribute is not declared. An error occurred at , (4, 17).
The 'http://www.w3.org/2001/XMLSchema:restriction' element is not
declared. An error occurred at , (5, 4).
The 'http://www.w3.org/2001/XMLSchema:restriction' element is not
declared. An error occurred at , (5, 4).
The 'http://www.w3.org/2001/XMLSchema:enumeration' element is not
declared. An error occurred at , (6, 5).
......

the xml I am trying to validate is:

<?xml version="1.0" encoding="UTF-8" ?>
<Jobs>
<schemaVersion>1.10</schemaVersion>
<JobRecord>
<JobID>1</JobID>
<JobIDIsNew>true</JobIDIsNew>
<JobDocType>53</JobDocType>
<JobDocument>asdf</JobDocument>
.......

against this schema:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema version="1.10" xmlns:xs="http://www.w3.org/2001/XMLSchema"
id="JobDataSet">
<xs:element name="Jobs">
<xs:complexType>
<xs:sequence>
<xs:element name="schemaVersion" type="xs:decimal" />
<xs:element name="JobRecord" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="JobID" type="xs:integer" minOccurs="1"
maxOccurs="1" />
<xs:element name="JobIDIsNew" type="xs:boolean" minOccurs="1"
maxOccurs="1" />
<xs:element name="JobDocType" type="JobDocTypeType"
minOccurs="1" maxOccurs="1" />
<xs:element name="JobDocument" type="xs:string" minOccurs="1"
maxOccurs="1" />
......

Re: "element is not declared" errors when validating xml from schema mailing NO[at]SPAM sunnybrisbane.com
1/1/2005 3:27:39 PM
My mistake, it turned out I was passing the wrong xml to the validation
routine rather - it was the schema xml!

[quoted text, click to view]
AddThis Social Bookmark Button