DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4908>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4908

XPath's text() and node() selectors get confused by CDATA sections





------- Additional Comments From [EMAIL PROTECTED]  2001-11-16 10:55 -------
Sorry, I thought I had given an example.

Take the document from my initial message:

  <?xml version="1.0"?>
  <doc>
  This is the first line.
  <element/><![CDATA[A CDATA section.]]>
  This is the last line.
  </doc> 

count(/doc/node()) returns 3
count(/doc/text()) returns 2
/doc/text()[1] returns <LF>This is the first line<LF>

All good so far.

But /doc/text()[2] returns <![CDATA[A CDATA section.]]>
/doc/node[3] also returns this.

That is, text[2] (AKA node[3]) has two problems:

    1. It returns the CDATA bracketing, which should presumably be removed.
    2. It loses the text following the CDATA section, which should also be part
of text[2].

Note that string(/doc) correctly returns:

This is the first line.
A CDATA section.
This is the last line.

Note also that all of this output was produced by the ApplyXPath sample application.

Reply via email to