stencil

Developer Troubleshooting

This document contains a small list of know-how related to dealing with the OOXML format.

XML namespace aliases

Problem: XML files must not contains xml namespace aliases starting with xml prefix.

Example: Bad alias: xml123, good alias: a123.

Solution: Use different alias names.

Ignorable attribute

Problem: The Ignorable attribute must contain valid XML namespace aliases.

It is a problem because many XML processors hide the aliases after parsing the XML document.

Solution: keep track of and reuse the xml ns alias names.

See also: Requires attribute of the Choice tag.

In numbering definition

The root node in the numbering definition must contain an Ignorable tag (which can be also empty). Needed for Word.

XML space attribute

Problem: space symbols disappear from the document.

Solution: Use the xml:space="preserve" attribute consequently.

Wrong relationships file

Problem: LibreOffice will not open an OOXML file if the relationships file contains an XML namespace alias.

Solution: Generate relationships files without XML namespace aliases (enforce the use of default XML namespace alias).

Invalid zip entries

Problem: The zip entry paths mut not contain a ../ part.

OOXML Model

 +-------------+
 | _rels/.rels | < this is the entry point
 +-------------+
        |
        v
 +-------------------+   +------------------------------+
 | word/document.xml |===| word/_rels/document.xml.rels |
 +-------------------+   +------------------------------+
                           |             |       |
                           v             |       v
                +--------------------+   |   +------------------+   +-----------------------------+
                | word/numbering.xml |   |   | word/header1.xml |===| word/_rels/header1.xml.rels | * references images
                +--------------------+   |   +------------------+   +-----------------------------+
                 > shared across all     v
                                        +-----------------+
                                        | word/styles.xml | > shared across all
                                        +-----------------+