【发布时间】:2015-01-27 18:58:01
【问题描述】:
我有复杂类型History,它应该扩展我的复杂类型Section,同时禁止一个继承属性(Title)。我怎样才能做到这一点?
示例
<xs:complexType name="Section">
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<!-- ... -->
</xs:choice>
<xs:element name="Section" type="Section" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="Key" type="xs:string"/>
<xs:attribute name="Title" type="xs:string"/>
</xs:complexType>
<xs:complexType name="History">
<xs:complexContent>
<xs:extension base="Section">
<!-- Prohibit/remove "Title" attribute from parent. -->
<xs:attribute name="Title" use="prohibited"/>
<!-- Add more attributes. -->
<xs:attribute name="StartDate" type="xs:date" use="required"/>
<xs:attribute name="EndDate" type="xs:date"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
这样做的正确方法是什么?
【问题讨论】: