简体   繁体   English

在XML模式中创建一个新的complexType

[英]Create a new complexType in XML schema

I created a complexType as following : 我创建了一个complexType ,如下所示:

<xsd:complexType name="type1" mixed="true">
    <xsd:attribute name="quantité" type="xsd:integer"/>
</xsd:complexType>

and I want to create a type based on the type above, in order to give a default value to the attribute quantite. 并且我想基于上面的类型创建一个类型,以便为属性Quantite提供默认值。

How can I do that? 我怎样才能做到这一点?

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM