XML_GET_NODE_TEXT

Use the XML_GET_NODE_TEXT script function to read an element's text in an XML document. There is no limit for the returned value.

Tip: Use the XML_GET_ATTRIBUTE to retrieve the content of a text attribute. For more information, see XML_GET_ATTRIBUTE.

Syntax

XML_GET_NODE_TEXT (Reference)

Script Function and Parameters

  • XML_GET_NODE_TEXT
    Retrieves the text of an element

  • Reference
    Reference to the element with the text to be retrieved.
    Format: script literal or script variable
    Tips:

    • You must provide a reference, a handle to the script function to access the element. Use a script function that takes position within the XML document to provide the handle. The following are examples of script elements that you can use for this purpose:

    • XML_OPEN returns a reference of the first element. For more information, see XML_OPEN

Return Code

This script function returns the text of the element or " " if there is no text.

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 intents to retrieve the text that the 'Objects' sub-element includes.

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

:
SET &HND# = XML_GET_FIRST_CHILD (&XMLDOCU#)
:
SET &HND# = XML_GET_FIRST_CHILD (&HND#)

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

:
WHILE &HND# <> ""
:    
  SET &NAME# = XML_GET_NODE_NAME(&HND#)
:      
SET &TXT# = XML_GET_NODE_TEXT(&HND#)
:     
 PRINT "Text of the element &NAME#: &TXT#"
:      
SET &HND# = XML_GET_NEXTSIBLING(&HND#)
:
ENDWHILE  

:
XML_CLOSE

The activation report shows the name of the 'Objects' sub-element including its text:

Screenshot of the activation report that includes the sub-element 'Objects' and its corresponding text 'Related Objects'.

See also: