Basic editing

In order to add some content to your XML document, you must:

  1. Select an XML node.
  2. Use 'Insert Before' icon EditInsert Before, 'Insert' icon EditInsert or 'Insert After' icon EditInsert After in order to add a new element or text node respectively before, into (that is, at caret position) or after the selected node.

You have learned in the previous lesson that moving the caret into a text node implicitly selects the element containing this text node. You have also learned that clicking in the node path bar on an element name (e.g. "section") or a node name (e.g. "#text") explicitly selects the corresponding node. When a node is explicitly selected, a red box is drawn around it. When an element is implicitly selected, there is no visual clue that something is selected.

In this lesson, you'll learn to use the 3 Insert commands. In practice, you'll use Insert After most of the time.

The Insert commands are found in the Edit menu, but are implemented by the Edit tool:

The Edit tool

In order to use an Insert command, you can click on the corresponding button or you can use one of the following keyboard shortcuts (on the Mac, use the Command key, not the Control key):

Note that XMLmind XML Editor does not work like other XML editors. In other XML editors,

The Edit tool requires you to specify what you want to insert. An element is specified by its name and a text node is specified as "(text)". In order to let you to do this, the Edit tool lists all the elements you may insert given the chosen operation and the currently selected XML node.

A single click suffices to select an item from this list. Alternatively, you can type the name of the element you want to insert. Because the Edit tool supports auto-completion, suffice to type the first few letters of an element name and then press Enter to confirm your choice. After doing that, the keyboard focus is automatically returned to the document view.

If, when using the Edit tool, you don't see the element you want to insert, then it's either because you have chosen the wrong operation (e.g. Insert instead of Insert After) or because you have not selected the right element.

For example, let's suppose a para element is currently selected because the caret is found inside it. Let's suppose you want to add a chapter to your document. If you invoke Insert After, the Edit tool will not list chapter. You have to first select the chapter containing the para, for example by clicking on "chapter" in the node path bar, and then use Insert After.

Screencast Watch the screencast

The Ins keyboard shortcut

In the above screencast, we have used Insert After and selected "(text)" from the list to add an empty text node after the command element. However, in order to add an empty text node after the trademark element, we have just pressed Ins (F1 on the Mac). The Ins keyboard shortcut is the one of most useful hotkeys of XMLmind XML Editor. It inserts an empty text node after the selected element and if there is already a text node there, it moves the caret inside this text node.

Other useful keyboard shortcuts are: