//text() does not work for CData sections
-----------------------------------------

                 Key: XALANJ-2452
                 URL: https://issues.apache.org/jira/browse/XALANJ-2452
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in 
Xalan projects.  Anybody can view the issue.)
          Components: XPath
    Affects Versions: 2.7.1
         Environment: Win xp
            Reporter: Michele Vivoda


Given the document 

<root><![CDATA[a]]></root>

I found out that //text() returns an empty string.

Since when the document is <root>a</root> the same xpath returns correctly "a", 
it should be a problem somehow related to CData.

The problem appears also if the cdata is more nested

The problem does not appear when there is at least one parent specified in the 
xpath for/before text() so like in:

/*/text()
//*/text()
/*//text()


Also these other xpaths work as expected 

//self::text()
ancestor-or-self::text()
descendant-or-self::node()/self::text()

if I am right in thinking that these last expression are equivalent to //text() 
maybe it could be a problem of the xpath expression parser ? just trying..

The quick fix is to use a dom document obtained from a DocumentBuilderFactory 
configured with coalescing = true.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to