DocLangParams.include_namespace defaults to False, so every DocLang produced by docling-core starts with <doclang version="0.7"> without xmlns="https://www.doclang.ai/ns/v0". The reference toolkit's XSD requires the namespace, which means docling-core's own validated archive export fails on a trivial document:
import tempfile
from docling_core.types.doc import DoclingDocument
d = DoclingDocument(name="t")
d.add_text(label="text", text="Hello")
d.save_as_doclang_archive(filename=tempfile.mkdtemp() + "/t.dclx", validate=True)
doclang.validation.ValidationError: XSD validation failed:
Line 1: Element 'doclang': No matching global declaration available for the validation root.
Same with the CLI on export_to_doclang() output: doclang validate out.dclg fails (passes only with -n / --allow-empty-namespace), and doclang pack out.dclg --validate fails with no option to allow an empty namespace.
Suggestion: default include_namespace to True, or at least force it in save_as_doclang_archive() (the .dclx format requires a valid DocLang document.xml). Keeping it off for token-lean model input still makes sense, but as an opt-out.
Versions: docling-core 2.97.1 (also checked on main), doclang 0.7.3, Python 3.12, macOS.
Workaround we use: inject xmlns into the root before writing the file.
DocLangParams.include_namespacedefaults toFalse, so every DocLang produced by docling-core starts with<doclang version="0.7">withoutxmlns="https://www.doclang.ai/ns/v0". The reference toolkit's XSD requires the namespace, which means docling-core's own validated archive export fails on a trivial document:Same with the CLI on
export_to_doclang()output:doclang validate out.dclgfails (passes only with-n / --allow-empty-namespace), anddoclang pack out.dclg --validatefails with no option to allow an empty namespace.Suggestion: default
include_namespacetoTrue, or at least force it insave_as_doclang_archive()(the.dclxformat requires a valid DocLangdocument.xml). Keeping it off for token-lean model input still makes sense, but as an opt-out.Versions: docling-core 2.97.1 (also checked on
main), doclang 0.7.3, Python 3.12, macOS.Workaround we use: inject
xmlnsinto the root before writing the file.