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

xml – 有什么区别?

发布时间:2020-12-16 08:02:48 所属栏目:百科 来源:网络整理
导读:你知道这些标签在XML / XSD上有什么区别吗? a_element / and a_element xsi:nil="true"/ 例如: SpreadCurve Index3M/Index IndexNumber4587/IndexNumber BusinessArea xsi:nil="true" //SpreadCurveandSpreadCurve Index3M/Index IndexNumber4587/IndexNum
你知道这些标签在XML / XSD上有什么区别吗?
<a_element /> and <a_element xsi:nil="true"/>

例如:

<SpreadCurve>
      <Index>3M</Index>
      <IndexNumber>4587</IndexNumber>
      <BusinessArea xsi:nil="true" />
</SpreadCurve>

and

<SpreadCurve>
      <Index>3M</Index>
      <IndexNumber>4587</IndexNumber>
      <BusinessArea />
</SpreadCurve>

这些相当吗?

如果我有一个XSD元素:

<xsd:element name="BusinessArea" type="xsd:string"/>

这意味着它是默认的xsi:nil =“false”。这意味着它不会接受这个元素的空值。

我的怀疑是,会接受这个吗?

<BusinessArea />

这对XSD是什么意思?

最好的祝福

你得到这个,因为你的XSD BusinessArea应该被定义为nillable =“true”。就像是:
<xsd:element name="BusinessArea" nillable="true">
.....
</xsd:element>

这意味着BusinessArea元素可以具有空值,即空值。

如果XML中的元素不包含任何值,那么它必须具有属性xsi:nil =“true”:

<BusinessArea xsi:nil="true" />

这应该是无效的:

<BusinessArea />

你所展示的两个例子不应该是等同的。

检查出来了解xsi:nil和nillable:

http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_over_st0.html

http://www.w3.org/TR/xmlschema-0/#Nils

(编辑:李大同)

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

    推荐文章
      热点阅读