ddn.odf.validation

Structural validation for ODF packages.

Validates package structure, MIME consistency, mandatory streams, duplicate entries, invalid names, unsafe paths, broken manifest references, and invalid directory layout.

Reports findings through the shared diagnostic model and distinguishes fatal package corruption from recoverable compatibility warnings.

Types 1

Validates an ODF package's structural integrity.

Checks are performed based on the configured validation level:

  • MINIMAL: ZIP structure, mimetype entry presence.
  • STANDARD: MIME consistency, mandatory streams, manifest integrity, duplicate entries, path safety.
  • FULL: All standard checks plus detailed manifest cross-referencing.

Fatal diagnostics indicate unrecoverable package corruption. Warning and error diagnostics indicate recoverable problems.

Fields
private OdfValidationOptions _options
Methods
OdfDiagnosticCollector validate(OdfPackageReader reader)Validates a package reader and returns collected diagnostics.
void validateOrThrow(OdfPackageReader reader)Validates a package reader and throws on fatal errors.
void add(ref OdfDiagnosticCollector collector, OdfSeverity severity, OdfDiagnosticCode code, string message, string location = "", string packageEntry = "") @safe pure
bool isPathTraversal(string path) @safe pure nothrow
bool isInvalidPath(string path) @safe pure nothrow
ptrdiff_t indexOf(string s, string sub) @safe pure nothrow
ptrdiff_t indexOf(string s, char c) @safe pure nothrow
Constructors
this(OdfValidationOptions options)Constructs a validator with the given options.

Functions 5

fnvoid validateStyleReferences(const ref OdfStyles styles, ref OdfDiagnosticCollector collector, string container = "styles")Validates style references within an `OdfStyles` collection.
fnvoid validateSpreadsheetSheetNames(string[] sheetNames, ref OdfDiagnosticCollector collector)Validates spreadsheet sheet structure.
fnvoid validateDrawingPages(string[] pageNames, string[] masterPageNames, ref OdfDiagnosticCollector collector)Validates drawing page references.
fnvoid validatePresentationSlides(string[] slideNames, string[] masterPageNames, ref OdfDiagnosticCollector collector)Validates presentation slide references.
fnvoid validateChartSeries(string[] seriesNames, ref OdfDiagnosticCollector collector)Validates chart data source references.