W3C home > Mailing lists > Public > www-xpath-comments@w3.org > July to September 1999

Re: Text(): Unifying DOM/Infoset/XPath/XSL

From: Perry A. Caro <caro@Adobe.COM>
Date: Fri, 13 Aug 1999 13:29:45 -0700
Message-ID: <37B48039.1BE6CC93@corp.adobe.com>
To: www-xpath-comments@w3.org
CC: caro@Adobe.COM
References:
<http://lists.w3.org/Archives/Public/www-xpath-comments/1999JulSep/0028.html>

Since the XML Infoset recognizes that distinguishing CDATA sections in the
midst of text is useful, I'd like the XPath spec to do the same.

In the context of CDATA sections, I concur with Paul Prescod's concerns,
though I disagree with the details of his proposed model.

It concerns me that the following three XML fragments are considered
equivalent to XPath:

<code>if (<![CDATA[a < b && b < c]]>) run();</code>

<code>if (a <![CDATA[<]]> b <![CDATA[&&]]> b <![CDATA[<]]> c) run();</code>

<code>if (a &lt; b &amp;&amp; b &lt; c) run();</code>

In all cases, the path "code/text()[1]" yields "if (a < b && b < c) run();". 

Fortunately for me, the DOM models each of these three cases differently,
allowing me to distinguisch CDATA sections.  It's unfortunate that I have to
normalize-out this distinction when implementing XPath, not to mention
denying my API clients the capability of addressing CDATA sections with an
XPath.

I don't think we need to descend all the way to a least common denominator
character span model, though.  Some amount of normalization should be
required by XPath in order to guarantee that paths are unambiguous. 
Unfortuately, I think the current normalization of CDATA sections is too
much of a good thing.

Perry
Received on Friday, 13 August 1999 16:30:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:05:53 GMT