16.2 Using the Source Editor

The Source editor supports the following features:

  • Syntax highlighting.

  • Context-sensitive code completion based on the DTD and the XML schema.

    The code completion is based on the existing content of the XML document if no DTD or XML schema is associated with the XML document. When code completion is activated and the XML document contains <root><a><b/></a><a></a></root>, then you type the second <a>, the editor suggests that you add b as a child of the a element.

  • As-you-type validation. If the XML is invalid (for example, the > is removed from a tag), the editor indicates the error.

  • General text editing operations such as undo, redo, cut, copy, paste, select all.

Figure 16-1 XML Source Editor

The XML Source editor provides the following toolbar options:

Table 16-1 XML Editor Toolbar

Icon

Description

Expands all folding (if code folding is enabled). You can enable or disable code folding in two ways;

  • Selecting Windows > Preferences > General > Editors. Select Structured Editors. Select Enable Code Folding.

  • In the Source editor, right-click in the left ruler to access the Folding submenu.

Collapses all folding (if code folding is enabled)

Attaches a schema. For more information about using this feature, see Attaching a Schema or DTD.

Shows help

The Source editor right-click menu contains these options:

Table 16-2 XML Source Editor Right-Click Menu Options

Menu Choice

Description

Revert File

Removes any changes to the XML file.

Cut, Copy, Paste, Undo, Save

Performs the common editor function.

Format

Document: Formats the entire document as specified in the preferences.

Active elements: Formats only selected elements.

Clear Validation Errors

Clears reported validation errors from the Problems view.

Validate

Validates the XML document and shows errors in the Problems view.

Preferences

This is the same as setting preferences by using the Windows > Preferences option. For more information, see Setting XML Editor Preferences.

To save XML updates, do one of the following:

  • Click Save in the Designer toolbar.

  • Right-click in the XML editor, then select Save.

  • Press Ctrl+S.

When saving, the XML editor automatically checks the XML to make sure it conforms to the appropriate DTD (Filter DTD, DirXML Script DTD, etc.) It saves non-conforming XML only if you explicitly instruct it to do so. For information about Identity Manager DTDs, see the Identity Manager DTD Reference.

NOTE:You can disable notification of DTD errors in Designer Preferences. To do so, select Window > Preferences, then select NetIQ > Identity Manager > Configuration in the left navigation. Deselect Prompt for errors when validating XML against DTD for all Policy Editors.