Edit online

Oxygen XML Author Eclipse plugin includes some useful actions that allow you to easily edit XML markup in Text mode. These actions are available in the Refactoring submenu of the contextual menu, and many of the actions can also be done with simple keyboard shortcuts.

Using the Breadcrumb

A breadcrumb on the top stripe indicates the path from the document root element to the current element. It can also be used as a helpful tool to insert and edit specific elements in the document structure.

Figure 1. Breadcrumb in Text Mode
The last element listed in the breadcrumb is the element at the current cursor position. Clicking an element in the breadcrumb selects the entire element in the editor area. Also, each element provides a contextual menu with access to the following actions:
Append Child
Allows you to select an element (from a drop-down list) that is allowed by the associated schema and inserts it as a child of the current element.
Insert Before
Allows you to select an element (from a drop-down list) that is allowed by the associated schema and inserts it immediately before the current element, as a sibling.
Insert After
Allows you to select an element (from a drop-down list) that is allowed by the associated schema and inserts it immediately after the current element, as a sibling.
Edit Attributes
Opens an editing window that allows you to edit the attributes of the currently selected element.
Toggle Comment
Encloses the currently selected element in an XML comment, if the element is not already commented. If it is already commented, this action will remove the comment.
Cut
Removes the selected element and copies it to the clipboard.
Copy
Copies the selected element to the clipboard.
Delete
Deletes the currently selected element.

Move Nodes

You can easily move XML nodes in the current document by using the following shortcut keys:

Alt + UpArrow
Moves the current node or selected nodes in front of the previous node.
Alt + DownArrow
Moves the current node or selected nodes after the subsequent node.

Rename Elements

You can rename elements by using the following actions in the Refactoring submenu of the contextual menu:

Rename Element
The element from the cursor position, and any elements with the same name, can be renamed according with the options from the Rename dialog box.
Rename Prefix (Alt + Shift + P (Command + Shift + P on OS X))
The prefix of the element from the cursor position, and any elements with the same prefix, can be renamed according with the options from the Rename dialog box.
  • If you select the Rename current element prefix option, the application will recursively traverse the current element and all its children. For example, to change the xmlns:p1="ns1" association in the current element to xmlns:p5="ns1", if the xmlns:p1="ns1" association is applied on the parent element, then Oxygen XML Author Eclipse plugin will introduce xmlns:p5="ns1" as a new declaration in the current element and will change the prefix from p1 to p5. If p5 is already associated with another namespace in the current element, then the conflict will be displayed in a dialog box. By pressing OK, the prefix is modified from p1 to p5 without inserting a new declaration.
  • If you select the Rename current prefix in all document option, the application will apply the change on the entire document.
  • To also apply the action inside attribute values, select the Rename also attribute values that start with the same prefix checkbox.

Surround Content with Tags (Wrap)

You can surround a selection of content with tags (wrap the content) by using the following action in the Refactoring submenu of the contextual menu:

Surround with Tags (Alt + Shift + E)
Allows you to choose a tag that encloses a selected portion of content. If there is no selection, the start and end tags are inserted at the cursor position.
Surround with '[tag]' (Alt + Shift + ForwardSlash)
Surround the selected content with the last tag used.
Surround with <![CDATA]]> (Alt + Shift + C (Command + Alt + C on OS X))
Surround the selected content with a <CDATA> tag so that the parser will interpret it as textual data rather than markup.

Unwrap the Content of Elements

You can unwrap the content of an element by using the following action in the Refactoring submenu of the contextual menu:

Delete element tags (Alt + Shift + Comma)
Deletes the start and end tag of the current element.

Join or Split Elements

You can join or split elements in the current document by using the following actions in the Refactoring submenu of the contextual menu:

Join elements (Alt + Shift + F (Command + Alt + F on OS X))
Joins the left and right elements relative to the current cursor position. The elements must have the same name, attributes, and attributes values.
Split element
Split the element from the cursor position into two identical elements. The cursor must be inside the element.

Other Refactoring Actions

You can also manage the structure of the markup by using the other specific XML refactoring actions that are available in the Refactoring submenu of the contextual menu:

Attributes Refactoring Actions

Contains built-in XML refactoring operations that pertain to attributes with some of the information preconfigured based upon the current context.

Add/Change attribute
Allows you to change the value of an attribute or insert a new one.
Convert attribute to element
Allows you to change an attribute into an element.
Delete attribute
Allows you to remove one or more attributes.
Rename attribute
Allows you to rename an attribute.
Replace in attribute value
Allows you to search for a text fragment inside an attribute value and change the fragment to a new value.
Comments Refactoring Actions

Contains built-in XML refactoring operations that pertain to comments with some of the information preconfigured based upon the current context.

Delete comments
Allows you to delete comments found inside one or more elements.
Elements Refactoring Actions

Contains built-in XML refactoring operations that pertain to elements with some of the information preconfigured based upon the current context.

Delete element
Allows you to delete elements.
Delete element content
Allows you to delete the content of elements.
Insert element
Allows you to insert new elements.
Rename element
Allows you to rename elements.
Unwrap element
Allows you to remove the surrounding tags of elements, while keeping the content unchanged.
Wrap element
Allows you to surround elements with element tags.
Wrap element content
Allows you to surround the content of elements with element tags.
Fragments Refactoring Actions

Contains built-in XML refactoring operations that pertain to XML fragments with some of the information preconfigured based upon the current context.

Insert XML fragment
Allows you to insert an XML fragment.
Replace element content with XML fragment
Allows you to replace the content of elements with an XML fragment.
Replace element with XML fragment
Allows you to replace elements with an XML fragment.