违反“独特粒子归因”

时间:2012-07-07 05:49:43

标签: validation xsd

当我想验证我的xsd文件时,我收到了此错误

cos-nonambig:“我的xsd文件”:布局和“我的xsd文件”:布局(或来自其替换组的元素)违反“唯一粒子属性”。在针对此模式进行验证期间,将为这两个粒子创建歧义。

并引用我的标签

<xs:complexType name="pageType">
    <xs:choice>
        <xs:element type="main:layoutType" name="layout" minOccurs="0" maxOccurs="1"/>
        <xs:group ref="main:WidgetsGroup" maxOccurs="unbounded" minOccurs="0"/>
    </xs:choice>
    <xs:attribute type="xs:string" name="name"/>

    <xs:attribute type="xs:string" name="layout"/>
    <xs:attribute type="xs:string" name="dataModel"/>
    <xs:attribute type="xs:string" name="domain"/>
</xs:complexType>

有什么问题?我该怎么办呢?

1 个答案:

答案 0 :(得分:2)

我已经通过将WidgetGroup内容插入我的xsd来解决它:

<xs:complexType name="pageType">
    <xs:choice>
        <xs:element type="main:layoutType" name="layout" minOccurs="0" maxOccurs="1"/>
        <xs:sequence>
            <xs:choice maxOccurs="unbounded">
                <xs:element name="spinner" type="main:SpinnerType" minOccurs="0"/>
                <xs:element name="datePicker" type="main:DatePickerType" minOccurs="0"/>
                <xs:element name="button" type="main:ButtonType" minOccurs="0"/>
                <xs:element name="combo" type="main:ComboBoxType" minOccurs="0"/>
                <xs:element name="checkBox" type="main:CheckBoxType" minOccurs="0"/>
                <xs:element name="radioButton" type="main:RadioButtonType" minOccurs="0"/>
                <xs:element name="image" type="main:ImageType" minOccurs="0"/>
                <xs:element name="label" type="main:LabelType" minOccurs="0"/>
                <xs:element name="listBox" type="main:ListBoxType" minOccurs="0"/>
                <xs:element name="textBox" type="main:TextBoxType" minOccurs="0"/>
                <!--<xs:element name="layout" type="main:layoutType" minOccurs="0"/>-->
            </xs:choice>
        </xs:sequence>
    </xs:choice>

    <xs:attribute type="xs:string" name="name"/>

    <xs:attribute type="xs:string" name="layout"/>
    <xs:attribute type="xs:string" name="dataModel"/>
    <xs:attribute type="main:domainType" name="domain"/>
    <xs:attribute type="xs:string" name="title"/>
</xs:complexType>