XML Schema 1.1 无法识别“断言"或“断言" [英] XML Schema 1.1 not recognizing 'assert' or 'assertion'

查看:23
本文介绍了XML Schema 1.1 无法识别“断言"或“断言"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 XSD

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" >
<xs:element name="dimension">
  <xs:complexType>
    <xs:attribute name="height" type="xs:int"/>
    <xs:attribute name="width" type="xs:int"/>
    <xs:assert test="@height = @width"/>
  </xs:complexType>
</xs:element>

我知道断言/断言是 XML Schema 1.1 但不是 1.0 的一部分.但是,我读过的所有内容都表明 namespace 对于两者都是相同的:http://www.w3.org/2001/XMLSchema

I know assert/assertion are part of XML Schema 1.1 but not 1.0. However everything I have read indicates the namespace is the same for both: http://www.w3.org/2001/XMLSchema

一个小问题是我用来编写架构的程序 (Microsoft Visual Studio) 无法识别assert"元素,即命名空间中的元素 complexType"(...) 具有无效的子元素assert".

A minor problem is that the program I am using to write the Schema (Microsoft Visual Studio) does not recognize the 'assert' element, saying the 'the element complexType in namespace (...) has invalid child element 'assert'.

主要问题是,当我实际尝试根据此模式验证 XML 时,使用 xmllint,它会抛出一个错误,提示

The main problem is that when I actually try to validate an XML against this schema, using xmllint, it throws up an error saying

" element assert: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))

尽管 1.1 指向 1.1 命名空间,但 xmllint/visual studio 是否根本无法识别?

Is 1.1 simply not recognized by xmllint/visual studio, despite being pointed to the 1.1 namespaces?

推荐答案

要处理 XSD 1.1 架构,您需要 XSD 1.1 架构处理器.Microsoft 没有提供(他们似乎已经放弃实施新的 W3C XML 规范).据我所知,.NET 平台上唯一可用的 XSD 1.1 处理器是 Saxonica 的.

To process an XSD 1.1 schema you need an XSD 1.1 schema processor. Microsoft does not supply one (they seem to have given up implementing new W3C XML specifications). As far as I am aware the only XSD 1.1 processor available on the .NET platform is Saxonica's.

这篇关于XML Schema 1.1 无法识别“断言"或“断言"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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