XML 模式中根元素的错误定义 [英] Incorrect definition for the root element in XML schema

查看:37
本文介绍了XML 模式中根元素的错误定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个包含以下无聊根元素的架构:

就我而言,模式是有效的,例如,Excel 读取它没有问题.

但是,当我尝试使用 MSXML(v3 或 v4 或 v6)验证此架构的内容时,我收到了主题错误.(我创建了 XMLSchemaCache,当我向它添加加载的架构时发生错误.)

我从 Google 了解到 MS XML 引擎不符合 W3 标准存在概念问题,必须使用不同的命名空间定义.但是,我既找不到更正确的定义,也找不到对问题的任何体面的解释.我只能在论坛上找到很多帖子没有回复.

有没有好心人能更深入地解释一下这个问题?

编辑

出于某种原因,尽管我通过版本 3、4 和 6 循环引用项目,但一直使用版本 3.强制切换到 4/6 解决了它.所以 v3 无法解析模式,其他的都很好.我相信现在可以关闭了.

解决方案

好吧,问题是我在使用 MSXML 版本 3 时没有意识到.版本 4 和 6 运行良好.

示例代码可以在 此处.而这里并没有太大帮助.>

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.

解决方案

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.

这篇关于XML 模式中根元素的错误定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆