Xml XSD-可以更改扩展类型中的属性类型

Xml XSD-可以更改扩展类型中的属性类型,xml,xsd,xsd-validation,Xml,Xsd,Xsd Validation,我想将Name属性的类型从xs:string更改为xs:int,就像下面的XSD一样 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.my.own/2013/XMLSchema"> <xs:complexType name="AType"> <xs:attribute name="Name" type="xs:string" u

我想将
Name
属性的类型从
xs:string
更改为
xs:int
,就像下面的XSD一样

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns="http://www.my.own/2013/XMLSchema">

    <xs:complexType name="AType">
        <xs:attribute name="Name" type="xs:string" use="required" />
    </xs:complexType>

    <xs:complexType name="BType">
        <xs:complexContent>
            <xs:extension base="AType">
                <xs:sequence>
                    <xs:choice>
                        <xs:element name="Content" type="xs:string"/>
                    </xs:choice>
                </xs:sequence>
                <xs:attribute name="Name" type="xs:int" use="required"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
</xs:schema>


这个XSD有效吗?如果没有,是否存在其他解决方案来更改属性的类型?

否,类型派生的原则是,如果从基类型派生新类型,则派生类型的实例必须仍然是基类型的有效实例。因此,您不能将属性从字符串更改为int。

这是base
AType
typo中的
Nane
吗?您的问题是,可以更改还是有效?1。打字错误修正。2.事实上,我对这两个问题的答案都感兴趣。我认为使用
元素是可能的,显然您不能覆盖元素声明。让我们拭目以待,看看别人会怎么说。