5.0 Using the XPath Builder

The XPath Builder is a powerful tool that allows you to build and test an XPath expression against any XML document. You can test different expressions against an XDS document and modify the XDS document while testing the expression. For more information about XPath expression, see XPath 1.0 Expressions in the Understanding Policies for Identity Manager 3.5.1 .

Figure 5-1 XPath Builder

To use the XPath Builder:

  1. In the Policy Builder, select any of the following conditions or action, then click the Launch XPath Builder icon XPath Builder icon.

  2. Select Import to browse to and select the XDS document to test.

    Import XDS document

    Designer comes with sample event files you can use to test the XPath expression against. The files are located in the plug-in com.novell.designer.idm.policy_ version\simulation , where version is the current version of Designer. The events are Add, Association, Delete, Instance, Modify, Move, Query, Rename, and Status.

    Sample event files
  3. Double-click the folder to display the available events. Each event has different files you can select. For example, if you select Add you have three options: Organization.xml, OrganizationalUnit.xml, and User.xml. The file indicates the event. If you select User.xml, it is an Add event for a User object.

    User.xml file
  4. Select a file, then click Open.

    The input document is now displayed in the XPath Context Selector view. The XML Source tab allows you to use an XML source editor to edit the imported document, or an XML document from another editor can be copied and pasted into the source view. If you change the document, click Save As to save the changed document.

    XPath Context Selector view

    If you want to see the XDS document without scrolling, click the Hide XPath Details icon Hide XPath Details icon. To see the XPath Expression and Results windows, click Show XPath Details icon Show XPath Details icon.

    XDS document view
  5. Select the current position in the document from which you would like start building your XPath expression.

    Current position in the document

    The XPath context that you have selected is displayed in the XPath Selected Context as shown.

    XPath Selected Context
  6. Select Generic or Unique.

    Generic searches the entire XML document to match the specified XPath expression. It returns results for each instance of the XPath expression. In this example, the XPath expression is “/nds/input/add”. It searches the entire XML document for each instance of add.

    Unique searches the XML document until it finds a match and stops. The unique XPath expression is “/nds/input[1]/add[1]”. It searches for the first instance of add and stops. You can specify which instance you want to use by selecting the next instance of the XPath element in the XML Context Selector.

  7. Specify an XPath expression in the XPath Expression field.

    XPath Expression

    NOTE:Using the keystroke combination Ctrl Space 3, /, [, or ( triggers code completion. The expression is evaluated up until the cursor location, and insertable elements are shown in a drop-down box.

    The results of your XPath expression appear in the Results text area below.

    Results text area

    If the XPath editor does not evaluate the expression, click the Evaluate XPath expression icon Evaluate XPath expression icon to force the XPath Builder to evaluate the expression.

  8. When you are finished building and testing an XPath expression, click OK to close the XPath Builder. The text displayed in the XPath Expression is placed into the policy that you are editing.