XSD 1.1 - 发现以元素“xs:alternative”开头的无效内容

J.B*_*Mai 1 xml xsd xsd-validation phpstorm xsd-1.1

在我的 XSD 中,我尝试使用alternative标签。由于某些原因,我在 IDE (PHPStorm) 中遇到此错误:

无效内容以元素“xs:alternative”开头...

XSD

<xs:complexType name="tableType">
    <xs:sequence>
        <xs:element type="columnType" name="column" maxOccurs="unbounded" minOccurs="0"/>
        <xs:element type="keyType" name="key" maxOccurs="unbounded" minOccurs="0">
            <xs:alternative test="@type='index'" type="keyIndexType"/>
            <xs:alternative test="@type='unique'" type="KeyUniqueType"/>
        </xs:element>
    </xs:sequence>
    <xs:attribute type="xs:string" name="name" use="required"/>
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)

我发现我不应该添加更多东西来使用 1.1 xsd 版本,但是我需要一些东西来支持alternative标签吗?

J.B*_*Mai 5

感谢@kjhughes,我找到了解决方案。我必须从 XSD 1.0 处理器切换到 XSD 1.1 处理器。

在 PHPstorm 中:设置面板 > 语言和框架 > 默认 XML Shemas

在此输入图像描述

注意:“应用”更改后,您必须重新启动 PHPStorm