【发布时间】:2014-02-27 19:55:12
【问题描述】:
<xs:complexType name="country">
...
<xs:attribute name="zipcode" type="xs:string"/>
...
</xs:complexType>
<xs:complexType name="city">
<xs:complexContent>
<xs:extension base="country">
<xs:attributeRename from="zipcode" to="areaCode"/><!-- How to rename? -->
</xs:extension>
</xs:complexContent>
</xs:complexType>
我的“城市”类型源自“国家”。我希望在派生后重命名属性。所以我的 2 个 XML 对象都是有效的。当然,我知道我不能使用继承。但是它们还有 10 多个其他属性,我不希望有任何重复。
<country areacode="123"></country>
<city zipcode="456"></city>
【问题讨论】:
标签: xsd xsd-validation