83. selectNode
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 83. selectNode

Parameter syntax:

    'parent' | 'child' |
    'firstChild' | 'lastChild' | 'children' |
    'previousSibling' | 'nextSibling' |
    'firstSibling' | 'lastSibling' |
    'ancestor' | 'ancestorOrSelf' | 'self' |
    'descendant' | 'descendantOrSelf' |
    'preceding' | 'precedingOrSelf' |
    'following' | 'followingOrSelf' |
    'extendToPreviousSibling' | 'extendToNextSibling'
    [ 'OrNone' | 'OrNode' | 'OrElement' ]?
    [ implicit_selection ]?
    S [ element_name | '#text' | '#comment' | '#processing-instruction' ]*

A number of keystrokes are bound to this command. This command is also needed to write non-trivial macro-commands.

parent

  Selects parent of selected node.

child

  Selects previously selected child of selected node.

  If no child of selected node was previously selected, selects first child node of selected node.

firstChild

  Selects first child node of selected node.

lastChild

  Selects last child node of selected node.

children

  Selects all the child nodes of selected node.

previousSibling

  Selects preceding sibling of selected node.

nextSibling

  Selects following sibling of selected node.

firstSibling

  Selects first preceding sibling of selected node.

lastSibling

  Selects last following sibling of selected node.

self

  Selects selected node if selected node is an element, or parent element of selected node if selected node is a text. This option is mainly useful to test the name of implicitly or explicitly selected element.

ancestorOrSelf

  Selects ancestor of selected node, starting at selected node. Searched ancestor is specified using a list of names. See below.

  More precisely, lookup starts from selected node, if selected node is an element, or from parent element of selected node if selected node is a text, comment or processing-instruction node.

ancestor

  Selects ancestor of selected node, starting at parent of selected node. Searched ancestor is specified using a list of names. See below.

  More precisely, lookup starts from parent of selected node, if selected node is an element, or from grand-parent element of selected node if selected node is a text, comment or processing-instruction node.

  Note that `selectNode ancestor `one_or_more_element_names`` selects all the ancestors one after the other until it reaches the found ancestor. This is equivalent to interactively typing Ctrl+Up until the desired ancestor is selected. The idea behind that is to be able to use `selectNode ancestor `one_or_more_element_names`` followed by `selectNode child` or `selectNode descendant `one_or_more_element_names`` in the same macro-command.

descendant

  Selects previously selected descendant of selected node. Searched descendant is specified using a list of element names or node types. See below.

  If no descendants of selected node were previously selected, searches a descendant node along the first child axis.

descendantOrSelf

  Selects previously selected descendant of selected node. Searched descendant is specified using a list of element names or node types. See below.

  If no descendants of selected node were previously selected, searches a descendant node along the first child axis.

  Selected node itself can be explicitly selected if it corresponds to searched node.

precedingOrSelf

  Selects preceding sibling of selected node, starting at selected node. Searched sibling is specified using a list of names. See below.

preceding

  Selects preceding sibling of selected node, starting at sibling of selected node. Searched sibling is specified using a list of names. See below.

followingOrSelf

  Selects following sibling of selected node, starting at selected node. Searched sibling is specified using a list of names. See below.

following

  Selects following sibling of selected node, starting at sibling of selected node. Searched sibling is specified using a list of names. See below.

extendToPreviousSibling

  Extends node selection to following sibling of last selected node.

extendToNextSibling

  Extends node selection to preceding sibling of last selected node.

Examples:

    selectNode childOrNone
    selectNode parentOrNode
    selectNode children
    selectNode nextSibling[implicitElement]
    selectNode self section
    selectNode ancestorOrSelf[implicitElement] section sect5 sect4 sect3 sect2 sect1
    selectNode descendant {http://www.xmlmind.com/xmleditor/schema/configuration}template \
      {http://www.xmlmind.com/xmleditor/schema/configuration}css
    selectNode extendToPreviousSibling
    selectNode extendToNextSiblingOrElement

Prev | Up | Next
82. selectPrinter | Home | 83.1. List of element names or node types