Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incorrect definition for the root element in XML schema

There is a schema with the following boring root element:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

The schema is valid as far as I'm concerned, and Excel reads it no problem, for instance.

However, when I try to validate stuff agaist this schema using MSXML (v3 or v4 or v6) I get the subject error. (I create XMLSchemaCache and the error occurs when I add the loaded schema to it.)

From Google I learned that there is a conceptual problem with MS XML engines not conforming to W3 standards and that a different namespace definition must be used. However, I couldn't find neither that more correct definition nor any decent explanation of the problem. I could only find many posts without replies on forums.

Could anyone be so kind to explain the matter a bit deeper?

EDIT

For some reason, despite I cycled project references through versions 3, 4 and 6, version 3 was used all the time. A force switch to 4/6 solved it. So v3 is not able to parse the schema, others are fine. I believe that can be closed now.

like image 243
GSerg Avatar asked Jan 22 '23 18:01

GSerg


1 Answers

Ok, the problem was that I was using MSXML version 3 without realising it. Versions 4 and 6 work fine.

Sample code can be found here. And guys here were not too helpful.

like image 79
GSerg Avatar answered Jan 29 '23 11:01

GSerg