问题
Is anyone familiar with OOXML schemas? I need to build a schema to validate the style of a specific documents based on certain rules and I can't find a certain reference or even example to start with.
回答1:
The reference for OOXML is Standard ECMA-376 Office Open XML File Formats. Be forewarned that the specification is complex; expect to have to do a lot of reading/learning about both the OOXML specification and XML technologies and techniques prior to making any progress.
See also:
- Where can I find the XSDs of DOCX XML files?
- XML/XSD validation for a Word doc
- Eric White's Open XML blog
回答2:
Word documents are usually just a flat sequence of paragraphs and tables (table cells contain paragraphs), though you can use/nest content controls to group paragraphs, and there are other more exotic objects such as altChunks.
Other things you might be interested in:
sectPr (controlling headers/footers, page size/orientation etc), since this is indicative of a new part/chapter
outline level?
The paragraph style is just a setting on a paragraph. Given this structure, schematron might not be quite so useful as it is against say docbook or TEI.
But transforming your main document part (word/document.xml) to something simpler via XSLT is potentially a good approach.
It all depends what your constraints look like.
来源:https://stackoverflow.com/questions/53581421/microsoft-word-ooxml-docx-documents-formatting-validation