我已经看到空元素表示在几个方面:
元素存在与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是设计的,所以不要读得太远。