2 * (C) Copyright 2009-2010,2012 John J. Foerch
4 * Use, modification, and distribution are subject to the terms specified in the
9 * xpath_lookup_namespace is a namespace resolver that may be passed to
12 function xpath_lookup_namespace (prefix) {
22 * xpath_find_node takes a document and a string xpath expression,
23 * performs a FIRST_ORDERED_NODE_TYPE lookup with the expression, and
24 * returns the single node in the result set, if any.
26 function xpath_find_node (doc, xpath) {
27 var r = doc.evaluate(xpath, doc, xpath_lookup_namespace,
28 Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE,
30 return r.singleNodeValue;
34 * xpath_find_any takes a document and a string xpath expression, performs
35 * an ANY_TYPE lookup with the expression, and returns an XPathResult
36 * object that gives the result set.
38 function xpath_find_any (doc, xpath) {
39 return doc.evaluate(xpath, doc, xpath_lookup_namespace,
40 Ci.nsIDOMXPathResult.ANY_TYPE, null);