PhpStorm 2022.2 Help

XPath search

PhpStorm lets you use XPath 3.0 to find specific XML nodes in XML files in your current project, directory, or within a custom scope.

When you compose an XPath expression, PhpStorm provides code completion for XPath axes and checks the expression syntax. It also provides XPath syntax highlighting, which can be customized in Settings / Preferences | Editor | Color Scheme | XPath.

Search in XML files

  1. From the main menu, select Edit | Find | Find by XPath. The Find by XPath Expression dialog opens.

  2. Type an XPath expression.

    For example, the following expression:


    will search for resource tags that are descendants of an application tag that has an attribute title with the value BestApp.

  3. Choose the scope for the search.

    If you select Directory and specify a path to a directory, you can also select the Recursively checkbox to search for nodes in all subdirectories.

    The XPath search results are displayed in the Find tool window.

Last modified: 01 July 2022