CML Reference

Nodes

Node Possible children Required attributes Optional attributes
character (root) attribute, category, item name
attribute attribute, category, option name, value, type apiname, min, max, round, comment
category attribute, item, category name comment
item attribute, item name quantity, comment
option none value comment

Character

The <character> node is the root node of the document and has a required name attribute.

Attribute

The <attribute> node is the main node and describes attributes of a character or an item. It represents a key-value pair and has three required XML attributes.

  1. Name
  2. Value
  3. Type

The type attribute defines how the value of the key-value pair should be validated and/or edited. type can have the following values.

  1. int
  2. calcint
  3. float
  4. calcfloat
  5. string
  6. enum

When type is of int or float, the optional attributes min and max can be used to limit possible values.

Attribute nodes can have one or more API names. In constrast to attribute names, API names may only consist of lower-case characters (a-z) and/or underscores ("_") and must be unique within each character. API names can be used by third-party applications to find attributes relevant to their logic independent of the character sheet language or wording. An attribute node's API names are given in its apiname XML attribute, separated by spaces.

When type is of calcint or calcfloat, the attribute node's value attribute holds a formula to calculate this attribute's actual value. This formula may include other attribute's API names which will then be replaced by its actual value before calculation. If type is calcint, the round attribute must be defined. Then, the result is rounded towards positive infinity for round="up" and towards negative infinity for round="down". For round="halfup" and round="halfdown", the result is always rounded to the nearest integer while behaving like round="up" or round="down" for ties.

Example (valid):

<character name="Shrek">
          <attribute name="Strength" type="int" value="6" min="1" max="10" apiname="str"/>
            <attribute name="Double Strength" type="calcint" value="2*str" round="halfup" />
            </character>
            

Example (invalid):

<character name="Shrek">
  <attribute name="Strength" type="int" value="11" min="1" max="10" />
</character>

Category

Categories can be used to group attributes and items for display. They have no logical meaning.

Example:

<character name="Rambo">
  <category name="Physical">
    <attribute name="Strength" type="int" value="11" />
    <attribute name="Dexterity" type="int" value="11" />
  </category>
  <category name="Mental">
    <attribute name="Intelligence" type="int" value="1" />
    <attribute name="Charisma" type="int" value="1" />
  </category>
  <category name="Weapons">
    <item name="M60" />
    <item name="Pistol" />
  </category>
</character>

Item

Items are not as closely tied to a character as attributes. They have a name and can have an integer quantity with a minimum of zero. If no quantity is given, quantity="1" is assumed.

Items can also have attributes that describe the item in more detail.

Example:

<character name="Shrek">
  <item name="Gold" quantity="42" />
  <item name="Sword" >
    <attribute name="Damage" type="string" value="1D6+1"/>
  </item>
</character>

Option

When an attribute's type is enum, possible values are the values of the attribute's option children.

Example (valid):

<character name="Shrek">
  <attribute name="race" type="enum" value="Orc">
    <option value="Human" />
    <option value="Elf" />
    <option value="Dwarf" />
    <option value="Orc" />
  </attribute>
</character>

Example (invalid):

<character name="Shrek">
  <attribute name="race" type="enum" value="Orc">
    <option value="Human" />
    <option value="Elf" />
    <option value="Dwarf" />
  </attribute>
</character>

Comment

The comment attribute may be added to any node to indicate a short comment for the reader. Line-breaks must be written as <br/>.