If the Plugin is installed, you should find a view named XPath-View offered under Window > Show View > Other... in the category XPath-Developer.
The view looks as displayed in the screenshot below.
The XPath-View can operate in real-time or on-demand-mode. To evaluate the XPath-Expression as you change either the expression or the input you need to perform the following steps:
Once the view is attached to an editor, the XPath-Expression typed in the corresponding field is evaluated on any change of the expression, the output-type, or the editor-contents. When you change the active editor or activate a view different from the XPath-View, the XPath-View automatically detaches from the editor in order not to slow the usual handling in Eclipse.
Should you want to manually suppress the evaluation of the XPath-expression without changing the active editor, click 'Detach' or untick the 'Live-evaluation'-Flag.
Below is a screenshot of a situation where some of the XML in the active editor is matched by the XPath-expression in the view. The result is evaluated as Nodelist (see the active radiobutton to the left of the result-area) and is displayed in the result-textarea.
Note that the formatting of the output is done through the Xalan-XSLT-Transformer and the formatting will typically not be identical with the formatting of the input.
If the input document declares namespaces, these are also needed in the namespace-context of the XPath-expression.
The plugin offers automatic evaluation and inclusion as well as manual control over the namespace-context. Note however that the plugin only allows a global context for the complete expression.
All namespace-settings are controled in the "Namespace-Context settings" section at the bottom of the view. If you click on the name, the section unfolds as shown in the screenshot below.
Once an expression is evaluated (online or offline), by default the plugin infers the namespace-context entries from the attributes to the first element of the input. For example, if the element is
<?xml version='1.0'?> <xs:schema xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty" xmlns:xs="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" xml:lang="en" targetNamespace="http://www.w3.org/2001/XMLSchema" version="Id: datatypes.xsd,v 1.4 2004/05/29 10:26:33 ht Exp "> ... </xs:schema>
the plugin will pick up two context-entries as displayed below.
In case you want to experiment with the namespace-context or the plugin does not pick up the correct entries, you can turn off automatic context-setting by un-ticking "Infer from source". If this is done, you may use the button "Add Namespace-Mapping..." to add mappings. Furthermore, on double-clicking an existing entry in the table a dialog as displayed below will open, allowing you to change or delete the entry.
Since evaluation of expressions against large files may take some time and you may not be interested in real-time evaluation, the evaluation of the XPath-expression can be done offline by unsetting the mark at 'Live-evaluation' and using the 'Evaluate'-button if evaluation is in order.
The evaluation of the expression takes place in a separate thread and may be cancelled by the user or is automatically cancelled if it takes too long. The dialog for cancelling the evaluation appears with a small delay so that you will not notice it during fast live-evaluation.
The time-out behaviour is configurable from the preference page available under 'Window > Preferences...' in the category 'XPath-Developer'. The preference page is displayed with the default settings in the screenshot below.
As in several specialized editors within Eclipse, you can use TAB-completion for XPath-expressions in the XPath-View. To get a list of proposals for completion of the current expression, hit 'Ctrl+Space' while editing in the area for expressions. An assistant will open as displayed in the below screenshot. Scrolling through the suggestions also updates the hint on the left side of the proposal. When you select a proposal, XPath-Developer will try to work out whether the already typed in characters should be part of an expression or not.
The XPath-View tries to do a good job in guessing what you may want from TAB-completion. To this end, the rules are roughly as follows: