我有以下问题:
我有两个 complexTypes,foo
并且bar
有两个成员foobar
:
<xs:complexType name="foo">
<xs:sequence>
<xs:element name="foobar" type="xs:string" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="bar">
<xs:sequence>
<xs:element name="foobar" type="xs:string" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
为了减少冗余,我想将 foobar 声明为 complexType,它在foo
and中都被引用bar
,如下所示:
<xs:complexType name="foobar">
<xs:sequence>
<xs:element type="xs:string />
</xs:sequence>
</xs:complexType>
但这似乎不是正确的方法。这在 XML Schema 中真的可能吗?