# Documents and Schema

Understand nodes, marks, attributes and content rules through one bold paragraph.

QuireKit stores content as a document tree. A bold “Hello” has document, paragraph and text nodes. Bold is formatting on text, rather than another paragraph.

## Nodes, marks and attributes

```json [One bold paragraph]
{
  "type": "doc",
  "content": [{
    "type": "paragraph",
    "content": [{
      "type": "text",
      "text": "Hello",
      "marks": [{ "type": "bold" }]
    }]
  }]
}
```

Nodes represent structure such as paragraphs, headings and lists. Marks represent formatting such as bold or links. Attributes (`attrs`) store details such as heading levels or link destinations.

`content` contains child nodes: a list can contain list items, which contain paragraphs. This hierarchy is part of the document.

## Schema defines content rules

Installed Node and Mark extensions form Schema: supported nodes, allowed children, attributes and formatting. StarterKit supplies common rules for articles.

For new business content, define a Node and provide commands and display behavior. Drawing a box in the interface does not make it part of the saved document.

## One document, multiple views

JSON describes content; DOM, Canvas and SVG display it. Screen coordinates and selection highlights belong to View. HTML output for a custom node does not automatically provide Canvas layout.

## Common read and write operations

| Task | Method |
| --- | --- |
| Save structured content | `editor.getJSON()` |
| Export HTML | `editor.getHTML()` |
| Replace ordinary content | `editor.commands.setContent(content)` |
| Restore a complete document including top-level attributes | `editor.commands.replaceDocument(content)` |

Load old content with compatible extensions and validate model version and Schema. Reject or migrate unknown structures while preserving the original file. See [persistence](/en/guide/persistence) and [article versus Word models](/en/build/model).
