使用 Okapi 框架验证 xliff 核心样本

Validating xliff core sample with Okapi framework

我正在使用 https://bitbucket.org/okapiframework and using 'core/valid/sample1.xlf' from this https://tools.oasis-open.org/version-control/browse/wsvn/xliff/trunk/xliff-20/test-suite/ 我遇到了错误

net.sf.okapi.lib.xliff2.reader.XLIFFReaderException: Error systemId: file:/tmp/sample1.xlf; lineNumber: 7; columnNumber: 43; cvc-complex-type.3.2.2: Attribute 'gls:ref' is not allowed to appear in element 'gls:glossEntry'

想知道这是示例文件还是框架的问题?

谢谢

在我看来,验证工具存在问题:我使用了 http://okapi-lynx.appspot.com/validation and got the same error. When I removed the offending ref attribute the next error reported was "Error lineNumber: 8; columnNumber: 49; cvc-complex-type.3.2.2: Attribute 'gls:source' is not allowed to appear in element 'gls:term'." According to http://docs.oasis-open.org/xliff/xliff-core/v2.0/os/schemas/modules/glossary.xsd 两个属性都应该有效。

删除 gls 命名空间前缀也会清除错误 - 那里有些可疑。

在属性上使用命名空间前缀与不使用命名空间前缀不同。

<gls:glossEntry ref="#m1">

不等于:

<gls:glossEntry gls:ref="#m1">

XLIFf 2.x 声明使用无前缀表示法(作为所有 XML 格式的绝大多数)。所以第一个例子是有效的,第二个不是。

顺便说一句:example1.xlf 文件中有一个错误:

<gls:translation ref="#m2" source="myTermbase">TAB-TASTE

应该是:

<gls:translation ref="#t=m2" source="myTermbase">TAB-TASTE

由于 m2 标记在目标中,ref 属性必须使用 XLIFF 片段 ID 表示法。