Edit online

XPath is a query language for selecting nodes from an XML document. To use XPath expressions effectively, you need a good understanding of the XPath Core Function Library.

XPath Toolbar

Oxygen XML Editor provides an XPath toolbar to let you query XML documents fast and easy using XPath expressions.

Figure 1: XPath Toolbar
The XPath toolbar includes the following features:
XPath version chooser drop-down menu

You can choose the XPath version from the drop-down menu available in the left side of the toolbar. Available options include XPath 1.0, XPath 2.0, XPath 2.0 SA, XPath 3.1, XPath 3.1 SA.

Note: The XPath 2.0 SA and XPath 3.1 SA options have some limitations. These options only offer information about the beginning part of the matching result. For example, if you search for an element, it will only highlight the start tag.
Warning: Oxygen XML Editor uses Saxon to execute XPath 3.1 expressions, but implements a part of the 3.1 functions. When using a function that is not implemented, Oxygen XML Editor can return a compilation error.
XPath scope menu
Oxygen XML Editor allows you to define a scope for which the XPath operation will be executed. You can choose where the XPath expression will be executed:
  • Current file - Current selected file only.
  • Project - All the files in the project.
  • Selected project resources - The files selected in the project.
  • All opened files - All files opened in the application.
  • Current DITA Map hierarchy - All resources referenced in the currently selected DITA map, opened in the DITA Maps Manager view.
  • Opened archive - Files open in the Archive Browser view.
  • Working sets - The selected working sets.
At the bottom of the scope menu the following scope configuration actions are available:
  • Configure XPath working sets - Allows you to configure and manage collections of files and folders, encapsulated in logical containers called working sets.
  • XPath file filter - You can filter the files from the selected scope for which the XPath expression will be executed. By default, the XPath expression will be executed only on XML or JSON files, but you can also define a set of patterns that will filter out files from the current scope. If you select the Include archive option, the XPath expression will be also executed on the files in any archive (including EPUB and DocX) found at the current scope.
History drop-down list
The XPath combo box keeps a history of the last 15 expressions that were used so that you can easily choose them again.
Settings menu
The following actions are available in this drop-down menu:
XPath update on cursor move
When selected and you navigate through a document, the XPath expression corresponding to the XML node at the current cursor position is displayed. For JSON documents, it displays the XPath expression for the current property.
Evaluate XPath as you type
When you select this option, the XPath expression you are composing is evaluated in real time.
Note: This option and the automatic validation are disabled when you edit huge documents or when the scope is other than Current file.
XPath Options
Opens the Preferences page of the currently selected processing engine.
Switch to XPath Builder View
Opens the XPath Builder view.
Note: During the execution of an XPath expression, the XPath toolbar displays a Stop button. Press this button to stop the XPath execution.

When you type expressions longer than 60 characters, a dialog box opens that offers you the possibility to switch to the XPath Builder view.