XML_GET_NODE_NAME

Use the XML_GET_NODE_NAME script function to read the name of an element in an XML document.

Important! This script function can only process 1024 characters. No return code is provided if the element name is too long.

Syntax

XML_GET_NODE_NAME (Reference)

Script Function and Parameters

  • XML_GET_NODE_NAME
    Retrieves the name of an element

  • Reference
    Reference to the element whose name should be identified
    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 supplies a reference of the first element. For more information, see XML_OPEN

Return Code

This script function returns the name of the element or no return code if you exceed 1024 characters, as this is the maximum number of characters you can use.

Example

The following example retrieves all elements of one level. Here, these names are 'Description' and 'Contacts', and they are written to the activation report.

Screenshot of the ON_CALL_SERVICES Calendar object which includes two elements of the same level in its Content structure called 'Description' and 'Contacts'

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

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

:   
WHILE &HND# <> ""
:      
SET &NAME# = XML_GET_NODE_NAME (&HND#)
:     
 PRINT "element: &NAME#"
:      
SET  &HND# = XML_GET_NEXTSIBLING (&HND#)
:  
 ENDWHILE  

:
XML_CLOSE

See also: