AquaPath is a Mac OS X Developer Tool for that allows you to evaluate XPath 2.0 expressions against any XML document and view the result sequence in a dynamic, intuitive tree representation.


AquaPath screenshot

Update: Version 1.1 released! New in this version:

Universal Binary Logo

There are two ways to select the context node for your expression

  1. There is a new "Context Node" text field at the top of every AquaPath document window. If you just ignore this text field, AquaPath will behave just as before, and always treat the document node of your current document as the context node for all of your XPath expressions. Or, you can type an XPath expression in this new text field that returns a node sequence containing a single node. Note that your context path must select only a single node as the context node, otherwise you will see an error message. The node selected by this context path will serve as the context node for your XPath expressions and will be highlghted with a black border the next time the display tree is rendered.
  2. After the dynamic tree view has been displayed under the "Display" tab, you can right-click (control-click) any node in the tree for a context menu that will allow you to select the currently clicked node as the context node.

Regarding the line numbers added to the source editor... these are not particularly robust. AquaPath is not a good XML document editor. The source editor and line numbers are provided strictly for convenience and experimentation. If you are trying to do serious document editing with AquaPath, you are cracked out your head. Please don't write me about how poor a text editor AquaPath is. I know. That's not what it's supposed to be.

Update: Version 1.0.3 released!

This is a bug fix release (1.0.3).

Update: Version 1.0.2 released!

This is a bug fix release (1.0.2). Prior versions would not display comment or processing instruction children of the document node under the "Display" tab... only the document element (outermost element) was being displayed.

Update: Version 1.0.1 released!

This is a bug fix release (1.0.1). I realized that the "Results" tab was not really showing correct the string-value result for a given XPath expression. Instead, it was showing the full serialized XML string representation of the nodes that were matched by the XPath expression. The distinction is subtle, but important.

For example, if your XPath expression happened to return a node-set sequence containing a single node whose serialized XML string representation was:

<p>Some text</p>

AquaPath 1.0 would have shown this string in the "Results" tab:

<p>Some text</p>

Although this information might be useful, if you are familiar with the (highly-readable) XPath 1.0 spec, then you know this is not the same as the "string-value" of an XPath result sequence (or node-set). The string-value is actually more important and would correctly be reported as:

Some text

Here's an example of the difference between AquaPath 1.0 and 1.0.1 results for an attribute node such as this:





Again, this matches the common XPath concept of a string-value which is mostly likely what you are looking for when using XPath. Sorry for the confusion in 1.0!


Using AquaPath is simple! Open an existing XML document (of any type) or even author an XML document using AquaPath itself (AquaPath is also a rudimentary text editor). The source text of your XML document appears under the "Source" tab in an AquaPath document window... use this tab to author or edit your document.

Next, type an XPath expression into the "XPath" textfield at the top of the AquaPath document window. Click "Evaluate" to see the matching node sequence. You will see a status bar message just below the XPath text field showing either the number of nodes in the result sequence or and error message if your XML document is not well-formed or if your XPath expression is invalid.

Under the "Results" tab, you will find a text area containing the string value of the result sequence. The whitespace of each node has been compressed so that you will see a single node's string value per line. This tab's contents are convenient for copy-pasting the results to another text editor or wherever.

Screenshot of AquaPath's Display Tab

The "Display" tab is where all the magic happens. Here you will see a dynamic (DHTML), syntax-colored representation of your XML document with "-" or "+" signs next to each element node. Use these symbols for collapsing and expanding a given element and its children. Also, all nodes and text matching your XPath expression will be highlighted in yellow. Cool!

AquaPath requires Mac OS X 10.4 Tiger or later.

AquaPath is developed by Todd Ditchendorf. Have feedback? Email me.

Implementation Details

AquaPath is implemented using Apple's Awesome Cocoa/Objective-C NSXML Framework. NSXML supports a large subset of XPath 2.0. AquaPath is not a 'Schema-Aware' XPath implementation... meaning that it does not support selecting nodes via additional type annotations added by validating your document against an XSD (W3C XML Schema).

Valid XHTML 1.0! Valid CSS!