s4s-elt-invalid-content:元素'attributeGroup'无效

时间:2018-02-17 18:02:39

标签: xml eclipse xsd xsd-validation xerces

我即将分叉现有的XSD,但在触摸它之前,我想要一个有效的工具链。进入Eclipse。

有问题的XSD是: http://aixm.aero/schema/4.5/index.html

架构“AIXM-Features.xsd”根据this online tool以及xmllint架构有效:

$ xmllint --schema XMLSchema.xsd AIXM-Features.xsd --noout
AIXM-Features.xsd validates

但是,当我使用Eclipse验证它时,在其34次出现的每一次中都出现以下行错误:

<xsd:attributeGroup ref="Changes"/>

这是第一个验证错误:

Description Resource Path Location Type s4s-elt-invalid-content.1:
The content of 'AircraftClassType' is invalid.
> Element 'attributeGroup' is invalid, misplaced, or occurs too often.
AIXM-Features.xsd /afmx line 919 XML Schema Problem

知道这里发生了什么吗?

BTW:Eclipse使用基于Xerces的模式验证器。

1 个答案:

答案 0 :(得分:0)

显然,AIXM-Features.xsd不会直接单独使用。如您所见,它引用Changes属性组而不定义它或包含它的任何定义。

请注意,AIXM-Snapshot.xsd将其定义为没有属性

<xsd:attributeGroup name="Changes"/>

和AIXM-Update.xsd以不同的方式定义它,

<xsd:attributeGroup name="Changes">
    <xsd:attribute name="chg" type="xsd:boolean" use="optional"/>
</xsd:attributeGroup>

如果您要添加

<xsd:include schemaLocation="AIXM-Update.xsd"/>

到AIXM-Features.xsd,错误就会消失。或者,您可以定义包含AIXM-Features.xsd和AIXM-Update.xsd的包装器XSD。

最后说明:您引用的错误消息过于宽泛。是的,“无效”可以说是适用的,但实际上更好的诊断会指定引用的Changes无法解析为属性组。

相关问题