XML_SELECT_NODE

Script Function: Identifies any element

Syntax

XML_SELECT_NODE (Reference, Element)

Syntax

Description/Format

Reference

Reference to the element that serves as starting point
Format: script literal or script variable

Element

Name of the element with path from the starting point
Format: script literal or script variable


Return codes

Reference to the searched element
" " - The searched element does not exist.

The script function identifies any element in the XML document. Specify a reference (handle) that identifies an element to use as the starting point of the search.

Handles let you identify and edit a position within the XML document. Use the following script functions to provide 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

Note: Only elements that are sub-elements of the starting point may be found.

Tip: Many Automation Engine scripting language elements for working with XML require you to provide a handle. Use XML_SELECT_NODE or the script functions listed in this topic to provide handles.

Example

The example identifies an element directly from the root element "Content" of the structured documentation. The text of the element "Objects" is output in the activation log.

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

:
SET &HND# = XML_SELECT_NODE(&XMLDOCU#, "Description/Objects")
:
SET &TEXT# = XML_GET_NODE_TEXT(&HND#)
:
PRINT "Text of the element: &TEXT#"

:
XML_CLOSE

See also: