2010-04-11 32 views
1

在下面的模式,我試圖讓擴展simpleConfigurationObject無序XML無序的XML架構:我怎麼能寫能產生與​​擴展

<xs:complexType name="forTestingConfigurationObjectCreator"> 
    <xs:complexContent> 
    <xs:extension base="simpleConfigurationObject"> 
     <xs:all> 
     <xs:element name="a" type="xs:string"/> 
     <xs:element name="b" type="xs:string" minOccurs="0"/> 
     </xs:all> 
    </xs:extension> 
    </xs:complexContent> 
</xs:complexType> 

<xs:complexType name="simpleConfigurationObject"> 
    <xs:all> 
    <xs:element name="base" type="xs:string" minOccurs="0"/> 
    </xs:all> 
</xs:complexType> 

,但我得到的XS以下錯誤:所有 「所有不在組中唯一的顆粒,或正被用作一個擴展」如果把基座元件的XS內部(這是正確的)

場外:所有與不使用XS :擴展在所有我會得到一個無序的架構重新磁致伸縮。 (但那不是我想要的)

現在的問題是:如何生成帶擴展名的無序模式?

謝謝

回答

1

您不能,這是模式規範禁止的。請參閱亨利湯普森的this post(規範的作者)的解釋。

簡而言之:基本類型的內容模型必須在解析器到達派生類型的時候完全解析;這是不可能的,你試圖達到的目標。