3. Reading and writing a dataset

A dataset is plain text, so it can be read and written with any text editor. An editor with XML support makes this easier: it indents and folds the hierarchy and, depending on the editor, checks the dataset against the schema while it is written and suggests the elements that may follow. Examples are Visual Studio Code with an XML extension, Notepad++ with its XML Tools plugin, and XML Notepad.

Between editing by hand and the automated process chain described below lies the TiGL Creator, the graphical user interface of TiGL. It shows the geometry of a dataset in 3D next to its hierarchy, so that the effect of the data can be inspected directly, and selecting a component in one selects it in the other. It also creates new datasets from templates and changes components such as wings and fuselages through dialogs, e.g. their sweep or dihedral, and writes the result back as a CPACS dataset.

In a process chain, reading and writing is automated. A dataset passes through many tools, and each of them reads the part it needs in a pre-processing step and writes its results back in a post-processing step. These steps call libraries through their programming interfaces (APIs): TiXI for reading and writing the data, TiGL for the geometry, or general XML libraries such as libxml2 or lxml. Unlike the TiGL Creator, which is operated by hand, the libraries are used from within the program of the tool.

(a) An editor window with the file aircraft.xml being written: the lines are indented by hierarchy, the header and the wings are folded, at the cursor a list suggests the elements the schema allows there (analyses, configurationDefinitions, description, ducts), and the status bar reports that the dataset is valid against cpacs_schema.xsd. (b) The TiGL Creator: on the left a 3D view of the airliner with its main wing highlighted, on the right fields for the sweep and the dihedral of the wing above the CPACS tree, in which the main wing is selected. (c) A process chain: an arrow leads from the CPACS dataset to a tool, e.g. aerodynamics, consisting of pre-processing (reads the part it needs), analysis code (own input and output) and post-processing (writes the results back); below them a bar of libraries called through their APIs (TiXI, TiGL, libxml2, lxml), connected to pre- and post-processing only; further tools are stacked behind it, and an arrow leads back to the same dataset, which the next tool reads

Figure (a) shows a dataset being written in an editor: the hierarchy is indented and partly folded, the editor suggests the elements the schema allows at the cursor, and the status bar reports that the dataset follows the schema. Figure (b) shows the TiGL Creator with the main wing selected: it is highlighted in the 3D view on the left and in the tree on the right, and its sweep and dihedral can be changed in the fields above the tree. Figure (c) shows one tool of a process chain: its pre-processing reads the part of the dataset it needs, the analysis code works with its own input and output, and the post-processing writes the results back into the same dataset, which the next tool then reads. Only pre- and post-processing call the libraries; the analysis code does not need to know CPACS.

Whether a dataset is edited by hand or by a tool, the following rules make sure that each tool understands what the others wrote and that no data gets lost on the way. They apply to every element of the schema, independently of the language or library a tool uses.

Structure and values

Keeping the data of other tools

Recording changes

The <header> keeps the history of a dataset. Each <versionInfo> describes one version, identified by its @version according to Semantic Versioning, and header/version names the current one; it has to match the @version of one of the <versionInfo> elements. Each <versionInfo> also records in <cpacsVersion> the CPACS version that this version of the dataset follows, and the dataset is validated against the schema of the CPACS version of its current version.

<header>
    <name>Short-range airliner</name>
    <version>1.0.0</version>
    <versionInfos>
        <versionInfo version="1.0.0">
            <creator>Aircraft design team</creator>
            <timestamp>2026-10-01T12:00:00</timestamp>
            <description>Initial sizing</description>
            <cpacsVersion>3.5</cpacsVersion>
            <changeLog>
                <logEntry>
                    <description>Wing span increased to 34.1 m to meet the take-off field length</description>
                    <timestamp>2026-10-01T14:30:00</timestamp>
                    <creator>Wing sizing tool</creator>
                </logEntry>
            </changeLog>
        </versionInfo>
    </versionInfos>
</header>
Change recorded by a tool in the log of the current version

Common mistakes

The following mistakes occur most often in practice: