5. addLink
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 5. addLink

Parameter syntax:

    [ link_type [ S link_target ]? ]?

This command is unusable unless a link scheme is associated to the document being edited. This association is done by the means of a `linkScheme` configuration element in <ttl>XMLmind XML Editor - Configuration and Deployment</ttl>.

This command allows to create a link or to change the target of an existing link. More precisely:

1. If a link element is explicitly selected or if the caret is anywhere inside a link element, this command changes the target of this link element.

2. Otherwise, if a node or text range is selected, this command wraps the selection into a link element.

3. Otherwise, this command inserts a link element at caret position.

Parameter `link_type` may be used to specify the type of the link to be created.

Parameter `link_target` may be used to specify the target of the link to be created or the new target of the existing link which is to be modified by this command.

When parameter `link_target` is not specified, the Link tool in <ttl>XMLmind XML Editor - Online Help</ttl>[4] displays the list of all possible targets in order to let the user interactively choose one.

DITA topic examples:

    addLink
    addLink xref
    addLink xref reference/printf

[4] When the Link tool has not been enabled by checking "Enable the Link Tool" in Options → Preferences, Features section, this command displays a dialog box containing controls similar to those of the Link tool.

Prev | Up | Next
4. addBlockInFlow | Home | 6. autoSpellChecker