Subject: Re: When to use text()
From: Graydon <graydon@xxxxxxxxx>
Date: Fri, 21 Mar 2014 13:40:54 -0400
|
On Fri, Mar 21, 2014 at 05:19:32PM +0000, Ihe Onwuka scripsit:
> The quirkiness of the definition derives not from the definition
> itself, because there may well be justification for the existence of a
> node type that encompasses text with embedded comments. Thats OK.
There isn't, though. text nodes have no name and a string and no node
children.
Text nodes are guaranteed leaves, like everything else except for
element nodes and document nodes.
> The quirkiness derives from giving it an innocuous intuit inducing
> moniker like text() that leads the consumer astray.
>
> Let me parallel. If you call a concept Nothing and then occasionally
> allow it to contain Something, RTFTM is not appropriate because the
> fault lies in labelling that concept Nothing.
But it doesn't. The parent element does. The issue is not that there
might be a comment node in the text node, but that there might be a
comment node child of the parent element node that separates the string
contents of the element into two or more text node children.
(In this particular case; whitespace text nodes and comments and
processing instructions can throw a lot more than that off if you
suppose they're never there.)
-- Graydon
|