从一个类似的问题中,我发现了XPath,它看起来非常快,但我不能将它与 Node.js 一起使用:
> var xp = new XPathEvaluator();
ReferenceError: XPathEvaluator is not defined
at repl:1:14
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface.<anonymous> (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
我可以以某种方式将其安装为模块吗?还是有替代方案?问题是我正在下载几个 RSS 提要,总共大约 900 个条目。我下载它们的时间不到一秒钟,但使用 jQuery 遍历每个元素
$(xml).find('entry').each(function() { });
... 需要 10-15 秒,这对于 Web 服务是不可接受的。有什么建议么?