XSD 1.1-发现无效的内容以元素'xs:alternative'开头 [英] XSD 1.1 - Invalid content was found starting with with element 'xs:alternative'

查看:304
本文介绍了XSD 1.1-发现无效的内容以元素'xs:alternative'开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In my XSD, I'm trying to use alternative tag. For some reasons, I got this error in my IDE (PHPStorm) :

无效的内容始于元素'xs:alternative'...

Invalid content was starting with with element '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>

我看到了我不应该添加一些内容更多使用1.1 xsd版本的功能,但是我需要支持alternative标签的功能吗?

I saw I should not add something more to use the 1.1 xsd version but do I need something to support alternative tag ?

推荐答案

您的XSD处理器必须支持 XSD 1.1 才能使用xs:alternative( 条件类型分配 ). XSD 1.0 处理器将不允许xs:alternative作为xs:element的子级,并会提供错误消息,例如您收到的错误消息.因此,可以得出结论,您的XSD处理器仅支持 XSD 1.0 .

Your XSD processor must support XSD 1.1 in order to use xs:alternative (Conditional Type Assignment). An XSD 1.0 processor will not allow xs:alternative as a child of xs:element and will provide an error message such as the one you received. Therefore, you can conclude that your XSD processor only supports XSD 1.0.

有关CTA的有效示例,请参见如何使用条件类型分配使类型取决于属性值(但是,当然,这也需要 XSD 1.1 ).

For a working example of CTA, see How to make type depend on attribute value using Conditional Type Assignment (but, of course, this too requires XSD 1.1).

这篇关于XSD 1.1-发现无效的内容以元素'xs:alternative'开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆