aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-02-18 13:02:48 +0000
committerMichael Williamson <mike@zwobble.org>2024-02-18 13:02:48 +0000
commit1db36be2c2ed7db9b1e3ec96720cd1f3f17753c2 (patch)
treeb351d57c8ef9a7e278bbb3b7aca930d250d57b13 /mammoth
parent414f1cdd630de5a157dd54d3edd4da17bf313b49 (diff)
Add support for the strict document format
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/docx/office_xml.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/mammoth/docx/office_xml.py b/mammoth/docx/office_xml.py
index 0a6a8a8..bebd04c 100644
--- a/mammoth/docx/office_xml.py
+++ b/mammoth/docx/office_xml.py
@@ -3,22 +3,32 @@ from .xmlparser import parse_xml, XmlElement
_namespaces = [
+ # Transitional format
("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"),
+ ("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
("a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
("pic", "http://schemas.openxmlformats.org/drawingml/2006/picture"),
+
+ # Strict format
+ ("w", "http://purl.oclc.org/ooxml/wordprocessingml/main"),
+ ("r", "http://purl.oclc.org/ooxml/officeDocument/relationships"),
+ ("wp", "http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing"),
+ ("a", "http://purl.oclc.org/ooxml/drawingml/main"),
+ ("pic", "http://purl.oclc.org/ooxml/drawingml/picture"),
+
+ # Common
("content-types", "http://schemas.openxmlformats.org/package/2006/content-types"),
- ("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
("relationships", "http://schemas.openxmlformats.org/package/2006/relationships"),
- ("v", "urn:schemas-microsoft-com:vml"),
("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"),
+ ("v", "urn:schemas-microsoft-com:vml"),
("office-word", "urn:schemas-microsoft-com:office:word"),
]
def read(fileobj):
return _collapse_alternate_content(parse_xml(fileobj, _namespaces))[0]
-
+
def _collapse_alternate_content(node):
if isinstance(node, XmlElement):