在XML模式中创建新的complexType

在XML模式中创建新的complexType,xml,xsd,Xml,Xsd,我创建了一个complexType,如下所示: <xsd:complexType name="type1" mixed="true"> <xsd:attribute name="quantité" type="xsd:integer"/> </xsd:complexType> 我想基于上面的类型创建一个类型,以便为属性quantite提供一个默认值 如何才能做到这一点?如果找不到更好的解决方案,可以使用xsd:attribute的默认属性。 <

我创建了一个complexType,如下所示:

<xsd:complexType name="type1" mixed="true">
    <xsd:attribute name="quantité" type="xsd:integer"/>
</xsd:complexType>
我想基于上面的类型创建一个类型,以便为属性quantite提供一个默认值


如何才能做到这一点?

如果找不到更好的解决方案,可以使用xsd:attribute的默认属性。
<xs:complexType name="type2"
                mixed="true">
  <xs:complexContent>
    <xs:restriction base="type1">        
      <xs:attribute name="quantité" 
                    type="xsd:integer"
                    default="1"/>
    </xs:restriction>
  </xs:complexContent>