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.

Comments

The script function identifies any element in the XML document.

A handle must be given to the script function to position to an element. This element is the starting point for searching the structure. From here, the element whose specified path was registered is searched for.

Specific script elements use handles to position themselves within the XML document, and to edit it. The very first handle is the one that is returned by XML_OPEN. It refers to the root element. It may be used by XML_SELECT_NODE to directly identify an element. The script function can also receive its handle from XML_GET_FIRST_CHILD or XML_GET_NEXTSIBLING. This shows that there are several ways of accessing elements in ramified structures.

Keep in mind that only elements that are sub-elements of the starting point may be found.

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:

Script Elements - Read or Modify Objects

Structured Documentation

www.w3c.org/TR/xmlbase

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function