Empty-Element Tags
Developers trained in database theory often latch onto the empty-element tag (e.g., <para/>) as a way to indicate a null value, which they rightly consider to be distinct from 0 or the empty string. From their perspective this makes sense. <para>AA</para> is a para element whose value is the string “AA”. <para>A</para> is a para element whose value is the string “A”. <para></para> is a para element whose value is the empty string. Finally, <para/> is a para element whose value is null.
This is all perfectly sensible, but it does not reflect the way XML parsers actually behave. An XML parser will produce exactly the same data from <para></para> as from <para/>. There is no detectable difference between the two. They both have ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access