0

Xerces 和 Saxon 验证引擎在oxyxml 编辑器中对特定的断言条件进行不同的评估。

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

如果将 Xerces 用作验证模式,则在 oxygenxml 21.0 中对测试 xml 文件的验证会失败。

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

此类特定断言子句是否存在 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 引擎的验证成功。

4

1 回答 1

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(.)) ..."/>
于 2019-03-25T16:29:09.437 回答