XPath expression generation
Enable the XPathView + XSLT plugin
This functionality relies on the XPathView + XSLT plugin, which is bundled and enabled in IntelliJ IDEA by default. If the relevant features aren't available, make sure that you didn't disable the plugin.
Press Control+Alt+S to open the IDE settings and then select.
Open the Installed tab, find the XPathView + XSLT plugin, and select the checkbox next to the plugin name.
This action computes a unique XPath expression that matches the currently selected node in the document. The action is available from the main menu (Show Unique XPath). The action is only enabled when the caret is placed on an element that a useful expression can be generated for.) and the editor context menu (
If a simple XPath expression like
/root/something/else doesn't produce a unique result, the action has two strategies to make it unique:
If the non-unique node is an element, the action looks for attributes with the name
name, and attributes that are of ID type, as defined by the document's DTD or XML Schema. For example:
For nodes other than elements (comments, processing instructions), or if the above rule doesn't produce a unique result, the index of the node inside its parent is appended. For example: