use*_*116 13 xml xsd xsd-validation xsd-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>
Run Code Online (Sandbox Code Playgroud)
我知道assert/assertion是XML Schema 1.1的一部分,但不是1.0.但是我读过的所有内容都表明两者的名称空间相同:http://www.w3.org/2001/XMLSchema
一个小问题是我用来编写Schema(Microsoft Visual Studio)的程序无法识别'assert'元素,说' 命名空间中的元素complexType(...)具有无效的子元素'assert'.
主要的问题是,当我实际尝试使用xmllint对此模式验证XML时,它会抛出一个错误说
" 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?))))
Run Code Online (Sandbox Code Playgroud)
虽然被指向了1.1名称空间,但xmllint/visual studio却无法识别1.1吗?
Mic*_*Kay 19
要处理XSD 1.1架构,您需要一个XSD 1.1架构处理器.微软没有提供(他们似乎放弃了实施新的W3C XML规范).据我所知,.NET平台上唯一可用的XSD 1.1处理器是Saxonica.
归档时间: |
|
查看次数: |
6808 次 |
最近记录: |