0
点赞
收藏
分享

微信扫一扫

XML Schema中的simpleContent 元素

树下的老石头 2023-11-30 阅读 42
xml

XML Schema中的simpleContent 元素出现在complexType 内部,是对complexType 的一种扩展、或者限制。
simpleContent 元素在complexType元素内部最多只能出现1次。
simpleContent元素下面必须包含1个restriction或者extension元素。

例如,下面的Schema片段,定义了一个复杂类型condition,它的值是字符串类型,包含了name和type两个可选属性:

<xs:element name="condition" maxOccurs="unbounded" minOccurs="0">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute type="xs:string" name="name" use="optional"/>
        <xs:attribute type="xs:string" name="type" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>

符合上面Schema的一段xml数据:

<condition name='lD" type="eq">26</condition>
<condition name='DATE" type="lt">20231120</condition>
举报

相关推荐

0 条评论