Altova XMLSpy 2024 Professional Edition

About the XPath/XQuery Window

Home Prev Top Next

The XPath/XQuery Window (screenshot below) enables you to build, evaluate, and debug XPath and XQuery expressions with respect to XML or JSON documents. (Features that enable JSON queries were introduced in XPath/XQuery 3.1. See also JSON Transformations with XSLT/XQuery.)

XPathXQueryWindowVertical

For a broad description of the window and its toolbar, see XPath/XQuery Window in the description of the interface.

 

Horizontal and vertical layouts

In the right-hand corner of the toolbar is a button (see screenshots above and below) that enables you to switch between a vertical and a horizontal layout. You can switch layouts at any time and in any mode (see Evaluation Mode and Debug Mode below). The screenshot above shows the vertical layout, which is useful when the XPath/XQuery expression (in the left-hand pane in the screenshot above) spans multiple lines.

 

The horizontal layout (screenshot below) is useful in cases where the result has lines that have a large horizontal extent..

XPathXQueryWindowHorizontal

 

Nine tabs

The XPath/XQuery Window has nine tabs, which are located at the left of the window (see screenshots above). Having multiple tabs enables you to work with different expressions in different tabs and compare results. Click the handle of the tab you want to switch to.

 

Evaluation Mode and Debug Mode

The XPath/XQuery Window can be used in two modes:

 

Evaluation Mode, in which an XPath or XQuery expression is evaluated with respect to one or more XML/JSON documents. The expression is entered in the Expression pane, and the result is displayed in the adjoining Results pane. You can click nodes in the result to go to that node in the XML or JSON document.

Debug Mode, in which you can debug an XPath/XQuery expression as it applies to the currently active XML document. You can set breakpoints and tracepoints, and go step-by-step through the evaluation. At each step you can see the content of variables, as well as set custom Watch expressions to check additional aspects of the evaluation.

 

To switch between the two modes, select the appropriate command in the Start Evaluation/Debugging dropdown menu that is located in the left-hand corner of the window's toolbar (see screenshot below).

XPXQWindowSelectEvalMode

How to use the two modes is described in the sub-sections of this section.

 

XPath/XQuery Expression Builder

In both modes, the Expression Builder can be used to help you construct syntactically correct expressions. Switch Expression Builder on/off with the Builder Mode button of the main toolbar icSwitchToExpBuilder.

 

© 2017-2023 Altova GmbH