XML Schema中的simpleContent 元素

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>
相关推荐
写代码的【黑咖啡】10 小时前
Python中的lxml:高效XML处理库
xml·开发语言·python
spencer_tseng2 天前
org.xml.sax.SAXParseException: cvc-complex-type.3.2.2 sql-query result-type
xml
派大鑫wink2 天前
【Day48】MyBatis 注解开发:替代 XML 映射文件
xml·java·mybatis
sunnyday04263 天前
Spring Boot 日志配置详解:log4j2.xml 的完整配置指南
xml·spring boot·log4j
熊出没3 天前
关于MyBatis Mapper 接口与 XML 映射机制的分析
xml·microsoft·mybatis
她说..4 天前
FIND_IN_SET()方法
xml·java·spring boot
北辰当尹4 天前
xml基础
android·xml
qqqahhh7 天前
xml文件的动态化配置,导入
xml·spring·springboot
吴声子夜歌8 天前
Maven——pom.xml详解
xml·java·maven
iSee8578 天前
struts2 XML外部实体注入漏洞复现(CVE-2025-68493)
xml·安全·struts2