XPath Editor and Debugger

XPath autocomplete in XPath Tester

XPath Tools:

  • Support for XPath 1.0, 2.0, and 3.1
  • Intelligent XPath auto-completion
  • Multi-tabbed XPath Builder and Evaluator window
  • Enterprise-grade XPath Debugger
  • "Copy XPath" command
  • Namespace consideration in XPath auto-completion
  • Deep path suggestions
  • Real-time evaluation of XPath expressions
  • Evaluating XPath expressions across multiple files
  • Hot links to resulting nodes in XPath Evaluator window
  • Syntax coloring immediately highlights errors

Download Trial

XPath Editor/Tester Window

You'll find the XPath/XQuery tab at the bottom of your XMLSpy screen in the Output Window. Here you can select the version of XPath you require and toggle between Builder mode and Evaluator mode.

As you're composing an XPath expression, correct syntax is shown in black, with incorrect entries highlighted in red. Intelligent auto-completion functionality provides a pop-up list of relevant choices to help you complete the expression.

The XPath analyzer window stays open as you edit your files, and you can store the results of up to nine different XPath expressions on separate tabs. This allows you to make changes to your file, then re-evaluate the expression(s) without having to remember and retype them. The ability to preserve XPath expressions and results directly in the editing view as you’re working is an invaluable timesaver unique to XMLSpy.

XPath Builder

When you select the Builder tab in the XPath window (as shown below), you will have access to numerous tools that make developing XPath expressions quick and easy:

  • Point-and-click expression building, via a comprehensive a list of operators, expressions, and built in functions, which you can insert in an expression by double clicking. Functions are inserted with their arguments indicated by “#” placeholders, making it easy to build expressions quickly and error-free.
  • Mouse-over hints that describe each operator, function, etc., so you can be sure to choose the correct one for the expression at hand.
  • Enhanced entry helpers that display the description of built in functions, and then show helpful function and parameter details as you type, speeding development and ensuring accuracy.

Video Check out this short video on the XPath Editor and Tester.

XPath Evaluator

As you're working, the Evaluator tab (shown in the screenshot above) lets you test the results of your XPath expressions as you work. Evaluator mode has several advantages:

  • Save time and avoid errors by testing expressions before adding them to your document and adjusting as needed
  • Evaluate an XPath expression against one or more files: the active document, all open files, a folder, or an entire XMLSpy project.
  • Utilize nine tabs for developing and testing complex expressions. Once you have composed an XPath statement on one tab, switching to a new tab lets you build and analyze the results of a new expression – but when you switch back to the previous tab, the expression and results are still there. This allows you develop multiple expressions side-by-side and incrementally make changes to each one of them, preserving both the expression AND the result for each tab.

The screenshot above shows Evaluator mode.

XPath Builder

Intelligent XPath Auto-complete

As you’re composing an XPath expression in Text View, Grid View, or in the XPath window, XMLSpy provides you with valid XPath functions, as well as element and attribute names from the associated schema and XML instance(s). Intelligent XPath auto-completion accounts for namespaces when listing options and even provides deep path suggestions when the required node is not in close proximity to the current context.

You can also use the Copy XPath command, which helps you define XPath 1.0, 2.0, or 3.1 expressions with a simple point-and-click interface. You simply select an element or attribute in your XML data file, and right click to select "Copy XPath" to automatically copy the corresponding XPath expression to the clipboard.

XPath Debugger

The XPath Editor window also includes the industry's first, enterprise-grade XPath Debugger to help you test, troubleshoot, and perfect your XPath espressions faster and easier than ever before.

The debugger lets you go step-by-step through the evaluation of your XPath expression. Each click shows you the results for the corresponding step of the evaluation, and you can step into, step out, and step over evaluation steps using helpful buttons in the debugger toolbar.

You can also set any number of break points (to pause evaluation) and trace points (to record the evaluation result at a breakpoint) to further examine the evaluation of your XPath code.

In addition to the main Result tab, the Results pane contains a Variables tab and Call Stack tab. During debugging, the Variables tab displays the variables of the current step and their values. The Call Stack tab displays the various processor calls up to that point in the debugging. The most recent calls are on top, and the current call is highlighted in both panes.

This powerful XPath Debugger makes it infinitely easier to compose and test XPath expressions, saving developers time and frustration.

XPath Debugger

Learn XPath

The XPath Editor in XMLSpy provides numerous tools to guide you as you develop XPath expressions. If you need to learn more about XPath, be in the basics or about new features in the latest version of the standard, check out these free resources:

XPath Debugger Callstack

Next Steps

Related Topics