Message Transformation
CXIO messages can be easily transformed into other data formats such as XML, JSON, EDIFACT and more. This is achieved using the type command and directive as explained within this guide.
In the example below, the info test message contains an item named "hello" with the value of "world". Within the into directive, a type of xml has been specified meaning that the message will be transformed to XML upon execution.
info test hello: "world" into disk path "c:\cxio\test.xml" type xml ends ends
Executing the above command will result the following XML file named "test.xml" being created.
<test> <hello>world</hello> </test>test.xml
Format Properties
It is possible to override the default properties of the format using with or meta shorthand (@) values within the type directive.
In the example below, the info test message contains an item named "hello" with the value of "world". Within the into directive, a type of xml has been specified meaning that the message will be transformed to XML upon execution.
info test hello: "world" into console type xml with indentation as false ends ends ends
Executing the above command will result the following XML file named "test.xml" being output to the console.
<test><hello>world</hello></test>test.xml
Custom Formatters
We can define our own custom types with default settings using the type directive, as shown below.
type myxml base xml @indentation: false ends
In the example below, we can now use myxml to produce the same output as previous examples.
info test hello: "world" into console type myxml ends ends
Custom formatters can be removed from memory by using the drop directive.
drop type myxml