Evaluating XPath expressions

During a debug session, you can watch or inspect XPath expressions. When you watch an XPath expression, it is evaluated in the current debug context in the Expressions view and reevaluated each time the debugger suspends (for example, when a breakpoint is hit). When you inspect an XPath expression, you are evaluating its current value only and it is not reevaluated.

You can set XPath expression watches from the Expressions view or from the editor. You can set XPath expressions to be inspected from the editor.

Once you have set a watch expression, you can enable, disable, edit, or remove it using pop-up menu items in the Expressions view. Once you have set an inspect expression, you can remove it using the pop-up menu in the Expressions view.

To watch an XPath expression from the Expressions view, complete these steps:

  1. Right-click in the Expressions view and choose Add Watch Expression from the pop-up menu.
  2. In the Add Watch Expression dialog box, enter the expression to watch.
  3. If you want the watch to be disabled, deselect the Enable check box. Otherwise, leave this check box selected.
  4. Click OK to exit the dialog box.

To watch an XPath expression from the editor, complete these steps:

  1. In the editor, select the expression that you want to watch.
    Note: The expression must be a valid XPath expression or a valid variable reference. To reference a variable, the variable name must be preceded with $.
  2. Right-click the expression and choose Watch from the pop-up menu.

To inspect an XPath expression from the editor, complete these steps:

  1. In the editor, select the expression that you want to inspect.
    Note: The expression must be a valid XPath expression or a valid variable reference. To reference a variable, the variable name must be preceded with $.
  2. Right-click the expression and choose Inspect from the pop-up menu.

If you are inspecting an XPath expression, you can change it to a watch expression. To do this, select the expression in the Expressions view, right-click, and choose Convert to Watch Expression from the pop-up menu.


Feedback