XML_PRINTINTOFILE

Script Function: Writes the structure of elements in an XML file

Syntax

XML_PRINTINTOFILE (File, Reference)

Syntax

Description/Format

File

Name and path of the XML file
Format: script literal or script variable

Reference

Reference to the element whose structure is to be given
Format: script literal or script variable


Return code

"0" - The structure was successfully written to the file.

The script function writes the structure of an element, including all sub-elements and corresponding attributes, into a specified XML file.

Important! Existing files are overwritten without any queries.

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:

Tips:

Example

The complete structure of the documentation is edited to enable more comfortable reading, and then written to the file "Docu.xml".

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

:
SET &RET1# = XML_BEAUTIFY(&XMLDOCU#)
:
SET &RET2# = XML_PRINTINTOFILE("C:\AUTOMIC\XML_Documentation\Docu.xml",&XMLDOCU#)

:
XML_CLOSE

The second example shows how the elements "Description" and "Objects" including their attributes may be output to a file.

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

:
SET &HND# = XML_GET_FIRST_CHILD(&XMLDOCU#)
:
SET &RET1# = XML_BEAUTIFY(&HND#)
:
SET &RET2# = XML_PRINTINTOFILE("C:\AUTOMIC\XML_Documentation\Docu.xml",&HND#)

:
XML_CLOSE

See also:

seealso

Script Functions for XML Elements