# DMSObjDef XML Format

The DMSObjDef format describes the complete object definition of a enaio® system.
It contains all cabinets (archives), object types and their fields including layout,
control and validation properties.

The associated schema file is `DMSObjDef.xsd`.

> **Warning:** The `DMSObjDef.xsd` is outdated and no longer reflects the complete state of enaio® object definitions. Attributes and elements present in real-world object definitions may be missing from or differ in the XSD. This documentation may therefore be incomplete.

## Usage

The DMSObjDef format is used by the following jobs:

| Job | Description |
|---|---|
| [dms.GetObjDef](../dms.md#dms.GetObjDef) | Returns the complete object definition of the system as XML |
| [dms.GetXMLSchema](../dms.md#dms.GetXMLSchema) | Returns the schema file `DMSObjDef.xsd` (`Schema=DMSObjDef`) |

## XML Structure

```xml
<asobjdef version="5.00" created="2024-01-01T00:00:00" limited_objects="0">
  <languages>
    <language lang_id="1" active="1" name="de_DE"/>
  </languages>
  <cabinet cotype="0" name="Patient Record" internal="patient_cabinet">
    <object maintype="1" cotype="0" tablename="object1"
            name="Folder" internal="folder" iconid="0"
            os_guid="..." compressionflags="0" historyflags="0">
      <names>
        <name lang_id="1">Folder</name>
      </names>
      <fields>
        <field name="Last Name" internal="last_name" os_guid="..." taborder="1">
          <names>
            <name lang_id="1">Last Name</name>
          </names>
          <flags dt="A" flags="0" flags1="0" flags2="0"
                 control_type="edit" datatype="text" align="left"
                 required="0" readonly="" multifield="0"/>
          <field_pos top="0" left="0" right="200" bottom="20"/>
          <input_pos top="0" left="100" right="400" bottom="20"/>
        </field>
      </fields>
      <ids oid="196616" pid="0" vid="0"/>
      <frame top="0" left="0" right="800" bottom="600"/>
      <multiframe height="600" width="800"/>
    </object>
  </cabinet>
</asobjdef>
```

## Elements and Attributes

### `<asobjdef>` — Root Element

| Attribute | Type | Required | Description |
|---|---|---|---|
| `created` | dateTime | Yes | Creation timestamp of the object definition |
| `version` | String | No | Schema version (default: `5.00`) |
| `limited_objects` | Short | No | `1` = object definition contains restricted objects; default: `0` |

### `<languages>` / `<language>`

Lists all languages configured in the system.

| Attribute | Type | Required | Description |
|---|---|---|---|
| `lang_id` | Long | Yes | Numeric language ID |
| `active` | Short (0–2) | Yes | Activation status: `0` = inactive, `1` = active, `2` = default |
| `name` | Name | Yes | Language identifier (e.g. `de_DE`, `en_US`) |

### `<cabinet>` — Cabinet (Archive)

An `<asobjdef>` contains zero or more `<cabinet>` elements.

| Attribute | Type | Required | Description |
|---|---|---|---|
| `name` | String (1–100) | Yes | Display name of the cabinet |
| `cotype` | Short | Yes | Internal cabinet type |
| `internal` | String | No | Internal name of the cabinet |

### `<object>` — Object Type

Each cabinet contains at least one `<object>` entry.

| Attribute | Type | Required | Description |
|---|---|---|---|
| `name` | String (1–100) | Yes | Display name of the object type |
| `internal` | String | No | Internal name of the object type |
| `tablename` | NMTOKEN | Yes | Database table name of the object (e.g. `object1`) |
| `extablename` | String | No | Name of the extended database table |
| `os_guid` | String | Yes | Globally unique identifier of the object type |
| `maintype` | Short | Yes | Main type of the object type. Value range and meaning: see Object Type ID. |
| `cotype` | Short | Yes | Subtype of the object type (lowword of the object type ID). See Object Type ID. |
| `iconid` | Long | Yes | ID of the custom icon (`0` = default icon) |
| `compressionflags` | Long | Yes | Compression settings (bitmask) |
| `historyflags` | Long | Yes | History settings (bitmask) |
| `no_dias` | Short | No | `1` = no slideshow support; default: `0` |
| `reference` | Short | No | `1` = reference object type; default: `0` |
| `fulltext` | Short | No | `1` = full-text indexing enabled; default: `0` |
| `apply_security` | Short | No | `1` = security system active; default: `0` |
| `multidoc` | Short | No | `1` = multi-document type; default: `0` |
Sub-elements of `<object>`:

| Element | Description |
|---|---|
| `<names>` | Multilingual display names — one `<name lang_id="...">` per language |
| `<fields>` | List of index fields for the object type (`<field>` elements) |
| `<ids>` | Internal type IDs: `oid` (object ID), `pid` (parent ID), `vid` (version ID) |
| `<frame>` | Size and position of the input mask (attributes: `top`, `left`, `right`, `bottom`) |
| `<multiframe>` | Size of the multi-frame area (attributes: `height`, `width`) |
| `<limited_objects>` | Restricted subtypes (`<limited_object type="..." count="...">`) |

### `<field>` — Index Field

Describes a single index field of an object type.

| Attribute | Type | Required | Description |
|---|---|---|---|
| `name` | String (1–100) | Yes | Display name of the field |
| `internal` | String | No | Internal field name |
| `fieldname` | Name | No | Database column name |
| `os_guid` | String | Yes | Globally unique identifier of the field |
| `taborder` | Long | Yes | Tab order in the input mask |
| `tooltip` | String | No | Tooltip text |
| `prnalias` | String | No | Print label (alias for reports) |
| `classstring` | String | No | CSS class identifier for UI control |
| `init` | String | No | Initialisation expression |
Sub-elements of `<field>`:

| Element | Description |
|---|---|
| `<names>` | Multilingual field labels |
| `<ids>` | Internal field IDs (optional) |
| `<flags>` | Field properties (data type, control, validation — see below) |
| `<field_pos>` | Position of the field label in the mask (`top`, `left`, `right`, `bottom`) |
| `<input_pos>` | Position of the input control in the mask (`top`, `left`, `right`, `bottom`) |
| `<init>` | Initialisation: `func` (function ID), `init_type` (`const`, `func` or `mask`) |
| `<list>` | Value list for list controls (`rawdata`, `extra`, `row` entries) |
| `<listctrl>` | Column definition for grid controls |
| `<page>` | Page view of the field (contains a further `<field>` of type `fieldType`) |

#### `<flags>` — Field Properties

| Attribute | Type | Default | Description |
|---|---|---|---|
| `dt` | osdatatype | — | Data type of the field (see <<dms-objdef-osdatatype,Field Data Types>>) |
| `flags` | Long | — | Internal field flags (bitmask) |
| `flags1` | Long | — | Extended field flags 1 (bitmask) |
| `flags2` | Long | — | Extended field flags 2 (bitmask) |
| `control_type` | controltype | `edit` | Control type (see <<dms-objdef-controltype,Control Types>>) |
| `datatype` | contenttype | `text` | Content data type (see <<dms-objdef-contenttype,Content Types>>) |
| `align` | aligntype | `left` | Text alignment: `left`, `right` or `center` |
| `readonly` | readonlytype | — | Write-protection mode (see <<dms-objdef-readonlytype,Read-only Types>>) |
| `required` | Short | `0` | `1` = mandatory field |
| `multifield` | Short | `0` | `1` = multi-value field |
| `zeropad` | Short | `0` | `1` = pad with leading zeros |
| `constraints` | constraintype | `none` | Input constraint (see <<dms-objdef-constraintype,Constraint Types>>) |
| `input_length` | Long | `0` | Maximum input length in characters (`0` = unlimited) |
| `crosscheck` | Short | `0` | `1` = cross-check against list values active |
| `color` | String | — | Field text colour (HTML colour value) |
| `case` | Short | `0` | Case rule: `0` = none, `1` = uppercase, `2` = lowercase |

## Type Definitions

### Field Data Types (`osdatatype`)

| Value | Meaning |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| `A` | Alphanumeric (variable length) | `C` | Single character | `D` | Date | `F` | Decimal number | `G` | Internal type | `I` | Integer | `K` | Internal type | `L` | List | `M` | Memo (multi-line text) | `Q` | Internal type | `S` | String (fixed length) | `T` | Time | `V` | Internal type | `W` | W-document type reference | `X` | Internal type | `Z` | Internal type | `0`, `1`, `9`, `#` | Internal special types |

### Control Types (`controltype`)

| Value | Meaning |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| `edit` | Single-line input field (default) | `textarea` | Multi-line input field | `static` | Read-only display | `checkbox` | Checkbox | `radio` | Radio button | `list` | List box (dropdown) | `dblist` | Database-linked list | `tree` | Tree view | `hierarchy` | Hierarchy control | `structure` | Structure field | `grid` | Grid control (table fields) | `pagecontrol` | Tab control (page tabs) | `addon` | Extension module |

### Content Types (`contenttype`)

| Value | Meaning |  |  |  |  |  |  |  |  |  |  |  |  |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| `text` | Text (default) | `date` | Date | `dec` | Decimal number | `num` | Integer | `bitmap` | Image | `group` | Group | `upper` | Text (automatic uppercase) |

### Read-only Types (`readonlytype`)

| Value | Meaning |  |  |  |  |  |  |  |  |
|---|---|---|---|---|---|---|---|---|---|
| _(empty)_ | No write protection — field is editable | `supervisor` | Writable by supervisors only | `arch` | Read-only after archiving | `init` | Writable only during initial entry | `always` | Always read-only (display only) |

### Constraint Types (`constraintype`)

| Value | Meaning |  |  |  |  |  |  |  |  |  |  |  |  |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| `none` | No constraint (default) | `mask` | Input mask (format enforced) | `uppercase` | Input automatically converted to uppercase | `gender` | Gender specification | `direction` | Direction specification | `patient` | Patient-specific input | `question` | Question format |
