tags:

views:

5985

answers:

11

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

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

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?

Thanks

+8  A: 

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

John Feminella
This looks really cool!
alex
XPath Visualizer didn't work for me in Firefox 3.5 on Ubuntu
jabley
+1  A: 

Here is one...

XPath Query Expression Tool

alex
+9  A: 

The XPath Visualizer has been available for almost 9 years and has helped thousands of people learn XPath the fun way. Available for IE and for FireFox.

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

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

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

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

Dimitre Novatchev
Peter Recore
I will be considering moving the download to a safe site. Any suggestions?
Dimitre Novatchev
A: 

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

Dror
+21  A: 

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

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.

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

Chris Nielsen
+11  A: 
Cheeso
Wish I'd know about that a couple of years ago.
scope_creep
Whoa, thanks for this one.
Kuroki Kaze
General observations: A good first exercise in producing a WinForms application.Not too-advanced, with too restrictive platform requirements, and a little bit too late. The real XPathVisualizer has been around since the year 2000 with thousands of downloads each month. XPath is clearly not a good area in which to try to rediscover the wheel.
Dimitre Novatchev
+1  A: 

I found the following tool the most helpful.

Allans Online XPath Tester

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.

If the tool I mentioned in my answer has such issues, please do let me know so I can fix it! Thanks!
Chris Nielsen
+1  A: 

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.

screenshot

normal user
+1  A: 

I'll add one I made last year to the list. It's fairly primitive compared to the others and is best for quick checks. It's .NET/Silverlight based.

Chris S
+1  A: 

If you're on Firefox, you can use Firebug + Firefinder, which enable you to filter elements based on XPath expressions, and even post the matched code to jsbin in a snap.

asymmetric
+3  A: 

Hi,

This is a little commercial for my site, but I have made a online XPath evaluator. It supports XPath 2.0 and is available at http://www.xmltools.dk.

XPath 2.0 evaluations which renders a sequence of numbers:

alt text

And, elements and attributes are marked when searched for:

alt text

lasseespeholt