XSD扩展限制类型

时间:2013-06-14 10:50:32

标签: xsd

你是否有一个已经受限制的类型,然后通过扩展从这个类型派生并添加不适合基类型的元素?

<xsd:complexType name="absHcontainerType">
    <xsd:complexContent>
        <xsd:restriction base="e:urContentType">
            <xsd:sequence>
                <xsd:element ref="e:absMcontainer" minOccurs="0"
                    maxOccurs="1" />
                <xsd:element ref="e:absHtitle" minOccurs="1" maxOccurs="unbounded" />
                <xsd:choice minOccurs="1" maxOccurs="unbounded">
                    <xsd:element ref="e:absMcontainer" />
                    <xsd:element ref="e:absHcontainer" />
                    <xsd:element ref="e:absContainer" />
                </xsd:choice>
            </xsd:sequence>
            <xsd:attributeGroup ref="e:typehcontainer" />
            <xsd:attributeGroup ref="e:anyattr" />
        </xsd:restriction>
    </xsd:complexContent>
</xsd:complexType>

然后像这样推导出来:

<xsd:complexType name="absHcontainerType2">
  <xsd:complexContent>
        <xsd:extension base="absHcontainerType">
            <xs:sequence> 
               <xs:element name="xy" type="xs:string"/> 
               <xs:element name="xyz" type="xs:string"/> 
             </xs:sequence>
        </xs:extension>  
  </xsd:complexContent>
</xsd:complexType>

1 个答案:

答案 0 :(得分:0)

只要你不放回被限制的东西,我就不会发现问题。你在尝试时遇到错误吗?