Skip to main content
Not all content is a PDF. The Kodexa Document format (KDDB) uses mixins to adapt the same underlying content node tree to different kinds of content — spatial documents with bounding boxes, editable markdown content, email messages, and more. This guide explains the content structure system, the available mixins, and how the UI, selectors, and extraction pipeline work with each one.

What is a Mixin?

A mixin is a label on a document that tells the platform how to interpret its content node tree. It determines:
  • Which viewer/editor the UI renders for the document
  • What node types are expected in the tree
  • What features are available on content nodes
  • How the content was produced (spatial parsing, markdown conversion, email ingestion, etc.)
Mixins are set on the document’s mixins field and are composable — a document can use multiple mixins when one builds on another.

Content Structure Overview

All content structures share the same underlying KDDB format, the same selector language, and the same extraction pipeline. The mixin simply changes how the content node tree is organized and how the UI presents it.

Spatial Content Structure

The spatial mixin is the original Kodexa content structure, designed for documents where physical layout matters — PDFs, scanned images, PowerPoints, and similar formats.

Tree structure

Key characteristics

  • Deep treedocumentpagecontent-arealineword
  • Bounding boxes — Every node carries spatial coordinates [x, y, width, height] describing its position on the page
  • Page-based — Content is organized by physical pages
  • Word-level granularity — Individual words are nodes, enabling precise tagging and spatial queries
  • Read-only in UI — Users view the spatial layout and tag content, but don’t edit the text directly

Spatial features

Content nodes in a spatial document carry spatial features:

Example selectors


Text Content Structure

The text mixin is the simplest structure, used for plain text content without spatial information or rich formatting.

Tree structure

Key characteristics

  • Shallow tree — Minimal hierarchy
  • No bounding boxes — No spatial positioning
  • No formatting — Plain text only
  • View-only in UI — Rendered as plain text

Markdown Content Structure

The markdown mixin represents rich-text content as a tree of block-level content nodes. Each block is an independently editable region in the UI, and inline formatting (bold, italic, links, inline code) is stored as markdown syntax within the block’s content.

Why block-level?

A full markdown AST would create nodes for every bold span, link, and inline code segment. This is unnecessarily complex for editing — every keystroke in a bold word would require tree restructuring. Instead, the markdown mixin uses block-level nodes only:
  • Block nodesheading, paragraph, list, code-block, etc. — are ContentNodes in the tree
  • Inline formatting**bold**, *italic*, [links](url), `code` — stays as markdown syntax within each block’s content string
This keeps the tree manageable, makes editing straightforward, and still allows selectors to query at the block level.

Tree structure

Block node types

These blocks contain text with optional inline markdown formatting. The content is stored in content_parts and rendered as rich text in the editor.

Key characteristics

  • Shallow treedocument → blocks, with nesting only for lists and tables
  • No bounding boxes — Content is not spatially positioned
  • Editable in UI — Block-based editor where each ContentNode is an editable block
  • Inline markdown — Rich formatting preserved as markdown syntax within block content

Example selectors


Email Content Structure

The email mixin composes the markdown mixin to represent email messages. Email-specific metadata (from, to, subject, date) is stored in document metadata, while the email body uses the same block-level markdown nodes.

Tree structure

Document metadata

Email headers are stored as document-level metadata, not as content nodes:

Attachments

Email attachments are not embedded in the email KDDB. Each attachment becomes its own document family in the store with the appropriate mixin:
  • A PDF attachment → spatial mixin with its own KDDB
  • A text file attachment → text mixin
  • A forwarded email → email mixin
The parent email’s metadata links to attachment document families. This keeps KDDBs focused and allows each attachment to go through its own processing pipeline.

Key characteristics

  • Root node is email (not document) — distinguishes email from general markdown
  • Composable — The email mixin includes the markdown mixin for the body
  • Headers in metadata — Email-specific data lives in document metadata, not the tree
  • Same block editor — The body uses the same block editor as the markdown mixin
  • Same selectors — Query the body with the same selector syntax

Example selectors


Workbook Content Structure

The workbook mixin represents spreadsheet content — Excel files and similar tabular formats. The content node tree mirrors the workbook’s structure: sheets contain rows, rows contain cells.

Tree structure

Cell features

Content nodes in a workbook document carry cell-specific features:

Key characteristics

  • Medium-depth treeworkbookworksheetrowcell
  • No bounding boxes — Cells are addressed by reference, not spatial coordinates
  • Cell references — Every cell carries a workbook:ref feature mapping it to its Excel address
  • Formula preservation — Formulas are stored alongside calculated values
  • Read-only in UI — Users view the spreadsheet and tag cells for extraction, but don’t edit values
  • Sheet tabs — Multiple worksheets render as tabs, similar to Excel

Example selectors


The Block Editor

The markdown and email mixins share a block-based editor in the Kodexa UI. Each content node is rendered as an independently editable block, similar to Notion or Google Docs.

How editing maps to the KDDB

Every user action in the editor corresponds directly to a KDDB content node operation:

Block type selection

Users can change a block’s type using a toolbar or / command. Compatible conversions include:
  • paragraphheadingblockquote
  • paragraphlist (wraps in a list with one list-item)
  • paragraphcode-block
  • Any text block → horizontal-rule (clears content)

Extraction Across All Content Structures

The extraction pipeline works the same way regardless of mixin. Tags are applied to content nodes, grouped by index, and converted to data objects: This means you can extract structured data from markdown and email content using the same data definitions, tagging models, and extraction engine that work with spatial documents. For example:
  • News articles — Extract entities, topics, dates, and quotes from markdown content
  • Emails — Extract action items, deadlines, and referenced documents from email bodies
  • Reports — Extract metrics, summaries, and key findings from rich-text documents

Choosing a Content Structure

You’re processing PDFs, scanned documents, images, or PowerPoints where physical layout matters. The spatial mixin preserves bounding boxes, page structure, and word-level positioning — essential for document understanding, table extraction, and content that needs to be visually overlaid on the original document.
You have plain text content with no formatting or layout requirements. This is the simplest structure and is appropriate for log files, raw text exports, or content that will be processed purely for its text.
You have rich-text content that users need to view and edit — news articles, reports, knowledge base entries, or any content that benefits from structured blocks (headings, lists, code, tables) with inline formatting. The block editor makes this content interactive.
You’re ingesting email messages. The email mixin gives you structured metadata (from, to, subject, date, threading) plus a markdown body that users can view and edit. Attachments become their own document families with appropriate mixins.
You’re processing Excel files, spreadsheets, or tabular data where cell structure matters. The workbook mixin preserves cell references, formulas, merged cells, and worksheet organization — essential for financial data extraction, tabular analysis, and content that needs to be visually mapped to a spreadsheet grid.

What’s Next?

Document Structure Deep Dive

Detailed look at content nodes, spatial data, and how the tree maps to real documents.

SDK Reference

Work with documents programmatically in Python and TypeScript.

Data Definitions

Define taxonomies to extract structured data from any content structure.

Selectors

Query content nodes using the XPath-like selector language.