From f127d6bbed76d3aab49e950ddabe637f63d1913a Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 3 Jan 2016 00:06:50 +0000 Subject: Ignore child nodes that aren't elements when reading children --- mammoth/docx/body_xml.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mammoth') 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)) -- cgit v1.2.3