Nil values

Consider the following XML fragment. The first, middle and last names of a person are given:

<name>
  <first>John</first><middle>W</middle><last>Smith</last>
</name>

Now consider the following similar fragments. In all of these examples, there is no middle name. In the first case, the Middle element is absent. In the second case, it is present but happens to have no content. In the third case, an empty element tag has been used:

<name>
  <first>Peter</first><!-- NO MIDDLE --><last>Jones</last>
</name>

<name>
  <first>Peter</first><middle></middle><last>Jones</last>
</name>

<name>
  <first>Peter</first><middle/><last>Jones</last>
</name>

The XML standard provides no hints as to how to interpret these alternatives. Perhaps the absence of ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.