2.38 :select()

This method moves the XML Cursor in a given direction or to the first node of the DOM tree that matches a given pattern.

Definition

boolean :select
(
  anyvalue DirectionOrPattern input
)

Parameters

anyvalue DirectionOrPattern input

This parameter may have one of these data types:

enum DirectionOrPattern input

When the parameter has the data type enum, it specifies in which direction the XML Cursor is moved within the DOM tree.

Value range

select_document

The XML Cursor is set to the document. The XML Cursor does not necessarily reference a DOM node yet.

select_first

The XML Cursor is set to the first DOM node, which matches the pattern that has been searched for last.

select_first_child

The XML Cursor is set to the first direct child node.

select_first_sibling

The XML Cursor is set to the first DOM node of the same parent.

select_last

The XML Cursor is set to the last DOM node, which matches the pattern that has been searched for last. This operation searches for the respective DOM node.

select_last_child

The XML Cursor is set to the last direct child node. This operation searches for the respective DOM node.

select_last_sibling

The XML Cursor is set to the last DOM node of the same parent. This operation searches for the respective DOM node.

select_next

The XML Cursor is set to the next DOM node, which matches the pattern that has been searched for last.

select_prev

The XML Cursor is set to the previous DOM node, which matches the pattern that has been searched for last.

select_next_sibling

The XML Cursor is set to the next DOM node of the same parent.

select_prev_sibling

The XML Cursor is set to the previous DOM node of the same parent.

select_root

The XML Cursor is set to the root node of the DOM tree. This is the initial value of an XML Cursor. The XML Cursor does not necessarily reference a DOM node yet.

select_up

The XML Cursor is set to the parent node.

string DirectionOrPattern input

When the parameter has the data type string, it specifies a pattern. The XML Cursor is set to the first node of the DOM tree that matches the pattern. The pattern is stored, so that subsequent calls of :select with the arguments select_first, select_last, select_next and select_prev move the XML Cursor to further DOM nodes that match the pattern.

The pattern syntax is described in chapter “Pattern for the Methods :match() and :select()” of manual “XML Interface”.

Return value

The method returns true, when the XML Cursor could be moved, false otherwise.

In case of an error the XML Cursor remains pointing to the same DOM node as before the method call.

Please note that an XML Cursor, whose attribute .mapped possesses the value false, will automatically be positioned to the root of the DOM Document.

Objects with this method

doccursor