Syntax Highlighting

Tag elements (attributes, values, etc.) as well as comments in the Source View are highlighted differently to facilitate orientation in the source code and detection of syntax errors. You can customize the syntax highlighting in the editor-relevant preferences.

Unlimited Undo and Redo

To undo or redo a change made to a document, click “Edit > Undo” or “Edit Redo” in the menu bar above. Alternatively, right-click in the Editor Field and select the corresponding entry “Undo Text Change”. You can undo and redo every change made to a file for the entire editing session.

Node Selection

Depending on the position of the cursor in the editor, the node selection indicator highlights the corresponding tags as well as the lines that include a node in the vertical ruler in the left area of the Source View.

Comment toggling and block commenting and uncommenting

You can toggle an XML comment on and off by right-clicking and selecting “Source Toggle Comment”. To comment on a section of source code, right-click on the selected area and select “Source Add Block Comment”. To remove a comment, select “Source Remove Block Comment”.

As-you-type Validation

While editing the document, errors found in the general XML syntax (such as missing quotes, missing brackets, or missing end tags) as well as validation errors (if a schema is specified) are indicated by red wavy underlining. A red icon at the top of the vertical ruler in the right area of the Source View will appear if the Document contains any errors. To find a description of the error, move your mouse cursor over the red marks shown in the vertical ruler in the right area of the Source View. A yellow icon indicates a warning.

As-you-type Validation

Smart Insert

Typing elements and comments is supported by a Smart Insert mode: When you type an element, Smart Insert automatically completes the corresponding closing tag. Similarly, when you type the beginning of an XML comment <! --, Smart Insert completes the ending of the comment -->. The cursor is left in the middle of the comment tag so that you can proceed directly typing in the comment text. In the same line, opening quotes in attributes are completed with closing quotes while the cursor is left between them so you can directly start typing the value of the attribute. To toggle the Smart Insert mode on and off, click “Edit Smart Insert Mode” in the menu bar and tick or untick the check mark.

Hover Help 

Hover Help is displayed when users move the mouse cursor over an element or an attribute. It displays the content model of the current element or attribute and additional documentation information if included in the associated schema. Moving the mouse cursor over text that has been marked with red wavy underlining will display a description of the current problem. You can modify the Hover Help preferences in the relevant editor preferences.

Hover Help

 

Content Assist

When typing the opening bracket of an element in the Source View field, Content Assist provides you with a list of suggested elements allowed at this position. You can activate Content Assist by clicking “Edit Content Assist” in the menu bar at the top. When activating Content Assist while the cursor is at an attribute position, a list of suggested attributes allowed at this position is provided. Proposals come from a referenced content model if a schema is specified for the document or through the XML Catalog. You can modify the Content Assist preferences in the editor relevant preferences.

Quick Fix

Select “Edit Quick Fix” in the menu bar on top to see a list of suggested corrections when positioning the cursor on a text section text that has been marked with red wavy underlining. Alternatively, right-click on the underlined text and select “Quick Fix”. If there are no problems or warnings at the selected position, Quick Fix proposals are not available.

Formatting

To make the XML document easier to read and better for printing, you can change the formatting options in the editor relevant preferences. You can apply formatting to the whole document by right-clicking in a non-highlighted area in your document and selecting “Source Format”. To apply formatting to a highlighted area only, right-click in the selected area and select “Source Format Active Elements”.

Cleanup

Simple errors in the XML document such as missing required attributes, missing start or end tags, or unquoted attributes can be corrected with XML Cleanup. You can open the “Cleanup” dialog box by right-clicking in the Editor and selecting “Source Cleanup Document”. Alternatively, you can find it in the menu bar under “XML > Source Cleanup Document”. Afterwards, set your Cleanup preferences in the dialog box; you can further select ’Format source’ in the box to apply formatting to the document.

Team and Local History

A local edit history of an XML document is maintained when you create or modify the document. This history is accessible via “Team Show Local History” in the context menu. Each time you edit and save the file, a copy is saved so that you can replace the current file with a previous edit or even restore a deleted file. You can also compare the contents of all the local edits. You can also “Apply Patch(es)” after selecting “Team” in the context menu. Select the resource (clipboard, file, URL or workspace) where the patch was generated in the “Patch Input Specification” dialog. This resource should contain the same file revisions as the line-up on which the patch was generated. For more information, please see the Eclipse documentation http://www.eclipse.org/documentation/

Preferences

You can edit XML Editor-relevant preferences by right-clicking in the Source View editor and selecting “Preferences”. The following preferences can be edited:

  • Highlighting of the syntax elements: Expand the tree “XML XML Files > Editor” on the left of the dialog box “Preferences” and select “Syntax Coloring”.
  • Hover Help: Expand the tree “General Editors” to the left of the dialog box “Preferences” and then select “Structured Text Editors”. In the “Structured Text Editors” dialog box, select the “Hovers” Tab and tick the requested modifier preferences.
  • Content Assist: Expand the tree “XML XML Files Editor” on the left of the dialog box “Preferences” and select “Content Assist”. There you can choose the appropriate settings.
  • Formatting: Expand the tree “XML XML Files” on the left of the dialog box “Preferences” and select “Editor”. In this dialog box you can choose and check the respective settings of the formatting function.

For more information, please see the Eclipse documentation:

http://www.eclipse.org/documentation/

  • No labels