W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2001

DOM Level 3 XPath Specification text node questions

From: Chris Mennie <cam@decisionsoft.com>
Date: Thu, 20 Sep 2001 10:54:59 +0100 (BST)
To: www-dom@w3.org
Message-ID: <Pine.LNX.4.21.0109201053460.3159-100000@thames.dsl.local>
        I'm a little unclear about section 1.2.1 of the DOM Level 3 XPath
spec. The line "Instead of returning multiple nodes where XPath sees a
single logical text node, only the first non-empty DOM Text node of any
logical XPath text will be returned in the node set" seems to indicate
that the first DOM Text node (as opposed to DOM CDATA or DOM Entity
Reference nodes) is returned. Starting from this Text node, it's up to the
application to then determine what the entire set of nodes corresponding
to that string actually is. For example, say we have:

  <![CDATA[ one ]]>
  <![CDATA[ three ]]>



        Then would the expression "/first/text()[1]" return the Text node
containing "two"? This means that if I wanted to get the string "one two
three four" I'd have to look at both previous and subsequent sibling nodes
to determine the node set I wanted. It'd make more sense for the cdata
node containing "one" to be returned.
Received on Thursday, 20 September 2001 05:54:51 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:09 UTC