1

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

cos-nonambig: "my xsd file":layout 和 "my xsd file":layout (或它们替换组中的元素)违反了“唯一粒子属性”。在针对此模式进行验证期间,将为这两个粒子创建歧义。

并让我参考这个标签

<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>

问题是什么?我该如何解决?

4

1 回答 1

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>
于 2012-07-09T07:57:32.277 回答