The second layer of Uniword’s verification pipeline validates XML parts against their W3C XML Schema (XSD) definitions.
1. Bundled Schemas
Uniword bundles 40+ XSD schemas from three standards bodies:
| Source | Directory | Description |
|---|---|---|
ISO |
|
ISO/IEC 29500 standard schema files |
ECMA |
|
ECMA-376 standard schema files |
Microsoft |
|
Microsoft-specific extension schemas |
These schemas cover all OOXML namespaces including WordProcessingML, DrawingML, Math, and document properties.
2. CLI Usage
XSD validation is opt-in because it is slower than OPC and semantic checks:
# Enable XSD validation with the --xsd flag
uniword verify document.docx --xsd
# Combine with other output options
uniword verify document.docx --xsd --json
uniword verify document.docx --xsd --verbose
3. How It Works
-
Each XML part in the DOCX package is extracted
-
The correct XSD schema is selected based on the part’s namespace
-
The XML is validated against the schema with namespace-aware parsing
-
Any schema violations are reported as issues
4. Namespace-Aware Validation
XSD validation uses namespace-aware parsing to correctly resolve element and attribute names. This means:
-
Elements with the
w:prefix are validated against WordProcessingML schemas -
Elements with the
a:prefix are validated against DrawingML schemas -
Mixed-namespace documents are validated against multiple schemas
5. When to Use XSD Validation
Use XSD validation when:
-
Debugging documents that fail to open in Microsoft Word
-
Verifying documents generated by third-party tools
-
Ensuring strict standards compliance
Skip XSD validation when:
-
Running quick checks on known-good documents (OPC + semantic is faster)
-
Processing documents in batch where speed matters