The XPath/XQuery Window (screenshots below) enables you to evaluate and debug XPath and XQuery expressions with respect to XML or JSON* documents. The window can be used in two modes:
|•||Evaluate Mode, in which an XPath or XQuery expression is evaluated with respect to one or more XML documents|
|•||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|
To switch between the two modes, select/deselect the Debug Mode button (located in the left-hand corner of the window's toolbar; see screenshots below). How to use the two modes is described in the sub-sections of this section. For information about the syntax and support of XPath/XQuery expressions in the XPath/XQuery Window, see XPath and XQuery Specification Information.
|Note:||Switching to Debug Mode button is enabled only when the Current File option is selected in the Where options list (see screenshot below)|
* Features that enable JSON queries were introduced in XPath/XQuery 3.1. See JSON Transformations with XSLT/XQuery.
Horizontal and vertical layouts
In the right-hand corner of the toolbar (of both modes, Evaluate and Debug) is a button (highlighted in the screenshot below) that enables you to switch between a horizontal and a vertical layout. You can switch layouts at any time. The screenshot below shows the horizontal layout, which is useful in cases where the result has lines that have a large horizontal extent.
The vertical layout (screenshot below) is useful when the XPath/XQuery expression (in the left-hand pane) spans multiple lines.
The XPath/XQuery Window has nine tabs, enabling you to work with nine different expressions at a time. After you enter an expression in a tab, the mode of the tab is saved. If an expression is entered in a tab that is in Evaluate Mode, then the expression and evaluation settings of the tab are saved. As a result, the settings of each tab are retained. When switching to a new tab, the settings of the previously selected tab are passed to the new tab.
You can switch from one tab to another at any time, as long as the debugger is not running in the current tab. Typically, you would enter different XPath or XQuery expressions in different tabs, evaluating and/or debugging each expression separately and switching between tabs to compare results.
© 2019 Altova GmbH