43. insertNode
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 43. insertNode

Parameter syntax:

    'commentInto'|'piInto'|'textInto' |
    ('commentBefore'|'piBefore'|'textBefore'|'sameElementBefore'|
     'commentAfter'|'piAfter'|'textAfter'|'sameElementAfter' [ implicit_selection ]?)
    [ pi_target ]?

If option ends with `Into`, inserts node specified by beginning of option (`comment`, `pi`, `text`, `sameElement`) into:

- explicitly selected empty element

- OR element containing caret, at caret position.

If option ends with `Before` or `After`, inserts node specified by beginning of option (`comment`, `pi`, `text`, `sameElement`) before or after selected node.

`pi_target` may be used to specify the target of the processing instruction to be inserted (options `piInto`, `piBefore` or `piAfter`). By default, this target is the last one interactively specified using command editPITarget if any, and placeholder string "`target`" otherwise.

`pi_target` is ignored for node types other than processing instructions.

Examples:

    insertNode textBefore[implicitElement]
    insertNode textInto
    insertNode sameElementAfter[implicitElement]
    insertNode piInto
    insertNode piAfter[implicitNode] php

Prev | Up | Next
42. insertNewlineOrSplitBlock | Home | 44. insertOrOverwriteString