XML_SELECT_NODE

Use the XML_SELECT_NODE script function to identify any element in the XML document. Specify a reference that identifies an element that should be used as the search's starting point.

Syntax

XML_SELECT_NODE (ReferenceElement)

Parameters

Parameter Description Format
Reference

Reference to the element that serves as the starting point.

Tips: References or handles let you identify and edit a position within the XML document. You can use the following script functions to retrieve handles:

  • XML_OPEN: Returns the very first handle, which refers to the root element. Use XML_SELECT_NODE with this handle to directly identify an element.
  • XML_GET_FIRST_CHILD: Returns the handle of the first sub-element of an element.
  • XML_GET_NEXTSIBLING: Returns the handle of the next element on the same level in the XML document.
Script literal or script variable
Element

Name of the element including the path from the starting point.

Note: This script function can only find elements that are sub-elements of the starting point.

Script literal or script variable

Return Codes

This script function returns the reference to the element you search or an empty string if the searched element does not exist.

Examples

The following example assumes that the ON_CALL_SERVICES Calendar object has a content structure that includes the element 'Description' with a sub-element called 'Objects'. The script intends to retrieve the first element directly from the 'Content' root element of the @Details structured documentation page. The text that the 'Objects' sub-element includes is printed in the activation report:

:SET &XMLDOCU# = XML_OPEN(DOCU, "ON_CALL_SERVICES""@Details")

:SET &HND# = XML_SELECT_NODE(&XMLDOCU#"Description/Objects")

:SET &NODETEXT# = XML_SET_NODE_TEXT(&HND#,"Related Objects")

:SET &TEXT# = XML_GET_NODE_TEXT(&HND#)

:PRINT "Text of the element: &TEXT#"

:XML_CLOSE

The activation report shows the text that the 'Objects' sub-element includes:

Screenshot of the activation report that shows the text "Related Objects" of the selected sub-element of the ON_CALL_SERVICES Calendar object.

See also: