![](/img/trans.png)
[英]XSD Schema Error : the content model of complex type definition ' anonymous ' is ambiguous while multipal choice
[英]How to correct: The content model of a complex type must consist of 'annotation' in XSD
我正在使用第三方xml,並且試圖從中生成一個類。 但是我看到警告:
The content model of a complex type must consist of 'annotation' (if present); followed by zero or one of the following: 'simpleContent', 'complexContent', 'group', 'choice', 'sequence', or 'all'; followed by zero or more 'attribute' or 'attributeGroup'; followed by zero or one 'anyAttribute'.
這是有問題的模式部分的片段。
<xs:element name="import">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="action" type="actionEnum" use="optional"/>
</xs:extension>
<xs:choice maxOccurs="unbounded">
<xs:element ref="Field1" minOccurs="0"/>
<xs:element ref="Field2" minOccurs="0"/>
<xs:element ref="Field3" minOccurs="0"/>
<xs:element ref="Field4" minOccurs="0"/>
<xs:element ref="Field5" minOccurs="0"/>
<xs:element ref="Field6" minOccurs="0"/>
</xs:choice>
</xs:complexType>
</xs:element>
我對編寫xml模式並不真正熟悉。 我嘗試研究此錯誤,但結果是空的。 我不確定該如何解決。 有什么建議嗎?
您向我們展示的內容是胡說八道:如果元素具有簡單的內容,那么它就沒有子元素,因此在xs:simpleContent內指定帶有xs:element子元素的xs:choice根本沒有任何意義。 但是,如果不知道您實際要達到的目標,就無法糾正它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.