xpath evaluating error in android
I'm running one application in android browser which contain the following code..
if (typeof XPathResult != "undefined") {
//use build in xpath support for Safari 3.0
var xmlDocument = doc;
if (doc.nodeType != 9) {
xmlDocument = doc.ownerDocument;
}
results = xmlDocument.evaluate( xpathExpr,
doc,
function(prefix) {
return namespaces[prefix] || null;
开发者_运维知识库 },
XPathResult.ANY_TYPE,
null );
var thisResult;
result = [];
var len = 0;
do {
thisResult = results.iterateNext();
if (thisResult) {
result[len] = thisResult;
len++;
}
} while ( thisResult );
}
else {
try {
if (doc.selectNodes) {
result = doc.selectNodes(xpathExpr);
}
} catch (ex) {}
}
return result;
but when i run this app in Firefox control come in if statement and everything works fine..
but in android browser it's giving error ... XPathResult undefined... this time control come to else statement and even here it's showing that selectNodes is undefind and. so the result come as null whereas in Firefox it's giving list of nodes..
realy need it to be done ... help needed..
thanks...
The Android browser doesn't support XPath. This Android issue states that it's lacking for XmlDocuments although document.evaluate also fails for me (just for testing, I'm interested in XmlDocuments)
But the comment from Dan on July 19th states that it's working on 3.0 Where is XPathEvaluator in android web browser?
Unfortunately 3.x is only for tablets, so we'll have to wait a long time until IceCream is released and available for the phones.
And this is another situation where the browser lies, as stated in this message (without replies) the browser claims to implement XPath 3.0 but the fact is that it's not usable, so returning true is a lie.
精彩评论