XML_PROCESS_TO_DOM

Use the XML_PROCESS_TO_DOM script function to convert a data sequence whose content displays an XML structure to an XML document. You can process the document with the corresponding XML script functions.

Tip: There are several script functions that let you create, process and fill data sequences. For more information, see Script Elements for Data Sequences.

Syntax

XML_PROCESS_TO_DOM (Data sequence reference)

Script Function and Parameters

  • XML_PROCESS_TO_DOM
    Creates an XML document from a data sequence.

  • Data sequence reference
    Reference to the data sequence that should be converted into an XML document
    Format: script variable

Return Codes

This script function returns the reference to the resulting XML document. If the data sequence does not contain an XML code, a runtime error occurs.

Examples

The following example saves the content of an XML file as a data sequence. In addition, the data sequence is converted into an XML document and the names of all of the elements, and their child elements are logged in the activation report using a while loop.

:SET &HND# = PREP_PROCESS_FILE(WIN01,"C:\AE\UserInterface\bin\uc4config.xml")

:SET &XML# = XML_PROCESS_TO_DOM(&HND#)
:SET &ELEMENT# = XML_GET_FIRST_CHILD(&XML#)

:WHILE &ELEMENT# <> ""
: SET &NAME# = XML_GET_NODE_NAME(&ELEMENT#)
: P "XML element: &NAME#"
: SET &CHILDS# = XML_GET_CHILD_COUNT(&ELEMENT#)

: IF &CHILDS# > 0
: SET &SUBELEMENT# = XML_GET_FIRST_CHILD(&ELEMENT#)
: WHILE &SUBELEMENT# <> ""
: SET &NAME# = XML_GET_NODE_NAME(&SUBELEMENT#)
:"XML child element: &NAME#"
: SET &SUBELEMENT# = XML_GET_NEXTSIBLING(&SUBELEMENT#)
: ENDWHILE
: ENDIF

: SET &ELEMENT# = XML_GET_NEXTSIBLING(&ELEMENT#)
:ENDWHILE

Example of the output in the activation report:

2023-05-21 12:17:45 - U0020408 Name: paths

2023-05-21 12:17:45 - U0020408 Child name: docu

2023-05-21 12:17:45 - U0020408 Child name: logging

2023-05-21 12:17:45 - U0020408 Child name: trace

2023-05-21 12:17:45 - U0020408 Child name: tcpip_keepalive

2023-05-21 12:17:45 - U0020408 Child name: tcp_nodelay

2023-05-21 12:17:45 - U0020408 Child name: SendBufferSize

2023-05-21 12:17:45 - U0020408 Child name: RecvBufferSize

2023-05-21 12:17:45 - U0020408 Name: colors

2023-05-21 12:17:45 - U0020408 Child name: color

2023-05-21 12:17:45 - U0020408 Child name: color

2023-05-21 12:17:45 - U0020408 Child name: color

2023-05-21 12:17:45 - U0020408 Child name: color

2023-05-21 12:17:45 - U0020408 Child name: color

2023-05-21 12:17:45 - U0020408 Child name: color

2023-05-21 12:17:45 - U0020408 Child name: color

2023-05-21 12:17:45 - U0020408 Child name: color

2023-05-21 12:17:45 - U0020408 Name: timeout

2023-05-21 12:17:45 - U0020408 Name: connections

2023-05-21 12:17:45 - U0020408 Child name: connection

2023-05-21 12:17:45 - U0020408 Child name: connection

See also: