断言条件在Xerces中为false,在Saxon中为true

时间:2019-03-25 15:18:23

标签: saxon xerces xsd-1.1 oxygenxml

具体的断言条件由Oxerxml编辑器中的Xerces和Saxon验证引擎进行了不同的评估。

我已经创建了一个xsd模式(1.1版),并在创建的模式之后创建了相应的xml测试文件。 xml文件根据XMLSpy 2019是正确的。

如果将Xerces用作验证架构,则oxygenxml 21.0中的测试xml文件验证失败。

同时,如果使用Saxon作为验证引擎,则验证成功。

具有这样特定的assert子句的Xerces实现问题

<xs:complexType>
    <xs:sequence>
        <xs:element name="scenario" type="Scenario"/>
        <xs:element name="year" type="StressYear"/>
        <xs:element name="position" type="STACreditPosition" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:assert test="every $pos in ./position satisfies not(($pos/geography lt $pos/preceding-sibling::position[1]/geography) or (($pos/geography eq $pos/preceding-sibling::position[1]/geography) and ($pos/creditAssetClass le $pos/preceding-sibling::position[1]/creditAssetClass)))"/>
</xs:complexType>

我希望Xerces引擎的验证成功。

1 个答案:

答案 0 :(得分:0)

您没有给我们足够的信息来全面研究此问题,但是您使用表达式$pos/geography lt ...给处理器带来了艰巨的任务,因为评估取决于geography元素的数据类型。规范指出,断言应使用geography的类型化值求值(例如xs:integer(如果是这样定义的话)),但这很难实现,因为表达式是在验证之前进行求值的完成了。因此,尽管根据规范对结果进行了很好的定义,但如果避免依赖规范的这一功能并进行显式类型转换,则可能会获得更多可互操作的结果:

<xs:assert test="every $pos in ./position satisfies
 not(($pos/geography/xs:integer(.) lt $pos/preceding-sibling::position[1]/geography/xs:integer(.)) ..."/>