start portlet menu bar

HCLSoftware: Fueling the Digital+ Economy

Display portlet menu
end portlet menu bar
Close
Select Page

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:

 

code_snippet_in_xml

 

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:

 

code_snippet_in_xml2

 

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.

 

CDATA_preference

 

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

 

code_snippet_in_xml_cdata

 

code_snippet_in_xml2_cdata

 

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.

 

model_fixup_cdata

 

Watch this video for more information.

Comment wrap
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
HCL release of HCL RTist: 11.1 2021.46. As usual, there are several new features and a few bug fixes. Read more to know some highlights.
Secure DevOps | November 9, 2021
Writing a generic type descriptor with HCL RTist
Type descriptor provides Metadata about a user-defined type in the model, such as a class, typedef, or type alias. Read to know more.