# DMSContent XML Format

The DMSContent format is the primary output format of the enaio® server for search results and object retrievals.
It is returned by the research and retrieval jobs of the DMS engine.

The corresponding schema file is `DMSContent.xsd`.

The format can be in **LOL** (linear hit list), **HOL** (hierarchical object list)
or **MIXED** (combination of both) — controlled by the `format` attribute on the root element.

## Usage

The DMSContent format is returned by the following jobs:

| Job | Format | Description |
|---|---|---|
| [dms.GetResultList](../dms.md#dms.GetResultList) | LOL / HOL / MIXED | Primary research job — returns hit lists from search queries |
| [dms.GetObjectDetails](../dms.md#dms.GetObjectDetails) | HOL | Returns complete index data for one or more objects |
| [dms.ExecuteStoredQuery](../dms.md#dms.ExecuteStoredQuery) | LOL / HOL | Executes a stored search query |
| [dms.GetUserTrayObjects](../dms.md#dms.GetUserTrayObjects) | HOL | Returns typeless objects from the user tray (contains `<TypelessObjects>`) |
| [dms.GetWorkflowObjects](../dms.md#dms.GetWorkflowObjects) | HOL | Returns objects from the workflow tray |
| [dms.GetDeletedObjects](../dms.md#dms.GetDeletedObjects) | HOL | Returns deleted objects |
| [dms.GetForeignObjects](../dms.md#dms.GetForeignObjects) | HOL | Returns linked objects from other archives |
| [dms.GetShadowData](../dms.md#dms.GetShadowData) | HOL | Returns index data in HOL format |

## Output Formats (LOL vs. HOL)

The `format` attribute on the `<DMSContent>` element determines the internal structure of the results:

| Value | Format | Structure within `<ObjectType>` | `LOL` | List of Lists | `<Rowset>` with `<Columns>` (field definitions) + `<Rows>` (hit values) — tabular | `HOL` | Hierarchical Object List | `<ObjectList>` with `<Object>` elements containing `<Fields>`, `<BaseParams>` etc. | `MIXED` | Combination | Contains both `<Rowset>` and `<ObjectList>` structures |
|---|---|---|---|---|---|---|---|---|---|---|---|

### LOL — Linear Hit List

The LOL structure is the compact tabular format: columns are defined once,
then the hit rows follow. Suitable for large result sets and simple fields.

```xml
<DMSContent format="LOL" version="5.00" timestamp="2024-03-15T10:30:00"
            user="admin" station="PC01">
  <Archive id="1" internal_name="patient">
    <ObjectType id="5" internal_name="medical_letter" type="DOCUMENT" modul="WINDOWS">
      <Rowset>
        <Columns>
          <Column internal_name="date" dbname="D001" type="DATE" ostype="DATE">Date</Column>
          <Column internal_name="subject" dbname="D002" type="TEXT" ostype="TEXT">Subject</Column>
          <Column internal_name="physician" dbname="D003" type="TEXT" ostype="TEXT">Physician</Column>
        </Columns>
        <Rows>
          <Row id="9823">
            <Value>2024-03-15</Value>
            <Value>Discharge letter</Value>
            <Value>Dr. Müller</Value>
          </Row>
          <Row id="9824">
            <Value>2024-03-10</Value>
            <Value>Hospital documentation</Value>
            <Value>Dr. Schmidt</Value>
          </Row>
        </Rows>
      </Rowset>
      <Statistics pagesize="20" startpos="0" total_hits="42"/>
    </ObjectType>
  </Archive>
  <Messages/>
</DMSContent>
```

### HOL — Hierarchical Object List

The HOL structure returns complete object data per instance. Each `<Object>` contains
fields, base parameters, rights information as well as optional child objects and variants.

```xml
<DMSContent format="HOL" version="5.00" timestamp="2024-03-15T10:30:00"
            user="admin" station="PC01">
  <Archive id="1" internal_name="patient">
    <ObjectType id="5" internal_name="medical_letter" type="DOCUMENT" modul="WINDOWS">
      <ObjectList>
        <Object id="9823" export_depth="0">
          <Fields>
            <Field internal_name="date" dbname="D001" type="DATE">2024-03-15</Field>
            <Field internal_name="subject" dbname="D002" type="TEXT">Discharge letter</Field>
          </Fields>
          <BaseParams>
            <Creator>admin</Creator>
            <Created value="1710500000">2024-03-15</Created>
            <CreationDate>2024-03-15</CreationDate>
            <Modifier>admin</Modifier>
            <Modified value="1710500000">2024-03-15</Modified>
            <Owner osguid="550e8400-e29b-41d4-a716-446655440000">admin</Owner>
            <Links>0</Links>
            <SystemID>0</SystemID>
            <ForeignID></ForeignID>
            <ArchiveState value="1">ARCHIVED</ArchiveState>
            <Archivist>admin</Archivist>
            <ArchiveDate>2024-03-15</ArchiveDate>
            <Locked value="0">UNLOCKED</Locked>
            <Version>1</Version>
          </BaseParams>
          <FileProperties extension="docx" mimetype="application/vnd.openxmlformats-officedocument.wordprocessingml.document" count="1" size="24576"/>
        </Object>
      </ObjectList>
      <Statistics pagesize="20" startpos="0" total_hits="1"/>
    </ObjectType>
  </Archive>
  <Messages/>
</DMSContent>
```

## Elements and Attributes

### `<DMSContent>` (root element)

| Attribute | Type | Default | Description |
|---|---|---|---|
| `format` | <<dataformat,dataformat>> | Required | Output format: `LOL`, `HOL` or `MIXED` |
| `system_id` | xs:long | `-1` | Internal system ID of the server |
| `lang_id` | xs:long | `7` | Language ID (7 = German) |
| `user` | xs:string | — | Logged-in user |
| `station` | xs:string | — | Computer/station name of the user |
| `timestamp` | xs:dateTime | — | Time of response (ISO 8601) |
| `version` | xs:string | `5.00` | enaio® server version |
| `instance` | xs:string | — | Server instance |
| `output_language` | xs:string | `0` | Output language (0 = server default) |
Child elements:

* `<Archive>` (0..*) — Archive container with hits
* `<TypelessObjects>` (0..1) — Typeless objects (only for certain jobs)
* `<Messages>` (1) — Error messages (empty if successful)

### `<Archive>`

Groups hits by archive. Is output once for each archive that contains hits.

| Attribute | Type | Default | Description |
|---|---|---|---|
| `id` | xs:long | `-1` | Numeric archive ID |
| `name` | xs:string | — | Display name of the archive |
| `internal_name` | xs:string | — | Internal name of the archive |
| `osguid` | xs:string | — | GUID of the archive |

### `<ObjectType>`

Describes the object type of the contained hits.

| Attribute | Type | Default | Description |
|---|---|---|---|
| `type` | <<objecttypes,objecttypes>> | — | Type of the object: `FOLDER`, `REGISTER` or `DOCUMENT` |
| `id` | xs:long | `-1` | Numeric ID of the object type |
| `maintype` | xs:short | `-1` | Main type of the object type. Value range and meaning: Object Type ID. |
| `cotype` | xs:short | `-1` | Subtype of the object type (lowword of the object type ID). |
| `table` | xs:string | — | Database table of the object type |
| `name` | xs:string | — | Display name of the object type |
| `internal_name` | xs:string | — | Internal name of the object type |
| `osguid` | xs:string | — | GUID of the object type |
| `modul` | <<modultype,modultype>> | `UNKNOWN` | Document module (only relevant for documents) |
| `encrypted` | xs:short | `0` | `1` = objects of this type are encrypted |
| `alias` | xs:string | — | Alias name of the object type |
| `fulltext` | xs:short | `0` | `1` = full-text index available |
Child elements:

* Either `<Rowset>` (LOL) or `<ObjectList>` (HOL)
* Optional `<SQL>` — the executed SQL statement (only if corresponding option is set)
* `<Statistics>` — hit statistics (always present)

### `<Rowset>` (LOL)

Contains the tabular search result. Columns are defined once in `<Columns>`,
the data values follow in `<Rows>`.

#### `<Columns>` / `<Column>`

`<Columns>` contains `<Column>` elements for each returned column and optionally
`<TableField>` elements for table fields.

`<Column>` carries the field name as text content and the complete field definition as attributes (<<field_ident,field_ident>>).

#### `<Rows>` / `<Row>` / `<Value>`

Each `<Row>` corresponds to a hit object.

| Attribute on `<Row>` | Type | Required | Description |
|---|---|---|---|
| `id` | xs:long | — | Object ID of the hit |
The `<Value>` elements within a `<Row>` correspond positionally to the columns from `<Columns>`.

| Attribute on `<Value>` | Type | Default | Description |
|---|---|---|---|
| Text content | xs:string | — | Display value of the field content (formatted/translated) |
| `value` | xs:string | — | Internal raw value (e.g. key of a catalog field) |
> **Note:** For catalog fields, the text content contains the display name (e.g. `male`), the `value` attribute contains the internal key (e.g. `M`). For programmatic processing, `value` should be used.

Table fields appear as `<TableField>` child elements in the `<Row>` (parallel to the `<Value>` elements).

### `<ObjectList>` (HOL)

Contains a list of `<Object>` elements with complete object data.

#### `<Object>`

| Attribute | Type | Required | Description |
|---|---|---|---|
| `id` | xs:long | Yes | Object ID |
| `export_depth` | xs:long | — | Export depth (for nested queries) |
Child elements of `<Object>` (all optional):

| Element | Content |
|---|---|
| `<Fields>` | Simple index fields as `<Field>` list (<<dms-content-field,Field element>>) |
| `<MultiFields>` | Multi-fields (<<dms-content-multifields,MultiFields>>) |
| `<TableFields>` | Table fields (<<dms-content-tablefields,TableFields>>) |
| `<Rights>` | Access rights of the logged-in user for this object (<<dms-content-rights,Rights>>) |
| `<BaseParams>` | Base parameters (creator, modification date, archiving status etc.) (<<dms-content-baseparams,BaseParams>>) |
| `<DocumentVariants>` | Document variants (only for documents with variants) (<<dms-content-variants,DocumentVariants>>) |
| `<FileProperties>` | File information (extension, MIME type, count, size) |
| `<ChildObjects>` | Child objects (for folders/registers with substructure) — contains further `<ObjectType>` elements |
| `<ExternalObjects>` | Linked objects from other archives — `<Archive>` → `<ObjectType>` |

#### `<Fields>` / `<Field>`

`<Fields>` contains `<Field>` elements, one per index field.

| Attribute | Type | Default | Description |
|---|---|---|---|
| Text content | xs:string | — | Display value of the field (formatted) |
| `value` | xs:string | — | Internal raw value (for catalog fields: key) |
| `displayname` | xs:string | — | Display name of the field (field label from the object type) |
| `name` | xs:string | — | Display name of the field |
| `internal_name` | xs:string | — | Internal (technical) name of the field |
| `dbname` | xs:string | — | Database column name |
| `osguid` | xs:string | — | GUID of the field |
| `object` | xs:string | — | Associated object type (for cross-field queries) |
| `system` | xs:short | `0` | `1` = system field |
| `type` | xs:string | — | Field type (internal, e.g. `BOOL`, `DATE`, `DECIMAL`, `TEXT`) |
| `datatype` | xs:string | — | Database data type |
| `ostype` | xs:string | — | enaio® field data type |
| `size` | xs:long | — | Field length in characters |
| `visible` | xs:short | `1` | `1` = field is visible, `0` = hidden |
| `sortpos` | xs:long | `-1` | Sorting position of the field in the mask |

#### `<MultiFields>` / `<MultiField>` / `<Page>` / `<Value>`

```xml
<MultiFields>
  <MultiField internal_name="keywords" dbname="D010">
    <Page id="1">
      <Value>Invoice</Value>
      <Value>2024</Value>
    </Page>
  </MultiField>
</MultiFields>
```

#### `<TableFields>` / `<TableField>`

Table fields in HOL format follow the `RowsetType`: `<Columns>/<Column>+` defines the columns,
`<Row id>/<Value>*` contains the rows.

```xml
<TableFields>
  <TableField internal_name="positions" dbname="D020">
    <Columns>
      <Column internal_name="pos_nr" dbname="D021">Pos.</Column>
      <Column internal_name="description" dbname="D022">Description</Column>
      <Column internal_name="amount" dbname="D023">Amount</Column>
    </Columns>
    <Row id="1">
      <Value>1</Value>
      <Value>Consultation</Value>
      <Value>1200.00</Value>
    </Row>
    <Row id="2">
      <Value>2</Value>
      <Value>Travel expenses</Value>
      <Value>350.00</Value>
    </Row>
  </TableField>
</TableFields>
```

#### `<Rights>`

Access rights of the currently logged-in user for the object.

| Attribute | Type | Default | Description |
|---|---|---|---|
| `modify_index` | xs:short | `0` | `1` = user may change index data |
| `modify_object` | xs:short | `0` | `1` = user may edit the object |
| `delete_object` | xs:short | `0` | `1` = user may delete the object |
| `export_object` | xs:short | `0` | `1` = user may export the object |
| `object_inserts` | xs:short | `0` | `1` = user may insert child objects |
`<Rights>` can contain `<ObjectInserts>` child elements that indicate how many objects of a specific type may still be inserted underneath:

| Attribute on `<ObjectInserts>` | Type | Required | Description |
|---|---|---|---|
| `type` | xs:long | Yes | Object Type ID |
| `count` | xs:long | Yes | Remaining allowed instances (`-1` = unlimited) |

#### `<BaseParams>`

Base parameters are system metadata that exist for every object.

| Element | Description |
|---|---|
| `<Creator>` | Creator user name |
| `<Created value="unix-ts">` | Creation time as formatted string; attribute `value` = Unix timestamp |
| `<CreationDate>` | Creation date without time |
| `<Modifier>` | Last modifier user name |
| `<Modified value="unix-ts">` | Modification time; attribute `value` = Unix timestamp |
| `<Owner osguid="...">` | Owner (user name as text, GUID as attribute) |
| `<Links>` | Number of links to this object |
| `<SystemID>` | System ID (for reference documents) |
| `<ForeignID>` | Foreign ID (for reference documents from external systems) |
| `<ArchiveState value="n">` | Archiving status as text (<<archivestatetype,ArchiveStateType>>) + numeric value as attribute |
| `<Archivist>` | User name of the archiver |
| `<ArchiveDate>` | Date of archiving |
| `<Locked value="n">` | Checkout status as text (<<lockedtype,LockedType>>) + numeric value as attribute |
| `<Version>` | Version number of the object |

#### `<DocumentVariants>` / `<DocumentVariant>`

Variants are recursively structured: each variant can itself contain sub-variants.

| Attribute | Type | Required | Description |
|---|---|---|---|
| `doc_id` | xs:long | Yes | Object ID of this variant |
| `doc_parent` | xs:long | Yes | Object ID of the parent variant (`-1` for the root variant) |
| `doc_ver` | xs:string | Yes | Version number (e.g. `1.0`, `2.0`) |
| `is_active` | xs:short | Yes | `1` = active variant |

### `<TypelessObjects>` / `<TypelessObject>`

Typeless objects are documents without assigned object type — for example, documents in the user tray
or the workflow tray. They are listed directly under `<DMSContent>` separately from `<Archive>`.

| Attribute | Type | Required | Description |
|---|---|---|---|
| `id` | xs:long | Yes | Object ID |
| `maintype` | xs:short | Yes | Document main type. Values and meaning: Object Type ID. |
| `module` | <<modultype,modultype>> | Yes | Document module |
| `user` | xs:string | Yes | Owner user name |
| `pagecount` | xs:long | Yes | Number of pages |
| `filesize` | xs:long | Yes | File size in bytes |
| `mimetypeid` | xs:long | Yes | MIME type ID |
| `timestamp` | xs:string | Yes | Timestamp of the object |

### `<Messages>` / `<Message>`

Server error messages. On successful call, `<Messages>` is empty.

| Attribute | Type | Required | Description |
|---|---|---|---|
| Text content | xs:string | — | Description of the error |
| `faultcode` | xs:long | Yes | Internal error code |
| `sourcecode` | xs:long | Yes | Source code (identifies the server component) |

### `<Statistics>`

Pagination information — always present, even if no hits are available.

| Attribute | Type | Required | Description |
|---|---|---|---|
| `pagesize` | xs:long | Yes | Maximum number of hits per page (configured in the request) |
| `startpos` | xs:long | Yes | Start position (0-based) of the first returned hit |
| `total_hits` | xs:long | Yes | Total number of hits (across all pages) |
> **Note:** For paginated browsing: Total pages = ⌈`total_hits` / `pagesize`⌉. The next page is requested by `startpos += pagesize`.

## Enumeration Types

### `dataformat`

| Value | Meaning |
|---|---|
| `LOL` | List of Lists — tabular format with `<Rowset>` |
| `HOL` | Hierarchical Object List — object format with `<ObjectList>` |
| `MIXED` | Combination of LOL and HOL |

### `objecttypes`

| Value | Meaning |
|---|---|
| `FOLDER` | Folder |
| `REGISTER` | Register |
| `DOCUMENT` | Document |

### `modultype`

| Value | Main type | Description |
|---|---|---|
| `GRAYSCALE` | `1` | Grayscale document |
| `BLACKWHITE` | `2` | Black/White document |
| `COLOR` | `3` | Color document |
| `WINDOWS` | `4` | Windows document (Office, PDF, …) |
| `MULTIMEDIA` | `5` | Multimedia document |
| `EMAIL` | `6` | Email document |
| `XML` | `7` | XML document |
| `CONTAINER` | `8` | Container document |
| `MULTIDOC` | — | Multi-page composite document |
| `REFERENCE` | — | Reference document (reference to external system) |
| `UNKNOWN` | — | Unknown document type |

### `ArchiveStateType`

| Value | Meaning |
|---|---|
| `ARCHIVED` | Document is archived |
| `ARCHIVABLE` | Document can be archived (released) |
| `NOT_ARCHIVABLE` | Document cannot be archived |
| `NO_PAGES` | Document has no pages |
| `PAGE_ERROR` | Error with one or more pages |
| `REFERENCE` | Reference document — no own archive |
| `UNKNOWN` | Status unknown |

### `LockedType`

| Value | Meaning |
|---|---|
| `UNLOCKED` | Document is not checked out |
| `SELF` | Document is checked out by current user |
| `OTHERS` | Document is checked out by another user |
| `EXTERNAL` | Document is externally locked |

## Complete Example (HOL with BaseParams and Rights)

```xml
<DMSContent format="HOL" version="5.00"
            timestamp="2024-03-15T10:30:00"
            user="admin" station="PC01" lang_id="7">
  <Archive id="1" internal_name="patient">
    <ObjectType id="5" internal_name="medical_letter"
                type="DOCUMENT" modul="WINDOWS" fulltext="1">
      <ObjectList>
        <Object id="9823">
          <Fields>
            <Field internal_name="date" dbname="D001" type="DATE"
                   ostype="DATE" sortpos="1" visible="1">2024-03-15</Field>
            <Field internal_name="subject" dbname="D002" type="TEXT"
                   ostype="TEXT" sortpos="2" visible="1">Discharge letter</Field>
            <Field internal_name="status" dbname="D003" type="TEXT"
                   ostype="LISTBOX" value="D">Final</Field>
          </Fields>
          <Rights modify_index="1" modify_object="0"
                  delete_object="0" export_object="1" object_inserts="0"/>
          <BaseParams>
            <Creator>admin</Creator>
            <Created value="1710500000">2024-03-15 10:13:20</Created>
            <CreationDate>2024-03-15</CreationDate>
            <Modifier>admin</Modifier>
            <Modified value="1710500000">2024-03-15 10:13:20</Modified>
            <Owner osguid="550e8400-e29b-41d4-a716-446655440000">admin</Owner>
            <Links>0</Links>
            <SystemID>0</SystemID>
            <ForeignID></ForeignID>
            <ArchiveState value="1">ARCHIVED</ArchiveState>
            <Archivist>admin</Archivist>
            <ArchiveDate>2024-03-15</ArchiveDate>
            <Locked value="0">UNLOCKED</Locked>
            <Version>3</Version>
          </BaseParams>
          <FileProperties extension="docx"
                          mimetype="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
                          count="1" size="24576"/>
        </Object>
      </ObjectList>
      <Statistics pagesize="20" startpos="0" total_hits="1"/>
    </ObjectType>
  </Archive>
  <Messages/>
</DMSContent>
```
