2016-10-20 24 views
0

類型MyType的給定的定義應使元件序列(A),(B),(C),(AB)和(AC)。在驗證過程中,我收到了「唯一的粒子屬性違規」錯誤。我該如何解決這個問題?複雜類型定義違反獨特的顆​​粒歸因

<xs:complexType name="MyType"> 
    <xs:choice> 
    <xs:element name="A" type="AType"/> 
    <xs:sequence> 
     <xs:element name="A" type="AType" minOccurs="0"/> 
     <xs:choice> 
     <xs:element name="B" type="BType"/> 
     <xs:element name="C" type="CType"/> 
     </xs:choice> 
    </xs:sequence> 
    </xs:choice> 
</xs:complexType> 

回答

0

一些重構修復了獨特的顆粒歸因錯誤:

<xs:complexType name="MyType"> 
    <xs:choice> 
    <xs:sequence> 
     <xs:element name="A" type="AType"/> 
     <xs:choice minOccurs="0"> 
     <xs:element name="B" type="BType"/> 
     <xs:element name="C" type="CType"/> 
     </xs:choice> 
    </xs:sequence> 
    <xs:element name="B" type="BType"/> 
    <xs:element name="C" type="CType"/> 
    </xs:choice> 
</xs:complexType>