XML_BEAUTIFY
Script Function: Beautifies the display of a XML document
Syntax
XML_BEAUTIFY (Reference)
| 
                                                     Syntax  | 
                                                
                                                     Description/Format  | 
                                            
|---|---|
| 
                                                     Reference  | 
                                                
                                                     Reference to a XML document whose issued structure is to be formatted 
   | 
                                            
| 
                                                     Return codes  | 
                                            
|---|
| 
                                                     "0" - The content of the XML document was successfully beautified  | 
                                            
This script function prepares the display of a XML document before it is written to an XML file with XML_PRINTINTOFILE. For more information, see XML_PRINTINTOFILE.
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:
The script function beautifies this element including its sub-elements and corresponding attributes. Without using XML_BEAUTIFY, all the information about a XML document is written to a file in a line (without line break). If you open this file with a text editor such as Notepad, the information is unintelligible.
Tip: You can also use the handle returned by XML_OPEN to prepare the display of the whole XML document. For more information, see XML_OPEN.
Examples
The complete structure of the documentation is edited to enable more comfortable reading, and then written to the file Docu.xml.
Note: For this example to work, a structured documentation tab with the name "@Details" has to be added to the object that is used with XML_OPEN.
:SET &XMLDOCU# = XML_OPEN(DOCU,"ON_CALL","@Details")
:SET &RET1# = XML_BEAUTIFY(&XMLDOCU#)
:SET &RET2# = XML_PRINTINTOFILE("C:\AUTOMIC\XML_Documentation\Docu.xml",&XMLDOCU#)
:XML_CLOSE
                                        
In the second example, the elements Description and Objects including their attributes are output in 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: