加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xsd – XML Schema中mixed =“true”和xs:extension的区别

发布时间:2020-12-16 07:47:23 所属栏目:百科 来源:网络整理
导读:这两者之间的实际差异是什么: xs:element name="A" xs:complexType mixed="true" xs:attribute name="att" type="xs:boolean"/ /xs:complexType/xs:elementxs:element name="B" xs:complexType xs:simpleContent xs:extension base="xs:string" xs:attribut
这两者之间的实际差异是什么:
<xs:element name="A">
 <xs:complexType mixed="true">
  <xs:attribute name="att" type="xs:boolean"/>
 </xs:complexType>
</xs:element>

<xs:element name="B">
 <xs:complexType>
  <xs:simpleContent>
   <xs:extension base="xs:string">
    <xs:attribute name="att" type="xs:boolean"/>
   </xs:extension>
  </xs:simpleContent>
 </xs:complexType>
</xs:element>
两者是不同的.您的第一个示例使用mixed =“true”表示混合内容,即与子元素混合的字符数据.而您的第二个示例将元素内容限制为xs:string类型.两者都表明存在属性.

以你的例子,两者几乎是一样的.但是,如果您不打算使用混合内容,即您不打算添加子元素,则第二个版本会更清晰.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读