在javascript中使用xpaths [英] using xpaths in javascript
问题描述
我有一大套XPath用于在网页中选择内容,我希望用户能够在浏览器(包括IE)中使用它们。
I have a large set of XPaths for selecting content in webpages and I want users to be able to use them in the browser (including IE).
你推荐?
尝试用JavaScript解释XPath?
或者可以转换为regex?
What do you recommend?
Try and interpret the XPaths with JavaScript?
Or perhaps convert to regex?
一些现有的JavaScript XPath工作:
http://js-xpath.sourceforge.net/xpath-example.html
http://goog-ajaxslt.sourceforge.net
Some existing JavaScript XPath work:
http://js-xpath.sourceforge.net/xpath-example.html
http://goog-ajaxslt.sourceforge.net
推荐答案
我会寻找一个XSLT javascript库。由于大多数现代浏览器都具有内置的XSLT支持,而XSLT包括对XPath的支持,因此可以使用该引擎为XPath选择器提供电源。
I would look for an XSLT javascript library. Since most modern browsers have built-in XSLT support, and XSLT includes support for XPath, it is possible to use that engine to power your XPath selectors.
ve已成功使用Sarissa和Glyphix jQuery.xslTransform库:
Personally, I've used Sarissa and the Glyphix jQuery.xslTransform libraries successfully:
- http://jquery.glyphix.com/
- http://dev.abiss.gr/sarissa/
这看起来很有趣:
- http://johannburkard.de/software/xsltjs/
这篇关于在javascript中使用xpaths的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!