Dear all,
Thanks a lot for your feedback
Actually, the original reason for this discussion began after HtmlUnit migrated
to use Xalan. HtmlUnit main focus is to simulate browser behavior, it loads
Html into DOM over which Xalan is used.
As you have said, DOM tree is different than XPath from a specification
point-of-view, but still both Internet Explorer and Firefox do not respect
that, as shown in the below example.
Now, I wonder if there is a way to support that (either by overriding some
functions/classes, or by making Xalan have configurable non-standard extension
somehow).
Thanks again for making a power engine,
Yours,
Ahmed Ashour
<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);
var nodes = doc.selectNodes('/root/text()');
for (i = 0; i < nodes.length; i++) {
alert(nodes[i].nodeValue);
}
} else {
var parser=new DOMParser();
var doc=parser.parseFromString(text,'text/xml');
var result = doc.evaluate('/root/text()', doc.documentElement, null,
XPathResult.ANY_TYPE, null);
var thisNode = result.iterateNext();
while (thisNode) {
alert(thisNode.nodeValue);
thisNode = result.iterateNext();
}
}
}
</script></head><body onload='test()'>
</body></html>
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs