diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-01-03 00:06:50 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-01-03 00:08:32 +0000 |
| commit | f127d6bbed76d3aab49e950ddabe637f63d1913a (patch) | |
| tree | 274a52ee4467ca04cf1463f9ac924dabe20920e8 /mammoth | |
| parent | ff7cd85b0e97aae22f4f4d954327fd8ddd6b1abb (diff) | |
Ignore child nodes that aren't elements when reading children
Diffstat (limited to 'mammoth')
| -rw-r--r-- | mammoth/docx/body_xml.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py index 680dede..f66eeae 100644 --- a/mammoth/docx/body_xml.py +++ b/mammoth/docx/body_xml.py @@ -3,7 +3,7 @@ import contextlib from .. import documents from .. import results from .. import lists -from .xmlparser import node_types +from .xmlparser import node_types, XmlElement def reader(numbering=None, @@ -293,7 +293,8 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f return handler(element) - def _read_xml_elements(elements): + def _read_xml_elements(nodes): + elements = filter(lambda node: isinstance(node, XmlElement), nodes) return _combine_results(map(read, elements)) \ .map(lambda values: lists.collect(values)) |
