Evaluating an XPath expression in XML

firefox-addon, firefox-addon-sdk, javascript, xml

Solution

Yes, a lot of global classes available in the window context aren't there in SDK modules which are sandboxes. You can access this constant via `nsIDOMXPathResult` interface:

var {Ci} = require("chrome");
var iterator = xmlDoc.evaluate('//stream', xmlDoc, null,
    Ci.nsIDOMXPathResult.ORDERED_NODE_ITERATOR_TYPE, null);

Problem

When using the Add-on SDK to create a Firefox add-on, how do you process an XML file? Evaluate with XPath throws an error: XPathResult is not defined I am trying to process this XML data with this code: ``` var iterator = xmlDoc.evaluate('//stream', xmlDoc, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); ```

Original source