XSD 1.1-发现无效的内容以元素'xs:alternative'开头 [英] XSD 1.1 - Invalid content was found starting with with element '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屋!