Is there any shorter expression to get DOM nods via XPath, more concise from following command that need a lot of variables.
doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As far as I know Firefox only supports the DOM Level 3 XPath API, part of which the
evaluatefunction is. If you want something shorter then you need to roll your own (or find a library which does it for you) or you need to use a different browser, for instance with Opera you can do e.g.node.selectSingleNode(path [,nsResolver])to select a single node, withnode.selectNodes(path [, nsResolver])you can select a DOM NodeList of nodes. Within MSXML’s XML DOM implementation you use with IE you also haveselectSingleNodeandselectNodesfunction although namespace handing there is different from the Opera implementation as with MSXML you need to usedocument.setProperty('SelectionNamespaces', 'xmlns:pf1="http://example.com/ns1" xmlns:pf2="http://example.com/ns2"').