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>
相关推荐
摇滚侠4 小时前
Spring 零基础入门到进阶 基于 XML 管理 Bean 14-28
xml·数据库·spring
摇滚侠10 小时前
Spring 零基础入门到进阶 基于 XML 管理 Bean 29-37
xml·java·数据库·后端·spring·intellij-idea
hashiqimiya1 天前
每日android布局xml文件
android·xml·gitee
2601_961194021 天前
27考研资料|百度网盘|夸克网盘
android·xml·考研·ios·iphone·xcode·webview
许彰午4 天前
在PowerBuilder里手写XML序列化——没有现成库的年代怎么拼报文
xml·linux·服务器
坚果的博客5 天前
鸿蒙PC三方库适配OAT.xml 与 SHA512SUM 解读:开源合规与源码校验
xml·开源·harmonyos
奇树谦5 天前
YAML、XML、JSON、TOML、INI、CSV 全面对比:配置文件和数据交换到底该怎么选?
xml·json
南山丶无梅落6 天前
XXE漏洞
xml·漏洞·xxe·网安
小书房6 天前
Android UI为什么由XML转向Compose
xml·ui·compose·声明式ui
学编程的小程6 天前
配置范式演进:XML、JavaConfig 与 Spring Boot
xml·spring boot·后端