Skip to content

validate the rules of DCLX archives - #241

Merged
vagenas merged 1 commit into
mainfrom
archive-validation
Nov 19, 2026
Merged

vagenas merged 1 commit into
mainfrom
archive-validation

Conversation

@vagenas

@vagenas vagenas commented Nov 19, 2026

Copy link
Copy Markdown
Member

Check the rules of Annex B on a .dclx archive's parts other than document.xml, and add rules on references from the markup.

Spec (Annex B)

  • A relative <src> URI MUST resolve to a part of the archive.
  • Every part SHOULD be OPC metadata, the target of a relationship, a page image or whole-track media file aligned with a page or <track>, or referenced by a relative URI in the markup.

Validator

  • validate() and doclang validate accept .dclx and report archive errors separately (ValidationError.archive_errors, an "Archive" section in the CLI output and JSON):
    • [Content_Types].xml: present, with the <Override> for /document.xml and a content type for every part.
    • _rels/.rels: present, with exactly one document relationship, targeting document.xml.
    • pages/{N} beyond the page count, audio/{N} and video/{N} beyond the number of <track>s, and more than one file per track per modality.
    • Relative <src> URIs that resolve to no part.
  • Parts that nothing accounts for are reported as warnings.
  • Archive rules apply as of the version they were introduced in: Annex B from 0.8, the new rules from 0.10. The version is spec_version if given, else the declared one, else the latest. Not checked with --xsd-only or --schematron-only.

Packer

  • pack(validate=True) / doclang pack --validate validates the built archive, not only its document, and writes no output if that fails.

Other

  • examples/archive-demo: declare the wav content type of its audio/1.wav.
  • Migration resolves <src> URIs and counts <track>s with the same code as the validator.

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
@vagenas
vagenas added this pull request to stack #242 November 19, 2026 12:12
@vagenas vagenas changed the title validate the archive rules of Annex B validate the rules of DCLX archives Nov 19, 2026
@vagenas
vagenas marked this pull request as ready for review November 19, 2026 13:31

@dolfim-ibm dolfim-ibm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@vagenas
vagenas merged commit 83f906e into main Nov 19, 2026
10 checks passed
@vagenas
vagenas deleted the archive-validation branch November 19, 2026 13:41
@vagenas vagenas mentioned this pull request Nov 19, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants