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

表示空XML元素的正确方法是什么?

发布时间:2020-12-16 08:18:14 所属栏目:百科 来源:网络整理
导读:我已经看到空元素表示在几个方面: 元素存在与xsi:nil =“true”: book titleBeowulf/title author xsi:nil="true"/ /book 元素存在,但表示为空元素(我相信是错误的,因为’empty’和null在语义上不同): book titleBeowulf/title author/ /book !-- or:
我已经看到空元素表示在几个方面:

元素存在与xsi:nil =“true”:

<book>
     <title>Beowulf</title>
     <author xsi:nil="true"/>
 </book>

元素存在,但表示为空元素(我相信是错误的,因为’empty’和null在语义上不同):

<book>
     <title>Beowulf</title>
     <author/>
 </book>

 <!-- or: -->
 <book>
     <title>Beowulf</title>
     <author></author>
 </book>

该元素在返回的标记中根本不存在:

<book>
     <title>Beowulf</title>
 </book>

元素具有< null />子元素(从下面的TStamper):

<book>
     <title>Beowulf</title>
     <author><null/></author>
 </book>

有没有正确的,或规范的方式来表示这样一个空值?还有其他方法比上面的例子吗?

上面的例子的XML是设计的,所以不要读得太远。

(编辑:李大同)

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

    推荐文章
      热点阅读