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

## 37. 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 placeholder string "`target`", which can be modified using command editPITarget.

`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
36. insertControlCharOrSplit | Home | 38. insertOrOverwriteString