RTist models are stored in XML files (.emx and .efx). If you have ever opened such a file in a text editor you have probably noticed that code snippets stored in the model can be quite difficult to read due to the encoding of certain characters that is mandated by XML. Here is an example:




Some code snippets are stored as attributes in XML and they can look even worse, since newlines also will be encoded so that the whole code snippet appears on a single line:




Starting with RTist 11.0 2020.33 it’s now possible to set a preference so that code snippets will be saved in CDATA sections in the XML file. Thereby the code does not need to be escaped which greatly improves its readability. The preference is called Use CDATA when saving model files and is located on the Modeling preference page. In addition to code snippets, it also affects how documentation texts are stored.




After setting this preference, the code snippets in the examples above will look like this:






Note that older versions of RTist can still read model files that use CDATA. In that sense this feature is backwards compatible. Note, however, that if you edit and save the model in such an old tool version the code snippets will once again be stored without usage of CDATA. 

If you decide to start using CDATA in your model files it can be a bit tedious to manually re-save all files in the workspace to use the new format. To simplify you can run a model fixup which will automatically convert all your model files to use CDATA.




Watch this video for more information.

Comment wrap
Further Reading
Secure DevOps | September 2, 2022
RTist 11.2 2022.34
HCL RTist is a rule-based code translator for C/C++. The main feature of RTist is to produce readable, maintainable, and portable code.
Secure DevOps | November 29, 2021
What’s new in HCL RTist 11.1 2021.46
Today we ship another release of HCL RTist: 11.1 2021.46. As usual, there are several new features and a few bug fixes. Let's look at some of the highlights.
Secure DevOps | November 9, 2021
Writing a generic type descriptor with HCL RTist
Starting with HCL RTist 11.1 2021.24 it's now possible to write a generic type descriptor that uses the same template parameters as the type. This can save a lot of time and avoid code duplication.
Filters result by