Dear all,
 
When using XPath 'text()' on CData, Xalan ignores it and the following text 
node.
 
Here is the test case:


1- foo.xml:
 
<root>a<![CDATA[ CDATA ]]>b</root>
 
2- java:
       javax.xml.xpath.XPathFactory factory =  
javax.xml.xpath.XPathFactory.newInstance();
       javax.xml.xpath.XPath xpath = factory.newXPath();
       javax.xml.xpath.XPathExpression expression = 
xpath.compile("count(/root/text())");
        
       Object result = expression.evaluate(new 
org.xml.sax.InputSource("foo.xml"), XPathConstants.NUMBER);
       System.out.println(((Double) result).doubleValue());//prints 1, should 
be 3 instead

Any idea?
 
Many thanks,
Ahmed Ashour


      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

Reply via email to