I have seen null
elements represented in several ways:
The element is present with xsi:nil="true"
:
<book> <title>Beowulf</title> <author xsi:nil="true"/> </book>
The element is present, but represented as an empty element (which I believe is wrong since 'empty' and null
are semantically different):
<book> <title>Beowulf</title> <author/> </book> <!-- or: --> <book> <title>Beowulf</title> <author></author> </book>
The element is not present at all in the returned markup:
<book> <title>Beowulf</title> </book>
The element has a <null/>
child element (from TStamper below):
<book> <title>Beowulf</title> <author><null/></author> </book>
Is there a correct, or canonical way to represent such a null
value? Are there additional ways than the above examples?
The XML for the examples above is contrived, so don't read too far into it. :)