ddn.odf.common.options

Read, write, and validation options for ODF document processing.

Provides separate option structs for reading, writing, and validating ODF documents, with shared enums for common settings like validation level and compatibility target.

All options default to preservation-safe, permissive behavior.

Types 8

Controls how strictly ODF conformance rules are enforced.

PERMISSIVEPermissive mode loads common real-world files where safe and reports recoverable problems as diagnostics rather than throwing exceptions.
STRICTStrict mode reports conformance problems as errors and throws exceptions for violations.

Controls the level of validation applied during read or write operations.

NONENo validation is performed.
MINIMALOnly fatal structural problems are checked (e.g. missing mimetype, broken ZIP).
STANDARDStandard validation checks package structure, MIME consistency, mandatory streams, and manifest integrity.
FULLFull validation includes all standard checks plus XML well-formedness, required attributes, and known schema constraints.

Specifies the ODF compatibility target for serialization and validation.

ODF_1_0_COMPATTarget ODF 1.0 compatibility.
ODF_1_1_COMPATTarget ODF 1.1 compatibility.
ODF_1_2Target ODF 1.2 strict conformance.
ODF_1_2_COMPATTarget broad compatibility with common office suites (LibreOffice, Apache OpenOffice) while remaining valid ODF 1.2.
ODF_1_3Target ODF 1.3 strict conformance with enhanced digital signatures, change tracking, and RDF metadata.
ODF_1_4Target ODF 1.4 strict conformance with accessibility improvements.

Controls how unknown XML elements and attributes are handled.

PRESERVEUnknown XML subtrees and unsupported attributes are preserved in memory and serialized back during write. This is the default.
STRIPUnknown XML subtrees are stripped during parsing.

Controls how unknown package entries are handled.

PRESERVEUnknown package entries are preserved in memory and written back during save. This is the default.
STRIPUnknown package entries are ignored during read.

Options for reading (opening) an ODF document.

Defaults are preservation-safe and permissive.

Fields
OdfStrictness strictnessStrictness level for parsing. Defaults to `PERMISSIVE`.
OdfValidationLevel validationLevelValidation level applied during read. Defaults to `MINIMAL`.
OdfUnknownXmlPolicy unknownXmlPolicyHow to handle unknown XML elements and attributes. Defaults to `PRESERVE`.
OdfUnknownEntryPolicy unknownEntryPolicyHow to handle unknown package entries. Defaults to `PRESERVE`.
OdfCompatibilityTarget compatibilityTargetCompatibility target for interpreting documents. Defaults to `ODF_1_2_COMPAT`.
OdfDiagnosticCollector * diagnosticsOptional diagnostic collector. When provided, diagnostics are collected here instead of being thrown as exceptions (in permissive mode).
bool useExtensionHintWhen `true`, extension hints from the file extension are used as a secondary signal when the package MIME data is missing or ambiguous. Defaults to `true`.

Options for writing (saving) an ODF document.

Defaults produce deterministic output with preservation of unknown content.

Fields
OdfStrictness strictnessStrictness level for serialization. Defaults to `PERMISSIVE`.
OdfCompatibilityTarget compatibilityTargetCompatibility target for output. Defaults to `ODF_1_2_COMPAT`.
bool preserveUnknownWhen `true`, unknown XML subtrees and package entries preserved from the original document are written back. Defaults to `true`.
bool deterministicWhen `true`, the output is deterministic: namespace declarations, attribute ordering, and entry ordering are stable across runs. Defaults to `true`.
bool prettyPrintWhen `true`, the output XML is pretty-printed with indentation. Defaults to `false`.
string indentationIndentation string used when `prettyPrint` is `true`. Defaults to three spaces.
OdfDiagnosticCollector * diagnosticsOptional diagnostic collector for write-time warnings.
OdfValidationLevel validationLevelValidation level applied to the output before writing. Defaults to `NONE`.

Options for validating an ODF document.

These options control what checks are performed and how results are reported.

Fields
OdfValidationLevel validationLevelValidation level. Defaults to `STANDARD`.
OdfCompatibilityTarget compatibilityTargetCompatibility target for validation rules. Defaults to `ODF_1_2`.
OdfDiagnosticCollector * diagnosticsOptional diagnostic collector. When provided, validation results are collected here. Otherwise, a temporary collector is used and results are available from the validation function return value.
bool stopOnFirstFatalWhen `true`, validation stops after the first fatal error. Defaults to `false`.