Re: [xml-dev] Beware of XPath expressions that produce false positives
From: John Cowan <johnwcowan@gmail.com>
To: "Costello, Roger L." <costello@mitre.org>
Date: Sat, 24 Sep 2016 14:38:10 -0400
On Sat, Sep 24, 2016 at 2:33 PM, Costello, Roger L. <costello@mitre.org> wrote:
[Definition] An element is empty if and only if the element consists of a text node containing a string of length zero and nothing else (no attribute, comment, processing instruction, child element,
or non-string value).
In general, there are no text nodes of length zero. <B/> and its equivalent <B></B> contain only an element node. Furthermore, parsers may discard comments, so you can't be sure whether <B><!--foo--></B> will be treated the same as <B/> or not.