2012-07-07 48 views
1

當我想驗證我的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> 

是什麼問題?我怎麼修復它?

+0

請發表您的示例XML – 2012-07-09 06:26:40

+0

驗證我的XSD文件時,這個錯誤引發,沒有任何XML文件 – Pooya 2012-07-09 06:28:46

+1

它的發生是因爲我組標記包含與上述佈局標記衝突的佈局標記,並在從WidgetsGroup中移除佈局標記時解決。 – Pooya 2012-07-09 07:53:47

回答

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

這是如何工作的。 ambigous的「佈局」元素仍然存在? – Midhat 2013-03-11 10:28:05