Automation Engine Script Guide > Ordered by Function > Data Sequences > XML_PROCESS_TO_DOM

XML_PROCESS_TO_DOM

Script function: Creates an XML document from a data sequence.

Syntax

XML_PROCESS_TO_DOM(data sequence reference)

Syntax part

Description/format

Data sequence reference

Reference to the data sequence that is to be converted into an XML document.
Format: script variable


Return codes

Reference to the resulting XML document

Notes

There are a number of different script elements available in the Automation Engine to create, process, and  fill data sequences. Data sequences whose content displays an XML structure can be converted into an XML document using the XML_PROCESS_TO_DOM script element. The document can be processed with script elements for XML processing (script elements whose names begin with XML).

If the data sequence does not contain an XML code, a runtime error occurs when XML_PROCESS_TO_DOM is executed.

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:

2013-11-21 12:17:45 - U0020408 Name: paths

2013-11-21 12:17:45 - U0020408 Child name: docu

2013-11-21 12:17:45 - U0020408 Child name: logging

2013-11-21 12:17:45 - U0020408 Child name: trace

2013-11-21 12:17:45 - U0020408 Child name: tcpip_keepalive

2013-11-21 12:17:45 - U0020408 Child name: tcp_nodelay

2013-11-21 12:17:45 - U0020408 Child name: SendBufferSize

2013-11-21 12:17:45 - U0020408 Child name: RecvBufferSize

2013-11-21 12:17:45 - U0020408 Name: colors

2013-11-21 12:17:45 - U0020408 Child name: color

2013-11-21 12:17:45 - U0020408 Child name: color

2013-11-21 12:17:45 - U0020408 Child name: color

2013-11-21 12:17:45 - U0020408 Child name: color

2013-11-21 12:17:45 - U0020408 Child name: color

2013-11-21 12:17:45 - U0020408 Child name: color

2013-11-21 12:17:45 - U0020408 Child name: color

2013-11-21 12:17:45 - U0020408 Child name: color

2013-11-21 12:17:45 - U0020408 Name: timeout

2013-11-21 12:17:45 - U0020408 Name: connections

2013-11-21 12:17:45 - U0020408 Child name: connection

2013-11-21 12:17:45 - U0020408 Child name: connection

 

See also:

Script element Description
XML_DOM_TO_PROCESS Creates a data sequence from an XML document.