Xpath evaluate error in android

I am running one application in an Android browser that contains 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 application in Firefox, enter the if statement and everything works fine.

but in the android browser it gives an error ... XPathResult undefined ... this time control comes in the else statement, and even here it shows that selectNodes is undefind and. therefore, the result is zero, whereas in Firefox it provides a list of nodes.

it really needs to be done ... need help ..

thank...

+3
source share
1 answer

Android XPath. Android , XmlDocuments , document.evaluate ( XmlDocuments)

19 , 3.0 XPathEvaluator - Android?

, 3.x , , IceCream .

, , ( ), , XPath 3.0, , , - .

+2

Source: https://habr.com/ru/post/1742221/


All Articles