aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-01-03 00:06:50 +0000
committerMichael Williamson <mike@zwobble.org>2016-01-03 00:08:32 +0000
commitf127d6bbed76d3aab49e950ddabe637f63d1913a (patch)
tree274a52ee4467ca04cf1463f9ac924dabe20920e8 /mammoth
parentff7cd85b0e97aae22f4f4d954327fd8ddd6b1abb (diff)
Ignore child nodes that aren't elements when reading children
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/docx/body_xml.py5
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))