On 6/27/2012 3:54 PM, Peter Flynn wrote:
> Officially there is no difference
Correct. If you doubt this, look at the W3C's XML Infoset document (the
official statement of what information an XML document represents),
which has absolutely no way to represent this distinction. Whether
<foo></foo> or <foo/>, the infoset represents it as an element with no
child nodes.
There are stylistic conventions which may cause one or the other to be
preferred by specific applications -- "for interoperability" with SGML
tools being one of those, though realistically there is now enough XML
tooling out there that very few people are still trying to put XML
through SGML tools. But that's strictly style, not substance.
If you want to distinguish empty vs. null, XML lets you do so by adding
an attribute, or a child element, that your application recognizes as
signifying that the content is null. XML Schema suggests an attribute
for that purpose. Adopt it.
--
Joe Kesselman,
http://www.love-song-productions.com...lam/index.html
{} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
/\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."