Script Function: Supplies the name of an element
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.
This script function requires a reference to be able to access the element. This reference is provided by script elements which can position within the XML document (e.g. XML_GET_FIRST_CHILD, XML_GET_NEXTSIBLING, or XML_SELECT_NODE).
XML_OPEN supplies a reference of the first element.
This script function can only process 1024 characters. Exceeding this limit has the effect that no return code is supplied. Keep this in mind when assigning element names.
This example shown below retrieves all elements of one leve. 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:
Script element | Description |
---|---|
Supplies the text of an element |
Script Elements - Read or Modify Objects
About Scripts
Script Elements - Alphabetical Listing
Script-Elements - Ordered by Function