Dear all,

First, thanks for your quick response.

However:

1- Xalan doesn't concatenate the text into one, but returns the text before 
CDATA only.

       javax.xml.xpath.XPathExpression expression = 
xpath.compile("/root/text()");
        
       org.w3c.dom.NodeList result = (NodeList) expression.evaluate(new 
org.xml.sax.InputSource("foo.xml"), XPathConstants.NODESET);
       for( int i=0; i < result.getLength(); i++ ) {
           System.out.println(((Text) 
result.item(i)).getTextContent());//prints 'a' only, without CDATA or 'b'
       }


2- I see the point raised in secion 5.7 of Xpath 1.0, but wonder why both 
Internet Explorer and Firefox do not behave accordingly, please find below:

<html><head><title>foo</title><script>
  function test() {
    var text='<root>a<![CDATA[ CDATA ]]>b</root>';
    if (window.ActiveXObject) {
      var doc=new ActiveXObject('Microsoft.XMLDOM');
      doc.async=false;
      doc.loadXML(text);
    } else {
      var parser=new DOMParser();
      var doc=parser.parseFromString(text,'text/xml');
    }
 alert(doc.documentElement.childNodes.length);
  }
</script></head><body onload='test()'>
</body></html>

Many thanks,
Ahmed


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

Reply via email to