[an error occurred while processing this directive]

XPath Explorer


XPath is a syntax for navigating inside XML documents, in order to extract specific little pieces of content. It's sort of like SQL for XML. It may be better known as "the stuff inside the quotes in XSL," but it has a life (and a spec) of its own.

What is XPath Explorer?

XPath Explorer (XPE) is a GUI application that lets you interactively experiment with XPath. Basically, you type in a URL (to an XML or HTML document) and an XPath expression, and it displays the elements or attributes from that document which match that expression. It also displays the value (string, number, or boolean) of the expression, and (in a stunning coup de grace) displays the entire XML tree of the original document, but with the matching nodes highlighted in bold. This makes it easy to play with and debug your XPath expresions.

By popular demand, we've added a reverse gear! Now when you click on a node, XPE will generate an XPath that uniquely identifies that node. If you double-click (or click the "Use This Path" button) it will close the circle and select all nodes that match that XPath -- should be the one you clicked on, huh?

The generation algorithm basically walks up the tree until it finds the document root, or a node with an id tag (since ids are supposed to be unique in XML), then walks back down, building the path by position.

Why would I want to use XPath Explorer?

Maybe you're trying to write an XSL stylesheet and you're tearing your hair out because a complicated XPath matching expression doesn't match what you think it should, and you need some debugging help.

Maybe you're using HTTPUnit to unit test your Web site, and you're sick of using the W3C DOM classes to painstakingly walk down your DOM tree. You can use XPath to jump immediately to the value you're looking for and assert that it's present.

Come to more: http://www.purpletech.com/xpe/


[an error occurred while processing this directive]