Replacing nodes

Generally, when you insert a new element, XMLmind XML Editor automatically creates for you the valid element having the simplest content. For example, if you insert a note element in a DocBook document, this note contains an empty para.

In other cases, the simplest valid content is, well, too simple to be useful. In such cases, XMLmind XML Editor is expected to have been configured (by XMLmind engineers or by third-party consultants) to insert the most commonly used valid content. For example, if you insert a figure element in a DocBook document, this figure contains an imagedata element.

Now let's suppose you don't want the newly inserted note to contain a paragraph. Instead, you want it to contain an itemizedlist element. Also, you don't want the newly inserted figure to contain an image. You want it to contain a programlisting element.

You have learned that you can select the para contained in the note, insert after it an itemizedlist, then delete the unwanted para. (In that order, because the DocBook schema, hence XMLmind XML Editor, will not allow a note to become empty.)

In fact, the The Replace command Replace command has been designed to do exactly that, but in a single step. The Replace command allows to replace the selected nodes by an element or by a text node (if allowed by the schema, of course). Like all the other generic editing commands, this command is found in in the Edit tool, in the Edit menu and in the popup menu displayed when you right-click in the document view.

Screencast Watch the screencast

Related productivity tips

related productivity tip Inserting custom element templates