0

我想知道定义为 XSD simpleType 和以下模式的 XSD 属性的类型是什么,因此验证失败。请看一看,模式验证器工具在“*”分界区域抛出错误,说基本属性类型没有正确派生..不确定这是否是要定义的正确结构...我周围没有业务模型这个,我只是想在这里玩不同的限制和扩展选项..

    <xsd:complexType name="comptype_simplecontent">
      <xsd:simpleContent>
        <xsd:restriction base="AAA">
            <xsd:attribute name="aaa_attr" *type="xsd:anySimpleType"*></xsd:attribute>
        </xsd:restriction>
      </xsd:simpleContent>
   </xsd:complexType>

   <xsd:complexType name="AAA" block="extension"> 
    <xsd:simpleContent> 
        <xsd:extension base="xsd:integer">
            <xsd:attribute name="aaa_attr">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:decimal">
                        <xsd:minExclusive value="90"></xsd:minExclusive>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
        </xsd:extension>
    </xsd:simpleContent> 
</xsd:complexType> 
4

1 回答 1

1

AAA定义了一个具有整数内容和一个小数属性的复杂类型;一个例子可能是

<X aaa_attr="93.7">5</X>

您将 comptype_simplecontent 定义为对此的限制,这意味着它允许的元素必须是 AAA 允许的元素的子集。但是在您的限制中,您没有缩小属性中允许的值的范围,而是说它可以采用任何值(anySimpleType)。这是不允许的;受限类型不允许其基本类型不允许的事情。

于 2013-08-08T11:28:26.250 回答