ScriptEigener Objekttyp in der Automation Engine 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 |
Comments
This script function prepares the display of a XML document before it is written to an XML file with XML_PRINTINTOFILE.
A handle must be given to the script function to access an element. This handle is made available by script elements which can take position within the XML document - such as XML_GET_FIRST_CHILD, XML_GET_NEXTSIBLING or XML_SELECT_NODE. The script function beautifies this element including its sub-elements and corresponding attributes.
It is also possible to use the handle returned by XML_OPEN to prepare the display of the whole XML document.
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.
Examples
The complete structure of the documentation is edited to enable more comfortable reading, and then written to the file Docu.xml.
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:
Script element | Description |
---|---|
Writes the XML document in a file |
Script Elements - Read or Modify Objects
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function