JetBrains Rider 2018.1 Help

XPath Expression Generation

This action computes a unique XPath expression that matches the currently selected node in the document. The action is available from the View-Menu (Unique Path) and the Editor-Context 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.

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 'id', 'name' and attributes that are of ID-type, as defined by the document's DTD or XML Schema.

    Example: /root/something[<annotation>@id="foo"</annotation>]/else

  • 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.

    Example: /root/something/else[<annotation>2</annotation>]

Last modified: 20 August 2018