【发布时间】:2017-02-24 18:05:04
【问题描述】:
我有一个<choice>,我需要从它的当前元素中提取它自己的类型(以便其他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 和type2s 放在标签MyTypeInClass 中,这是我不想要的。有什么想法吗?
【问题讨论】:
标签: xml xsd xsd-validation xml-validation