10
我試圖使用一個XSDXML架構1.1,不承認「斷言」或「斷言」
<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架構1.1的一部分,但不是1.0。不過,我已經讀到的一切表示命名空間是上是相同的:http://www.w3.org/2001/XMLSchema
一個小問題是,我使用寫模式(微軟的Visual Studio)不承認「斷言」元素的節目,說名稱空間(...)中的元素complexType具有無效的子元素「assert」。
的主要問題是,當我真正嘗試驗證XML根據該模式,使用xmllint,它拋出了一個錯誤,說
" 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根本就不是由xmllint/Visual Studio的認可,儘管是指向1.1命名空間?
謝謝!我是xml架構的新手,但會想到處理器只會從您指向的名稱空間中提取最新的定義。 是否有任何適用於Linux的1.1 XSD兼容編輯器? – user2197116 2013-03-25 17:33:59
不,您不能指望在1994年開發的處理器實現2013年發佈的規範。oXygen是一個在Linux上運行並支持XSD 1.1的編輯器 – 2013-03-26 18:23:54