1
我有一个<choice>
,我需要将它的当前元素拖放到它自己的类型中(这样它可以被其他complexTypes
引用)。有没有办法做到这一点,而不需要包装标签?有没有一种方法来嵌套complexTypes没有包装标签?
这是我到目前为止有:
复杂类型:
<xs:complexType name="MyType">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="type1"/>
<xs:element ref="type2"/>
</xs:choice>
</xs:complexType>
和引用它
<xs:complexType name="AdaptabilitySettingMetadataBase" abstract="true">
<xs:sequence>
<!-- other elements -->
<xs:element name="MyTypeInClass" type="MyType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
这工作,但只允许我把type1
和type2
在标签MyTypeInClass
内,我不想要。有任何想法吗?
谢谢!这正是我需要的 – chama