xml 是否有 xPath 选择器的在线测试器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/688323/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 12:25:23  来源:igfitidea点击:

Is there an online tester for xPath selectors?

xmlxsltxpath

提问by alex

I know there are some online regex evaluators.. very useful, matching in real time. They are like web applications of RegexBuddy.

我知道有一些在线正则表达式评估器......非常有用,实时匹配。它们就像 RegexBuddy 的 Web 应用程序。

I was wondering if there is a similar thing for xPath selectors? I am just learning them and it would be valuable to me.

我想知道 xPath 选择器是否有类似的东西?我只是在学习它们,这对我很有价值。

Is there an online tester that allows you to input XML and then an xPath selector and match (live would be better, but I doubt someone has written a JavaScript interpreter?) them?

是否有在线测试器允许您输入 XML,然后输入 xPath 选择器并匹配(现场会更好,但我怀疑有人编写了 JavaScript 解释器?)他们?

Thanks

谢谢

回答by Chris Nielsen

I notice that the only "online" checker in the answers seems a bit clunky. It requires submission to a server, and it doesn't handle namespaces properly.

我注意到答案中唯一的“在线”检查器似乎有点笨拙。它需要提交到服务器,并且不能正确处理命名空间。

I thought I could do better, and that such a tool would be quite useful, so I made one. I realize it is slightly self-promoting to mention it here, but it does specifically answer the question, I think!

我想我可以做得更好,而且这样的工具会很有用,所以我做了一个。我意识到在这里提到它有点自我推销,但我认为它确实回答了这个问题!

http://chris.photobooks.com/xml/default.htm

http://chris.photobooks.com/xml/default.htm

Mine can apply an xpath expression to an arbitrary XML document and display the results. It can also beautify, or pretty-print an XML document, and apply an XSLT transformation to it. All processing is done by the browser, and it should work in IE6+, Firefox, Opera, Chrome, and Safari.

我的可以将 xpath 表达式应用于任意 XML 文档并显示结果。它还可以美化或漂亮地打印 XML 文档,并对其应用 XSLT 转换。所有处理都由浏览器完成,它应该可以在 IE6+、Firefox、Opera、Chrome 和 Safari 中工作。

Please let me know if you encounter any issues with it!

如果您遇到任何问题,请告诉我!

回答by Cheeso

This is not an online tool; instead it's a Windows app, more along the lines of RegexBuddy, but for XPath.

这不是一个在线工具;相反,它是一个 Windows 应用程序,更接近于 RegexBuddy,但用于 XPath。

XPathVisualizer.

XPathVisualizer

screen shot http://i29.tinypic.com/1zwp5ix.jpg

屏幕截图 http://i29.tinypic.com/1zwp5ix.jpg

回答by Dimitre Novatchev

Edit: The XPath Visualizer for IE now has a new, safer home, thanks to the kindness of Lars Huttar. Also thereis the XPath Visualizer for FF.

编辑:由于 Lars Huttar 的好意,IE 的 XPath Visualizer 现在有了一个新的、更安全的家。也是XPath可视化的FF。

The XPath Visualizer has been available for more than 10 years and has helped thousands of people learn XPath the fun way. Available for IEand for FireFox.

XPath Visualizer 已面世 10 多年,已帮助成千上万的人以有趣的方式学习 XPath。可用的IE用于Firefox

The XPath Visualizer is a popular tool for learning XPath by playing with XPath expressions. Free and open source.

XPath Visualizer 是一种流行的工具,用于通过使用 XPath 表达式来学习 XPath。免费和开源。

Allows any XPath expression to be evaluatedagainst a given XML document and displays the results hi-lighted in the xml document (if they are node(s)) or in a separate box (if the results are atomic values).

允许针对给定的 XML 文档评估任何 XPath 表达式,并在 xml 文档(如果它们是节点)或单独的框中(如果结果是原子值)中突出显示结果。

Allows xsl:variable-s to be defined and then usedin XPath expressions.

允许定义 xsl:variable-s,然后在 XPath 表达式中使用。

Allows xsl:key-s to be defined and then referenced by key() functionswithin XPath expressions.

允许定义 xsl:key-s,然后由XPath 表达式中的key() 函数引用

回答by John Feminella

Yep! Try the XPath Checkerextension for Firefox. It's a handy tool.

是的!试试Firefox的XPath Checker扩展。这是一个方便的工具。

回答by user431529

Here is a nice one: http://www.xpathtester.com/

这是一个不错的:http: //www.xpathtester.com/

回答by Dror

You can also use Notepad++ with it's XMLTools plugin - it has xPath evaluator

你也可以使用 Notepad++ 和它的 XMLTools 插件——它有 xPath 评估器

回答by alex

回答by alex

I found the following tool the most helpful.

我发现以下工具最有帮助。

Allans Online XPath Tester

Allans 在线 XPath 测试器

The other tools mentioned below either required a particular browser or had some issue with loading xml or using some of the more obscure XPath expressions I was using. This tool did not.

下面提到的其他工具要么需要特定的浏览器,要么在加载 xml 或使用我正在使用的一些更晦涩的 XPath 表达式时遇到一些问题。这个工具没有。

回答by normal user

Remove It Permanently, a firefox extension available on AMO, has such visualization functions. It would be nice if it had firebug type power for the slightly advanced adblocker.

Remove It Permanently是 AMO 上可用的 Firefox 扩展,具有这样的可视化功能。如果它具有用于稍微先进的广告拦截器的萤火虫类型的功能,那就太好了。

screenshot http://i49.tinypic.com/n65a3d.jpg

截图 http://i49.tinypic.com/n65a3d.jpg