Editing XML in <oXygen/> Author

 Editing the XML markup

One of the most useful feature in Author editor is the content completion support. The fastest way to invoke it is to press Ctrl + Space (on Mac OS X the shortcut is Meta + Space).

Content completion window offers the following types of actions:

  • inserting allowed elements for the current context according to the associated schema, if any;

  • inserting element values if such values are specified in the schema for the current context;

  • inserting new undeclared elements by entering their name in the text field;

  • inserting CDATA sections, comments, processing instructions.

 

Figure 5.20. Content completion window

Content completion window

If you press Enter the displayed content completion window will contain as first entries the Split <Element name> items. Usually you can only split the closest block element to the caret position but if it is inside a list item, the list item will also be proposed for split. Selecting Split <Element name> splits the content of the specified element around the caret position. Thus, if the caret is positioned at the beginning or at the end of the element, the newly created sibling will be empty.

If the caret is positioned inside a space preserve element the first choice in the content completion window is Enter which inserts a new line in the content of the element. If there is a selection in the editor and you invoke content completion, a Surround with operation can be performed. The tag used will be the selected item from the content completion window.

By default you are not allowed to insert element names which are not considered by the associated schema as valid proposals in the current context. This can be changed by unchecking the Allow only insertion of valid elements and attributes checkbox from the Schema aware preferences page.

Joining two elements. You can choose to join the content of two sibling elements with the same name by using the Join elements action from the editor contextual menu.

The same action can be triggered also in the next situations:

  • The caret is located before the end position of the first element and Delete key is pressed.

  • The caret is located after the end position of the first element and Backspace key is pressed.

  • The caret is located before the start position of the second element and Delete key is pressed.

  • The caret is located after the start position of the second element and Backspace key is pressed.

In either of the described cases, if the element has no sibling or the sibling element has a different name, Unwrap operation will be performed automatically.

Unwrapping the content of an element You can unwrap the content of an element by deleting its tags using the Delete element tags action from the editor contextual menu.

The same action can be triggered in the next situations:

  • The caret is located before the start position of the element and Delete key is pressed.

  • The caret is located after the start position of the element and Backspace key is pressed.

  • The caret is located before the end position of the element and Delete key is pressed.

  • The caret is located after the end position of the element and Backspace key is pressed.

Removing all the markup of an element You can remove the markup of the current element and keep only the text content with the action Remove All Markup available on the submenu Refactoring of the contextual menu and on the toolbar XML Refactoring.

When you press Delete or Backspace in the presented cases the element is unwrapped or it is joined with its sibling. If the current element is empty, the element tags will be deleted.

When you click on a marker representing the start or end tag of an element, the entire element will be selected. The contextual menu displayed when you right-click on the marker representing the start or end tag of an element contains Append child, Insert Before and Insert After submenus as first entries.