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>
相关推荐
不太厉害的程序员6 小时前
NC65配置xml找不到Bean
xml·java·后端·eclipse
峥嵘life15 小时前
Android xml的Preference设置visibility=“gone“ 无效分析解决
android·xml
Dxy123931021619 小时前
通过XML方式在Word段落前添加空白段落
xml·python·word
zqmattack20 小时前
XMLDecoder、LDAP 注入与修复
xml
Dkodak2 天前
Could not initialize Logback logging from classpath:logback-spring.xml
xml·spring·logback
peihexian2 天前
临时文件夹大量0字节xml问题排查
xml
悟能不能悟2 天前
Logback-spring.xml 配置屏蔽特定路径的日志
xml·java·spring
zqmattack2 天前
XML 注入与修复
xml
一只小小汤圆2 天前
如何删除导出的xml中的xmlns:xsd=
xml
中国lanwp2 天前
Spring XML 常用命名空间配置
xml·java·spring