From b582d776915c380dc7518d2586edb6cb9a7423cf Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 26 Sep 2026 21:41:47 +0100 Subject: Read the children of w:customXml elements --- NEWS | 4 ++++ mammoth/docx/body_xml.py | 1 + tests/docx/body_xml_tests.py | 3 +++ 3 files changed, 8 insertions(+) diff --git a/NEWS b/NEWS index b2ef148..6f224b7 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +# 1.13.0 + +* Read the children of w:customXml elements. + # 1.12.2 * Avoid excessive backtracking when parsing an unterminated string with many diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py index 7ecf43b..bf3e3ca 100644 --- a/mammoth/docx/body_xml.py +++ b/mammoth/docx/body_xml.py @@ -696,6 +696,7 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f "w:tbl": table, "w:tr": table_row, "w:tc": table_cell, + "w:customXml": read_child_elements, "w:ins": read_child_elements, "w:object": read_child_elements, "w:smartTag": read_child_elements, diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py index 963d3c4..1bce6e1 100644 --- a/tests/docx/body_xml_tests.py +++ b/tests/docx/body_xml_tests.py @@ -1286,6 +1286,9 @@ class TableTests(object): assert_equal([expected_warning], result.messages) +def test_children_of_w_custom_xml_are_converted_normally(): + _assert_children_are_converted_normally("w:customXml") + def test_children_of_w_ins_are_converted_normally(): _assert_children_are_converted_normally("w:ins") -- cgit v1.2.3