# Cain XML File Format

Cain files store the models, methods, simulation output, and random number states. Below is the overall structure of a Cain file. The required elements are shown in black; the optional elements are colored grey.

      <?xml version="1.0" encoding="utf-8"?>
      <cain version="Number">
        <listOfModels>
          One or more <model> elements.
        </listOfModels>
        <listOfMethods>
          One or more <method> elements.
        </listOfMethods>
        <listOfOutput>
          One or more output elements.
        </listOfOutput>
        <random>
          Zero or more <stateMT19937> elements.
        </random>
      </cain>

In the next few sections we will describe each of the top-level elements. Each element attribute has one of the following formats:

- An Identifier is a string that starts with an underscore or a letter and is composed entirely of underscores, letters and digits. See the Species Editor section for details.
- A String is an arbitrary string (sequence of characters). These are used for descriptive names.
- Boolean is either "true" or "false".
- Integer is a 32-bit unsigned integer.
- Number is a floating-point number.
- PythonExpression is a Python expression. If you use functions from the math package, don't use the "math." qualification, i.e. write "floor(exp(5))" instead of "math.floor(math.exp(5))". See the discussion of initial amounts in the Species Editor section for more information.
- C++Expression is a C++ expression. See the Reaction Editor section for details.