Editing XML Markup in Text Mode
Oxygen XML Editor 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 in the , and many of the actions can also be done with simple keyboard shortcuts. menu
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.
- 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 a 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 (Option + UpArrow on macOS)
- Moves the current node or selected nodes in front of the previous node.
- Alt + DownArrow (Option + DownArrow on macOS)
- 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 (or from the : 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 macOS))
- 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 toxmlns:p5="ns1"
, if thexmlns:p1="ns1"
association is applied on the parent element, then Oxygen XML Editor will introducexmlns:p5="ns1"
as a new declaration in the current element and will change the prefix fromp1
top5
. Ifp5
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 fromp1
top5
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.
- 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
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 (or from the : menu)
- Surround with submenu
- Presents a drop-down menu that allows you to choose a tag to surround a selected portion of content.
- Surround with Tags (Ctrl + E (Command + E on macOS))
- 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.
- If the Position cursor between tags option is selected in the Content Completion preferences page, the cursor is placed between the start and end tag.
- If the Position cursor between tags option is not selected in the Content Completion preferences page, the cursor is placed at the end of the start tag, in an insert-attribute position.
- Surround with '[tag]' (Ctrl + ForwardSlash (Command + ForwardSlash on macOS))
- Surround the selected content with the last tag used.
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 (or from the : menu)
- Delete element tags (Alt + Shift + X (Command + Option + X on macOS))
- 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 (or from the : menu)
- Join elements (Alt + Shift + J (Command + Option + J on macOS))
- 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 (Alt + Shift + D (Ctrl + Option + D on macOS))
- 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.