XML_GET_NODE_NAME
Script Function: Supplies the name of an element
Syntax
XML_GET_NODE_NAME (Reference)
Syntax |
Description/Format |
---|---|
Reference |
Reference to the element whose name is to be identified |
Return code |
---|
Name of the element |
This script function may be used to read the name of an element in an XML document.
Important! This script function can only process 1024 characters. If you exceed this limit, no return code is supplied. Adhere to the limit when assigning element names.
Note: You must provide 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:
Tip: XML_OPEN supplies a reference of the first element. For more information, see XML_OPEN.
Example
This example shown below retrieves all elements of one level. Their names "Description" and "Contacts" are output in the activation log.
:SET &XMLDOCU# = XML_OPEN(DOCU,"ON_CALL","@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: