rustxform-core
Core data model shared across the rustxform
pipeline — the normalized, backend-agnostic representation of an
XLSForm after reading and parsing, and before XForm
emission.
┌────────┐ ┌───────┐ ┌───────┐
XLSForm ──▶│ reader │──▶│ parse │──▶│ xform │──▶ XForm XML
└────────┘ └───────┘ └───────┘
Workbook ▸▸ Survey ◂◂ (reads the model)
core: the types every stage speaks
rustxform-core has no dependencies and defines no behavior beyond a couple
of lookup helpers: it is purely the vocabulary the other crates exchange.
What it contains
| Type | Role |
|---|---|
Survey |
A whole parsed form: settings, a children node tree, choices, languages, entity, audit, external_instances, osm_tags. |
Node |
A tree node: Question, Group(Container) or Repeat(Container). |
Question |
A leaf field: kind, name, label/hint, logic columns, parameters, media, default, … |
Container |
A group or repeat: name, label, appearance, repeat count, children. |
Kind |
Resolved type semantics: Builtin, Select, Osm, or Unknown. |
Builtin / Control / SelectType |
The XForm mapping of a built-in type, its body control, and the selection flavor (One/Multiple/Rank). |
Preload / Action |
Metadata preloads (jr:preload) and model actions (odk:recordaudio, odk:setgeopoint). |
Choice / ChoiceList |
Choice options and named lists. |
Localized / Media |
Single- or multi-language text, and label media attachments. |
Entity |
An Entities declaration (create/update a dataset row). |
Settings |
Form-level settings (form_id, title, version, …). |
Example
use ;
// `resolve_builtin` maps an XLSForm type token to its XForm binding.
let integer = resolve_builtin.unwrap;
assert_eq!;
assert_eq!;
let note = resolve_builtin.unwrap;
assert!;
// `select_*`, `osm` and unrecognized tokens return `None` — they are resolved
// by the parser, which has the choice lists and tag sets in context.
assert!;
Every type derives Debug, Clone and PartialEq, so forms are easy to build
by hand in tests and to compare.
Note
This is an internal building block of the rustxform workspace. To compile
XLSForms, depend on the top-level
rustxform crate instead; reach for
rustxform-core only when you build other tools on the same model.
License
Licensed under either of Apache-2.0 or MIT at your option.