Extensible Markup Language (XML) is a very simple language for reading and writing data storage, which is its greatest advantage over other database languages.

How to write an XML data file from 0, read the data in C++, and display it on QT.

First, we found a simple XML file to store the data required for rendering:

    

It’s easy to see what’s going on in there, except that the tags that you set in the XML file like Emission and Specular are missing. In the program, we need to record these information, such as Emission.R = 160, Specular.G = 120. So we must be able to programmatically read and write the XML files we design.

Using a browser to open an XML file:

   

We can see that the arrangement is very orderly. There are many child Nodes in each Node, and in each Node there are three data representations in addition to one Node: DensityScale, ShadingType, GradientFactor, each Node needs to be included with a start and an end: i.e., and <\Node> and <\Preset>.