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.17. Content completion window

Content completion window

If you press Enter the displayed content completion window will contain as first entry the Split <Element name> item. Selecting it splits the content of the closest element that contains the caret's 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.

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 a dialog will be displayed allowing you to choose between Join or Unwrap operations. If the current element is empty, no dialog will be presented and the element tags will be deleted.

Figure 5.18. Join/Unwrap dialog

Join/Unwrap dialog


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.